|
1 | 1 | # terraform-aws-alb
|
2 |
| -Terraform module which creates ALB resources on AWS |
| 2 | +A Terraform module containing common configurations for an AWS Application Load |
| 3 | +Balancer (ALB) running over HTTP/HTTPS. Available through the [terraform registry](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws). |
3 | 4 |
|
| 5 | +## Assumptions |
| 6 | +* You want to create a set of resources for the ALB: namely an associated target group and listener. |
| 7 | +* You've created a Virtual Private Cloud (VPC) + subnets where you intend to put |
| 8 | +this ALB. |
| 9 | +* You have one or more security groups to attach to the ALB. |
| 10 | +* You want to configure a listener for HTTPS/HTTP |
| 11 | +* You've uploaded an SSL certificate to AWS IAM if using HTTPS |
4 | 12 |
|
5 |
| -**WORK IN PROGRESS** |
| 13 | +The module supports both (mutually exclusive): |
| 14 | +* Internal IP ALBs |
| 15 | +* External IP ALBs |
| 16 | + |
| 17 | +It's recommended you use this module with [terraform-aws-vpc](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws), |
| 18 | +[terraform-aws-security-group](https://registry.terraform.io/modules/terraform-aws-modules/security-group/aws), and |
| 19 | +[terraform-aws-autoscaling](https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws/). |
| 20 | + |
| 21 | +## Why ALB instead of ELB? |
| 22 | +The use-case presented here appears almost identical to how one would use an ELB |
| 23 | +BUT we inherit a few bonuses by moving to ALB. Those are best outlined in [AWS's |
| 24 | +documentation](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/). |
| 25 | +For an example of using ALB with ECS look no further than the [hashicorp example](https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/ecs-alb). |
| 26 | + |
| 27 | +## Resources, inputs, outputs |
| 28 | +[Resources](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=resources), [inputs](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=inputs), and [outputs](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=outputs) documented in the terraform registry. |
| 29 | + |
| 30 | +## Usage example |
| 31 | +A full example leveraging other community modules is contained in the [examples/test_fixtures directory](examples/test_fixtures). Here's the gist of using it via the Terraform registry: |
| 32 | +``` |
| 33 | +module "alb" { |
| 34 | + source = "terraform-aws-modules/alb/aws" |
| 35 | + vpc_id = "vpc-abcde012" |
| 36 | + subnets = ["subnet-abcde012", "subnet-bcde012a"] |
| 37 | + alb_security_groups = ["sg-edcd9784", "sg-edcd9785"] |
| 38 | + certificate_arn = "arn:aws:iam::123456789012:server-certificate/test_cert-123456789012" |
| 39 | + log_bucket = "logs-us-east-2-123456789012" |
| 40 | + log_prefix = "my-alb-logs" |
| 41 | +
|
| 42 | + tags { |
| 43 | + "Terraform" = "true" |
| 44 | + "Env" = "${terraform.workspace}" |
| 45 | + } |
| 46 | +} |
| 47 | +``` |
| 48 | +3. Always `terraform plan` to see your change before running `terraform apply`. |
| 49 | +4. Win the day! |
| 50 | + |
| 51 | +## Testing |
| 52 | +This module has been packaged with [awspec](https://github.com/k1LoW/awspec) tests through test kitchen. To run them: |
| 53 | +1. Install [rvm](https://rvm.io/rvm/install) and the ruby version specified in the [Gemfile](Gemfile). |
| 54 | +2. Install bundler and the gems from our Gemfile: |
| 55 | +``` |
| 56 | +gem install bundler; bundle install |
| 57 | +``` |
| 58 | +3. Configure variables in `test/fixtures/terraform.tfvars`. An example of how this should look is in [terraform.tfvars.example](test/fixtures/terraform.tfvars.example). |
| 59 | +4. Test using `kitchen test` from the root of the repo. |
| 60 | + |
| 61 | +## Contributing |
| 62 | +Report issues/questions/feature requests on in the [Issues](https://github.com/terraform-aws-modules/terraform-aws-alb/issues) section. |
| 63 | + |
| 64 | +Pull requests are welcome! Ideally create a feature branch and issue for every |
| 65 | +individual change made. These are the steps: |
| 66 | + |
| 67 | +1. Fork the repo to a personal space or org. |
| 68 | +2. Create your feature branch from master (`git checkout -b my-new-feature`). |
| 69 | +4. Commit your awesome changes (`git commit -am 'Added some feature'`). |
| 70 | +5. Push to the branch (`git push origin my-new-feature`). |
| 71 | +6. Create a new Pull Request and tell us about your changes. |
| 72 | + |
| 73 | +## Change log |
| 74 | +The [changelog](CHANGELOG.md) captures all important release notes. |
| 75 | + |
| 76 | +## Authors |
| 77 | +Created and maintained by [Brandon O'Connor](https://github.com/brandoconnor) - brandon@atscale.run. |
| 78 | + |
| 79 | +## License |
| 80 | +MIT Licensed. See [LICENSE](LICENSE) for full details. |
0 commit comments