A Terraform module containing common configurations for an AWS Application Load Balancer (ALB) running over HTTP/HTTPS. Available through the terraform registry.
Branch | Build status |
---|---|
master |
- You want to create a set of resources for the ALB: namely an associated target group and listener.
- You've created a Virtual Private Cloud (VPC) + subnets where you intend to put this ALB.
- You have one or more security groups to attach to the ALB.
- You want to configure a listener for HTTPS/HTTP.
- You've uploaded an SSL certificate to AWS IAM if using HTTPS.
The module supports both (mutually exclusive):
- Internal IP ALBs
- External IP ALBs
It's recommended you use this module with terraform-aws-vpc, terraform-aws-security-group, and terraform-aws-autoscaling.
The use-case presented here appears almost identical to how one would use an ELB but we inherit a few bonuses by moving to ALB. Those are best outlined in AWS's documentation. For an example of using ALB with ECS look no further than the hashicorp example.
Resources, inputs, and outputs documented in the terraform registry.
A full example leveraging other community modules is contained in the examples/test_fixtures directory. Here's the gist of using it via the Terraform registry:
module "alb" {
source = "terraform-aws-modules/alb/aws"
alb_name = "my-alb"
alb_protocols = ["HTTPS"]
alb_security_groups = ["sg-edcd9784", "sg-edcd9785"]
certificate_arn = "arn:aws:iam::123456789012:server-certificate/test_cert-123456789012"
create_log_bucket = true
enable_logging = true
health_check_path = "/"
log_bucket_name = "logs-us-east-2-123456789012"
log_location_prefix = "my-alb-logs"
subnets = ["subnet-abcde012", "subnet-bcde012a"]
tags = "${map("Environment", "test")}"
vpc_id = "vpc-abcde012"
}
This module has been packaged with awspec tests through test kitchen. To run them:
- Install rvm and the ruby version specified in the Gemfile.
- Install bundler and the gems from our Gemfile:
gem install bundler; bundle install
- Ensure your AWS environment is configured (i.e. credentials and region) for test and set TF_VAR_region to a valid AWS region (e.g.
export TF_VAR_region=${AWS_REGION}
). - Test using
kitchen test
from the root of the repo.
Report issues/questions/feature requests on in the Issues section.
Pull requests are welcome! Ideally create a feature branch and issue for every individual change made. These are the steps:
- Fork the repo to a personal space or org.
- Create your feature branch from master (
git checkout -b my-new-feature
). - Commit your awesome changes (
git commit -am 'Added some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create a new Pull Request and tell us about your changes.
Testing and using this repo requires a minimum set of IAM permissions. Test permissions are listed in the test_fixtures README.
The changelog captures all important release notes.
Created and maintained by Brandon O'Connor - [email protected]. Many thanks to the contributers listed here!
MIT Licensed. See LICENSE for full details.