terraform-aws-vpc icon indicating copy to clipboard operation
terraform-aws-vpc copied to clipboard

feat: Allow tagging on per-subnet basis

Open raxod502-plaid opened this issue 1 year ago β€’ 50 comments

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

raxod502-plaid avatar Feb 28 '23 20:02 raxod502-plaid

Testing in our infrastructure with:

image

Generating expected Terraform plan:

image

raxod502-plaid avatar Feb 28 '23 22:02 raxod502-plaid

This is now live in our infrastructure. I also added the ability to customize route table tagging.

raxod502-plaid avatar Mar 02 '23 19:03 raxod502-plaid

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.

raxod502-plaid avatar Mar 03 '23 21:03 raxod502-plaid

Awesome! LGTM!

kahirokunn avatar Mar 06 '23 07:03 kahirokunn

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

jseiser avatar Mar 14 '23 16:03 jseiser

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.

hpschry avatar Apr 26 '23 07:04 hpschry

Once this Pull Request is merged, I will use it right away

reoring avatar Apr 27 '23 05:04 reoring

@antonbabenko would you mind taking a look at this PR please, it's a really helpful and thorough addition, thanks

davepattie avatar Jun 01 '23 09:06 davepattie

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

github-actions[bot] avatar Jul 02 '23 00:07 github-actions[bot]

keep

kahirokunn avatar Jul 02 '23 01:07 kahirokunn

@raxod502-plaid

Any chance you can fix the conflicts, id really love to get this one merged in.

jseiser avatar Jul 12 '23 14:07 jseiser

There's not much point in fixing merge conflicts until we get confirmation from a maintainer that they are interested in merging the PR.

raxod502-plaid avatar Jul 12 '23 14:07 raxod502-plaid

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

github-actions[bot] avatar Aug 12 '23 00:08 github-actions[bot]

i need this PR.

kahirokunn avatar Aug 12 '23 00:08 kahirokunn

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?

rarescosma avatar Aug 16 '23 07:08 rarescosma

I'm running into some of the same issues in our environment as well, needing to tag specific subnets differently due to different uses.

andrewmiskell avatar Aug 18 '23 15:08 andrewmiskell

Hi, hitting the same needs here, it would be great to have this PR to move forward ;)

netomin avatar Sep 13 '23 14:09 netomin

I think so!

kahirokunn avatar Sep 13 '23 14:09 kahirokunn

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

github-actions[bot] avatar Oct 14 '23 00:10 github-actions[bot]

Keep

kahirokunn avatar Oct 14 '23 00:10 kahirokunn

Added the ability to customize NAT EIP and NAT Gateway tags in the same way as the other resources

raxod502-plaid avatar Oct 26 '23 21:10 raxod502-plaid

@antonbabenko @bryantbiggs Any chance you could review this PR? This is a much requested feature. Thanks!

joshuabaird avatar Nov 06 '23 14:11 joshuabaird

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

github-actions[bot] avatar Dec 07 '23 00:12 github-actions[bot]

keep

kahirokunn avatar Dec 07 '23 06:12 kahirokunn

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

github-actions[bot] avatar Jan 07 '24 00:01 github-actions[bot]

Not stale. @bryantbiggs would you be able to disable stale-bot on this PR to save people some time?

raxod502-plaid avatar Jan 08 '24 16:01 raxod502-plaid

Hi, hitting the same needs here, please move this PR forward!!!!

manuelmazzuola avatar Mar 21 '24 08:03 manuelmazzuola

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.

Smana avatar Apr 02 '24 08:04 Smana

@bryantbiggs what needs to be done here to get this PR merged? If the conflicts are resolved will that be enough?

jandersen-plaid avatar Apr 19 '24 18:04 jandersen-plaid

Hello team, any updates on when this PR will be merged?

PLeS207 avatar May 15 '24 06:05 PLeS207