hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Enhancement]: tagging inline security group rules in existing resource or a new aws_security_group_v2 #37914

Open nitrocode opened 3 weeks ago

nitrocode commented 3 weeks ago

Description

Id like exclusive management of my security group rules to be in terraform and i want tagging.

There isnt an easy way to do this unless i want to forego exclusive management (vulnerable to clickops) or forego tagging.

Perhaps the original resource can be updated to allow tagging of inline rules or a new v2 resource can be created?

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

resource "aws_security_group" "example" {
  # ... other configuration ...

  egress {
    from_port       = 0
    to_port         = 0
    protocol        = "-1"
    prefix_list_ids = [aws_vpc_endpoint.my_endpoint.prefix_list_id]
    tags            = var.tags
  }

  tags = var.tags
}

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 3 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

ewbankkit commented 3 weeks ago

@nitrocode The aws_vpc_security_group_ingress_rule and aws_vpc_security_group_egress_rule resources are now the preferred way to managed security group rules and they both support rule tagging.

nitrocode commented 3 weeks ago

Yes but they don't allow me to enforce the entire security group in code like the inline rules do. This is why I'm suggesting either a separate sg resource or a modification of the existing sg resource