Skip to content

Commit b5a4c76

Browse files
Migrating to new org and terraform registry (#1)
* migrating to the terraform registry and new org. Tests fixed and expanded. * updated docs * Giving thanks to contributors in the changelog * debugging rhcl failure * PR #1 feedback addressed - see CHANGELOG * fixed up the policy creation. tests not working atm * pre-commit config now in place * environment variable for region needed to be set. Handling this better in the subsequent release.
1 parent 3771b8f commit b5a4c76

File tree

19 files changed

+622
-2
lines changed

19 files changed

+622
-2
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.tfvars
2+
*.tfstate*
3+
.terraform
4+
**/inspec.lock
5+
*.gem
6+
.kitchen
7+
.kitchen.local.yml
8+
Gemfile.lock

.kitchen.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
driver:
3+
name: "terraform"
4+
directory: "examples/test_fixtures"
5+
6+
provisioner:
7+
name: "terraform"
8+
variable_files:
9+
- "examples/test_fixtures/terraform.tfvars"
10+
11+
platforms:
12+
- name: "aws"
13+
14+
verifier:
15+
name: "awspec"
16+
17+
suites:
18+
- name: "default"
19+
verifier:
20+
name: "awspec"
21+
patterns:
22+
- "test/integration/default/local_alb.rb"

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# See http://pre-commit.com for more information
2+
# See http://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
sha: v0.9.2
6+
hooks:
7+
- id: trailing-whitespace
8+
# - id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
## [1.0.2] - 2017-10-12
8+
### Added
9+
* moved data sources to dedicated `data.tf` file.
10+
* `aws_caller_identity` now used to gather account_id rather than using a variable.
11+
* tests added for `target_group` and expanded for `alb`.
12+
* input variables added for health checks, bucket policy, force_destroy_log_bucket - increasing flexibility.
13+
* circle CI config and badge
14+
15+
### Changed
16+
* altered structure of module to conform to the new [Terraform registry standards](https://www.terraform.io/docs/registry/modules/publish.html#requirements)
17+
* `principle_account_id` (sp) moved to a data source rather than variable map. Spelling corrected.
18+
* removed redundant `/test/alb` directory which had module contents copied. Test kitchen now uses the module itself.
19+
* pinned examples to provider and terraform versions to harden versioning.
20+
* self signed cert added to the test fixtures, eliminating the need for manual upload and terraform.tfvars configuration.
21+
* modules referenced in the test fixture are now sourced from the terraform registry.
22+
* moved bucket_policy.json and template rending to locals + optional variable input.
23+
* stringed list variables moved to native lists
24+
*
25+
26+
## [1.0.1] - 2017-09-14
27+
### Added
28+
* tag maps can now be provided (thanks @kwach)
29+
30+
### Changed
31+
* optional S3 logging (thanks @marocchino)
32+
33+
## [1.0.0] - 2017-03-16
34+
### Added
35+
* Tests and fixtures for ALB components using awspec and test kitchen
36+
* S3 log bucket and policy rendering for logging now in place
37+
* root_principle_id added and referenced through a map for s3 bucket policy
38+
* string lists moved to native list types
39+
* default region removed
40+
41+
### Changed
42+
* Restructured project templates to alb dir to add testing. This is a breaking change so upping major version.
43+
* Redundant examples dir removed
44+
* Updated documentation
45+
46+
## [0.1.0] - 2017-03-09
47+
### Added
48+
* Initial release.

Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ruby '2.4.2'
2+
3+
source 'https://rubygems.org/' do
4+
gem 'test-kitchen'
5+
gem 'kitchen-terraform'
6+
gem 'awspec'
7+
gem 'kitchen-verifier-awspec'
8+
gem 'rhcl'
9+
end

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2017 Brandon O'Connor - Run at Scale
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
# 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).
34

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
412

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) - [email protected].
78+
79+
## License
80+
MIT Licensed. See [LICENSE](LICENSE) for full details.

data.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "aws_caller_identity" "current" {}
2+
3+
data "aws_elb_service_account" "main" {}

examples/test_fixtures/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# test_fixtures example
2+
This set of templates serves two purposes:
3+
0. it shows developers how to use the module in a straightforward way as integrated with other terraform community supported modules.
4+
1. serves as the test infrastructure for CI on the project.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIETjCCAzagAwIBAgIJALi9NaeI/EcpMA0GCSqGSIb3DQEBBQUAMHcxCzAJBgNV
3+
BAYTAkdCMQ8wDQYDVQQIEwZMb25kb24xDzANBgNVBAcTBkxvbmRvbjEYMBYGA1UE
4+
ChMPR2xvYmFsIFNlY3VyaXR5MRYwFAYDVQQLEw1JVCBEZXBhcnRtZW50MRQwEgYD
5+
VQQDEwtleGFtcGxlLmNvbTAeFw0xNzA5MjcyMTIwNDlaF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