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.75k stars 9.11k forks source link

[Enhancement]: Support filtering by tags for aws_ec2_transit_gateway Data source #35649

Closed AliAllomani closed 5 months ago

AliAllomani commented 7 months ago

Description

Adding the support to filter transit gateways by tags for aws_ec2_transit_gateway Data source would be beneficial for use-cases where filtering by the available options supported by AWS API is not sufficient

Filtering by tags can be performed on terraform provider level

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

Potential Terraform Configuration

data "aws_ec2_transit_gateway" "example" {
  tags {
     Name = "tgw"
     Project = "MyProject"
  }
}

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 7 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

djsd123 commented 5 months ago

💯%

I've not tried this yet but would specifying the tag in the filter argument suffice as a workaround?

Like so:

data "aws_ec2_transit_gateway" "tgw" {
  filter {
    name   = "tag:Name"
    values = ["tgw-prod"]
  }
}

Or

data "aws_ec2_transit_gateway" "tgw" {
  filter {
    name   = "tag:costcode"
    values = ["1234","4321"]
  }
}
AliAllomani commented 5 months ago

data "aws_ec2_transit_gateway" "tgw" { filter { name = "tag:Name" values = ["tgw-prod"] } }

Thanks @djsd123 , I have tested it and that works fine !

interestingly the usage of tag: as a filter name is not mentioned in AWS docs for DescribeTransitGateways

aws ec2 describe-transit-gateways --filters "Name=tag:Name,Values=tgw-prod"

With that, I'm closing this issue as the current filters argument is sufficient for such use-case

github-actions[bot] commented 5 months ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 4 months ago

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.