-
-
Notifications
You must be signed in to change notification settings - Fork 644
fix: Incorrect VPC selection for Security group introduced in #353 #357
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1638,7 +1638,7 @@ locals { | |
| } | ||
|
|
||
| data "aws_subnet" "this" { | ||
| count = local.create_security_group && var.vpc_id != null ? 1 : 0 | ||
| count = local.create_security_group ? 1 : 0 | ||
|
|
||
| region = var.region | ||
|
|
||
|
|
@@ -1653,7 +1653,7 @@ resource "aws_security_group" "this" { | |
| name = var.security_group_use_name_prefix ? null : local.security_group_name | ||
| name_prefix = var.security_group_use_name_prefix ? "${local.security_group_name}-" : null | ||
| description = var.security_group_description | ||
| vpc_id = try(data.aws_subnet.this[0].vpc_id, var.vpc_id) | ||
| vpc_id = coalesce(var.vpc_id, data.aws_subnet.this[0].vpc_id) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is incorrect - it has the potential to fail
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bryantbiggs, do you have any ideas on how to prevent this? |
||
|
|
||
| tags = merge( | ||
| var.tags, | ||
|
|
||
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.
this is incorrect - it should be
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.
@bryantbiggs, with the suggested code, the Terraform plan is failing on
example/complete. I tried this as well, but it didn't work, and I decided not to investigate further why it's not working.