-
-
Notifications
You must be signed in to change notification settings - Fork 169
Create TF Module that implements public/private subnet strategy in existing VPC
#1
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
Conversation
|
@s2504s looks great! Just add |
subnets strategy to existing VPCsubnet strategy in existing VPC
… `vpc_default_route_table` already exists
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 plan has ended with errors.
Error running plan: 1 error(s) occurred:
* module.tf_subnets.aws_route_table_association.public: 2 error(s) occurred:
* module.tf_subnets.aws_route_table_association.public[0]: Resource 'aws_route_table.public' not found for variable 'aws_route_table.public.id'
* module.tf_subnets.aws_route_table_association.public[1]: Resource 'aws_route_table.public' not found for variable 'aws_route_table.public.id'
|
There was an issue if we try to use existing AWS Internet Gateway and Default Route Table. Even if we use code like this it doesn't work. Because if we do not create I've pinned |
|
I've tested Both are ok. |
|
@osterman please review |
public.tf
Outdated
| resource "aws_route_table_association" "public_exists" { | ||
| count = "${signum(length(var.vpc_default_route_table)) == 1 ? length(var.availability_zones) : 0}" | ||
| subnet_id = "${element(aws_subnet.public.*.id, count.index)}" | ||
| route_table_id = "${var.vpc_default_route_table}" |
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.
We should suffix with _id if it refers to an ID (for consistency).
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.
Added.
public.tf
Outdated
| route_table_id = "${aws_route_table.public.id}" | ||
| } | ||
|
|
||
| resource "aws_route_table_association" "public_exists" { |
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 we should call this public_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.
Renamed.
public.tf
Outdated
| tags = "${module.tf_label.tags}" | ||
| } | ||
|
|
||
| resource "aws_route_table_association" "public_new" { |
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.
Let's call this public so it's symetrical with aws_route_table.public
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.
Renamed.
|
Added required fixes. |
What
subnetstrategy using existing VPCWhy