Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

toneill818
Copy link

Description

Added two new variables private_subnet_tags_per_name and public_subnet_tags_per_name. This gives the ability to add tags to a specific subnet.

Motivation and Context

Fixes Issue #1129

@toneill818 toneill818 changed the title Allow Tags To Be Applied To Public/Private Subnets Based Off Of Their Names improvement: Allow Tags To Be Applied To Public/Private Subnets Based Off Of Their Names Nov 6, 2024
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))

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

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(

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], ""), {}),

@fatmcgav
Copy link

FWIW, #1139 has passed all CI checks 👍

@toneill818
Copy link
Author

Closing in favor of PR #1139

@toneill818 toneill818 closed this Nov 19, 2024
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants