terraform-aws-vpc
terraform-aws-vpc copied to clipboard
feat: Allow tagging on per-subnet basis
Description
New variables public_subnet_tags_per_subnet
, private_subnet_tags_per_subnet
, etc. Optional, no effect if not specified. If specified, they are additional tags to apply to each respective public and private subnet.
Extend the ability to allow naming and tagging route tables, EIPs, and NAT Gateways on per-subnet basis as well, add variables for that.
Motivation and Context
Previously, it was only possible to customize arbitrary tags on a per-AZ basis, not a per-subnet basis. You could customize the Name
tag on a per-subnet basis but not any other tag.
The VPCs in our environment have several different types of subnets. We would like to tag them differently, e.g. for cost attribution and reference in external Terraform code. Currently this is not possible: subnets can only be disambiguated by VPC, AZ, and visibility.
Breaking Changes
No breaking changes
How Has This Been Tested?
- [ ] I have updated at least one of the
examples/*
to demonstrate and validate my change(s) - [ ] I have tested and validated these changes using one or more of the provided
examples/*
projects - [x] I have executed
pre-commit run -a
on my pull request
This is currently running in production
Testing in our infrastructure with:

Generating expected Terraform plan:

This is now live in our infrastructure. I also added the ability to customize route table tagging.
I've completed the rollout of the new tagging system throughout our infrastructure, using the code from this pull request in production. No problems uncovered.
Awesome! LGTM!
I think this behavior is what we are looking for.
We wanted to be able to have 2 sets
of private subnets.
1 for our EKS cluster's worker nodes, and 1 for some other random servers that still survive post EKS migration. So we could just target the server
private subnets when deploying those specific EC2 Instances
I'd love to see this merged, this would address our use case as well: We'll need individual tags per sub-net, e.g. to control the assignment of load balancers to specific sub-nets in an EKS scenario, which is controlled by sub-net tags.
Once this Pull Request is merged, I will use it right away
@antonbabenko would you mind taking a look at this PR please, it's a really helpful and thorough addition, thanks
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
keep
@raxod502-plaid
Any chance you can fix the conflicts, id really love to get this one merged in.
There's not much point in fixing merge conflicts until we get confirmation from a maintainer that they are interested in merging the PR.
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
i need this PR.
We're hitting the same needs for our EKS setup at the moment: need to tag secondary subnets differently to tell karpenter to slowly start moving the nodes towards these subnets.
What are the plans for moving this PR forward?
I'm running into some of the same issues in our environment as well, needing to tag specific subnets differently due to different uses.
Hi, hitting the same needs here, it would be great to have this PR to move forward ;)
I think so!
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
Keep
Added the ability to customize NAT EIP and NAT Gateway tags in the same way as the other resources
@antonbabenko @bryantbiggs Any chance you could review this PR? This is a much requested feature. Thanks!
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
keep
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days
Not stale. @bryantbiggs would you be able to disable stale-bot on this PR to save people some time?
Hi, hitting the same needs here, please move this PR forward!!!!
tf-controller plan output:
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.
To apply this plan, please merge this pull request.
@bryantbiggs what needs to be done here to get this PR merged? If the conflicts are resolved will that be enough?
Hello team, any updates on when this PR will be merged?