Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add aws_vpc_peering_connections to list all available peering connections #6350

Closed
moshea opened this issue Nov 4, 2018 · 4 comments · Fixed by #9491
Closed

add aws_vpc_peering_connections to list all available peering connections #6350

moshea opened this issue Nov 4, 2018 · 4 comments · Fixed by #9491
Labels
new-data-source Introduces a new data source. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@moshea
Copy link

moshea commented Nov 4, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

  • Add aws_vpc_peering_connections
    list all peering connections using filters, returning ids, cidr_blocks
    and peer_cidr_blocks
    useful when trying to build route tables between vpcs with multiple
    peering connections managed in different state files

New or Affected Resource(s)

  • aws_vpc_peering_connections

Potential Terraform Configuration

# Declare the data source
data "aws_vpc_peering_connections" "pcs" {
  filter {
    name = "requester-vpc-info.vpc-id"
    values = ["${aws_vpc.foo.id}"]
  }
}

# Create a route table
resource "aws_route_table" "rt" {
  vpc_id = "${aws_vpc.foo.id}"
}

# Create a route
resource "aws_route" "r" {
  count                     = "${length(data.aws_vpc_peering_connections.pcs.ids)}"
  route_table_id            = "${aws_route_table.rt.id}"
  destination_cidr_block    = "${element(data.aws_vpc_peering_connections.pcs.peer_cidr_blocks, count.index)}"
  vpc_peering_connection_id = "${element(data.aws_vpc_peering_connections.pcs.ids, count.index)}"
}

References

@moshea
Copy link
Author

moshea commented Nov 4, 2018

submitted a pull request for this too
#6351

@bflad bflad added the service/ec2 Issues and PRs that pertain to the ec2 service. label Nov 5, 2018
@aeschright aeschright added the needs-triage Waiting for first response or review from a maintainer. label Jun 24, 2019
@bflad bflad added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 12, 2019
@bflad bflad added this to the v3.5.0 milestone Sep 1, 2020
@bflad
Copy link
Contributor

bflad commented Sep 1, 2020

Support for this new data source has been merged and will release with version 3.5.0 of the Terraform AWS Provider, likely on Thursday. Thanks to @moshea and @tmccombs for the implementation. 👍

@ghost
Copy link

ghost commented Sep 3, 2020

This has been released in version 3.5.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 for triage. Thanks!

@ghost
Copy link

ghost commented Oct 2, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
3 participants