-
-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating to new org and terraform registry #1
Migrating to new org and terraform registry #1
Conversation
Bumping the review here. I've still yet to test pulling this from the terraform registry (can't do that until it's published here and updated there) and I'm eager to test that functionality and make sure it aligns with the docs included. |
Bumping once more, hoping for review here. I have tests working elsewhere and would like to get it in this repo under that model as well but can't do that until this is merged in. @antonbabenko |
README.md
Outdated
* Internal IP ALBs | ||
* External IP ALBs | ||
|
||
It's recommended you use this module with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the new/supported repositories: https://github.com/terraform-aws-modules/terraform-aws-security-group and https://github.com/terraform-aws-modules/terraform-aws-elb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, I feel like it's a distinct and different task to alter all examples/tests to leverage the terraform registry modules. I'll do the work here but we should really strive for incremental changes where possible going forward.
README.md
Outdated
documentation](https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/). | ||
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). | ||
|
||
## Input Variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Terraform registry is parsing variables defined in *.tf files, so there is no need to put it here and remember to update it every time when something is changed in them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove. Thanks!
README.md
Outdated
* `tags` - A mapping of tags to assign to the resource. | ||
|
||
## Outputs | ||
* `alb_id` - `id` of the ALB created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for outputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
README.md
Outdated
log_bucket = "${var.log_bucket}" | ||
log_prefix = "${var.log_prefix}" | ||
subnets = "${var.public_subnets}" | ||
vpc_id = "${var.vpc_id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually put the highest-impact attributes at the top. In this case vpc_id and subnets at the most required.
Use complete values instead of references to data sources
, var
, other resources
. This example should show exactly what is expected, but not how you will pass it into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
} | ||
``` | ||
3. Always `terraform plan` to see your change before running `terraform apply`. | ||
4. Win the day! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do tomorrow! :)
examples/test_fixtures/main.tf
Outdated
} | ||
|
||
provider "template" { | ||
version = "1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you actually need a specific version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure it works with the latest stable version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again moved to optimistic. Version constraints are important and will only become more important moving forward. I would only feel comfortable unsetting this if the module were actually tested against those previous versions.
examples/test_fixtures/main.tf
Outdated
} | ||
|
||
module "sg_https_web" { | ||
source = "github.com/terraform-community-modules/tf_aws_sg//sg_https_only" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use new repo for security group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
} | ||
|
||
module "vpc" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rely on default VPC which is already created? I use it in other examples and I think it will work for your example too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to bring with my module an example that creates everything it needs. That way it's self-sufficient. Some default resources are inherently insecure (e.g. security groups) and I don't think it's a good idea to rely on them being in any particular state or existing at all especially since this is core to the test suite.
I'll be migrating this to the registry VPC module instead.
@@ -0,0 +1,60 @@ | |||
require 'awspec' | |||
puts $: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've deleted the puts. It was debugging info.
variables.tf
Outdated
type = "list" | ||
} | ||
|
||
variable "aws_region" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not be possible to customize in the module itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure what's meant by this. Can you explain?
variables.tf
Outdated
|
||
variable "alb_security_groups" { | ||
description = "A comma separated string of security groups with which we associate the ALB. e.g. 'sg-edcd9784,sg-edcd9785'" | ||
type = "list" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, list or string. Update description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
variables.tf
Outdated
|
||
variable "alb_name" { | ||
description = "The name of the ALB as will show in the AWS EC2 ELB console." | ||
default = "my-alb" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't make defaults for critical things like name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
variables.tf
Outdated
*/ | ||
|
||
variable "alb_is_internal" { | ||
description = "Determines if the ALB is internal. Default: false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually there is o need to write what is the default value, because it is visible 1 line below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed where relevant.
variables.tf
Outdated
} | ||
|
||
variable "alb_protocols" { | ||
description = "A comma delimited list of the protocols the ALB accepts. e.g.: HTTPS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make it to accept list natively and join to string, if resource expect string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
|
||
variable "backend_port" { | ||
description = "The port the service on the EC2 instances listen on." | ||
default = 80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No assumption. Make it fail, if user put bad value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again here, providing a default of what many if not most people would use (and a collection of defaults that work together) is not a bad approach. Following "make no assumptions " to a logical conclusion leaves a module consumer requiring to specify every last variable which strips some of the value of modules. Modules are intended to enable people to get started quickly with bundled resources. Part of that is adding defaults that are likely to fit many use cases.
|
||
variable "backend_protocol" { | ||
description = "The protocol the backend service speaks. Options: HTTP, HTTPS, TCP, SSL (secure tcp)." | ||
default = "HTTP" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, don't use default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't completely follow the logic of not providing any defaults... sane and often used defaults are a good thing to offer as they are in part what adds value to modules. If literally every variable is stripped of defaults, the result is a module that is pretty well as long as specifying all the components by hand without a module.
Can you make a better case for not providing defaults like this?
variables.tf
Outdated
} | ||
|
||
variable "cookie_duration" { | ||
description = "If load balancer connection stickiness is desired, set this to the duration that cookie should be valid. If no stickiness is wanted, leave it blank. e.g.: 300" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank, eg: 300. So what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example value that would work is "300". I've clarified the description.
variables.tf
Outdated
|
||
variable "health_check_path" { | ||
description = "The URL the ELB should use for health checks. e.g. /health" | ||
default = "/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@@ -0,0 +1,24 @@ | |||
output "alb_id" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put all outputs available from Terraform along with description which comes from documentation page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's meant by this. All outputs have descriptions and values. Can you clarify?
Sorry for the delay in response. |
All feedback addressed locally and I'll push up the branch in the next couple hours. A few questions to your comments are above. In the spirit of fairness I need a couple things if I'm going to keep maintaining the repo within this org:
I hope you can agree and make those adjustments. I would guess were likely just wanting to get naming right and consistent for this set of AWS modules and that you're striving for quality, but it's only fair for me to be credited with my work and have the ability to continue it as the maintainer. Sound good? 🤝 |
@brandoconnor I respect your contributions, ownership and completely agree with all you are saying. Also, small iterations are important, and we needed to make it fit the registry standards. This was mostly what I was trying to comment about. I will do my review during today and you can merge it when you want and publish to the registry. After that let's review each other code as normal. |
README.md
Outdated
[terraform-aws-security-group](https://registry.terraform.io/modules/terraform-aws-modules/security-group/aws), and | ||
[terraform-aws-autoscaling](https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws/). | ||
|
||
## Why ALB instad of ELB? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"instead"
locals.tf
Outdated
@@ -0,0 +1,18 @@ | |||
locals { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be generated using data-source, or load from template file (similar to how you do with certificates) to be more consistent throught the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you find a doc or the source code for it? I looked but didn't see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm so that's what I looked at but I thought an IAM policy was distinct from an S3 bucket policy. Turns out, they are different (S3 contains a principal and IAM doesn't) however that's an argument for this resource. That's all to say, if this can be used to generate more than IAM policy, it's probably badly named.
Will fix tonight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had exactly the same feeling when I first discovered that data source.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Many small improvements made for this move and release:
Added
data.tf
file.aws_caller_identity
now used to gather account_id rather than using a variable.target_group
and expanded foralb
.Changed
principle_account_id
(sp) moved to a data source rather than variable map. Spelling corrected./test/alb
directory which had module contents copied. Test kitchen now uses the module itself.