Skip to content

Latest commit

 

History

History
113 lines (81 loc) · 5.44 KB

File metadata and controls

113 lines (81 loc) · 5.44 KB

AWS Lambda health check Terraform module

Labyrinth Labs logo

We help companies build, run, deploy and scale software and infrastructure by embracing the right technologies and principles. Check out our website at https://lablabs.io/


Terraform validation pre-commit

Description

A terraform module to deploy a health check lambda function and to provide AWS CloudWatch Metric Alarm resource.

Requirements

Name Version
terraform >= 1.0
aws >= 4.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.trigger resource
aws_cloudwatch_event_target.this resource
aws_cloudwatch_log_group.this resource
aws_cloudwatch_metric_alarm.default resource
aws_iam_policy.this resource
aws_iam_role.this resource
aws_iam_role_policy_attachment.this resource
aws_lambda_function.this resource
aws_lambda_permission.this resource
aws_sns_topic.sns resource

Inputs

Name Description Type Default Required
cw_metric_name CloudWatch metric name string n/a yes
cw_metric_namespace CloudWatch metric namespace string n/a yes
name n/a string n/a yes
region n/a string n/a yes
sg_ids n/a list(string) n/a yes
subnet_ids n/a list(string) n/a yes
target_url URL which is checked by the lambda function string n/a yes
lambda_schedule n/a string "cron(*/5 * * * ? *)" no
secret_name n/a string "" no

Outputs

No outputs.

Contributing and reporting issues

Feel free to create an issue in this repository if you have questions, suggestions or feature requests.

Validation, linters and pull-requests

We want to provide high quality code and modules. For this reason we are using several pre-commit hooks and GitHub Actions workflow. A pull-request to the master branch will trigger these validations and lints automatically. Please check your code before you will create pull-requests. See pre-commit documentation and GitHub Actions documentation for further details.

Building lambda package

  • use asdf to install necessary go version
  • compile go code
  • zip compiled code and push to the repository
asdf install

GOARCH=amd64 GOOS=linux go build -o bootstrap main.go

zip lambda.zip bootstrap

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.