-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
improvement: Allow Tags To Be Applied To Public/Private Subnets Based Off Of Their Names #1131
Conversation
lookup(var.public_subnet_tags_per_az, element(var.azs, count.index), {}), | ||
lookup(var.public_subnet_tags_per_name, try( | ||
var.public_subnet_names[count.index], | ||
format("${var.name}-${var.public_subnet_suffix}-%s", element(var.azs, count.index)) |
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 get errors on this. I tried using lookup(var.public_subnet_tags_per_name, try(var.public_subnet_names[count.index], ""), {}),
which works better imo
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 how I implemented it in #1139 aswell :)
@@ -255,7 +259,11 @@ resource "aws_subnet" "private" { | |||
}, | |||
var.tags, | |||
var.private_subnet_tags, | |||
lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}) | |||
lookup(var.private_subnet_tags_per_az, element(var.azs, count.index), {}), | |||
lookup(var.private_subnet_tags_per_name, try( |
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 I used lookup(var.private_subnet_tags_per_name, try(var.private_subnet_names[count.index], ""), {}),
FWIW, #1139 has passed all CI checks 👍 |
Closing in favor of PR #1139 |
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. |
Description
Added two new variables
private_subnet_tags_per_name
andpublic_subnet_tags_per_name
. This gives the ability to add tags to a specific subnet.Motivation and Context
Fixes Issue #1129