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]: include attachment state in the aws_ec2_transit_gateway_peering_attachment data source #36261

Closed mattwilder closed 6 months ago

mattwilder commented 6 months ago

Description

Similarly to the issue presented in #26754, it is impossible to fully automate the use of aws_ec2_transit_gateway_prefix_list_reference with peering attachments because there is no way to tell if the peering attachment has been accepted or not. If the aws_ec2_transit_gateway_peering_attachment data source were to include the attachment state, then one could prevent the creation of the prefix list reference until the attachment state is available.

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

Potential Terraform Configuration

resource "aws_ec2_managed_prefix_list" "this" {
  name = "My VPCs"
  address_family = "IPv4"
  max_entries = 10

  entry {
    cidr = "10.252.192.0/19"
    description = "My VPC"
  }
}

data "aws_ec2_transit_gateway_peering_attachment" "this" {
  id = "tgw-attach-example1"
}

resource "aws_ec2_transit_gateway_prefix_list_reference" "this" {
  count = data.aws_ec2_transit_gateway_peering_attachment.this.state == "available" ? 1 : 0

  prefix_list_id = aws_ec2_managed_prefix_list.this.id
  transit_gateway_attachment_id = "tgw-attach-example1"
  transit_gateway_route_table_id = "tgw-rtb-example1"
}

References

This would solve the same problem reported in #26754 in another way

Would you like to implement a fix?

None

github-actions[bot] commented 6 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

github-actions[bot] commented 6 months ago

This functionality has been released in v5.41.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 5 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.