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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data source for google_compute_interconnect_attachment #12624

Open
rjouhann opened this issue Sep 22, 2022 · 0 comments
Open

New data source for google_compute_interconnect_attachment #12624

rjouhann opened this issue Sep 22, 2022 · 0 comments

Comments

@rjouhann
Copy link

rjouhann commented Sep 22, 2022

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. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

In the case of the creation of the Google Interconnect with a Partner (e.g. PacketFabric, we need a way to fetch the current status of the Google Interconnect in order to automate the setup of the BGP session.

Create a new data source for google_compute_interconnect_attachment and add below new elements to the new data source output:

items[].cloudRouterIpAddress
items[].customerRouterIpAddress
items[].partnerAsn
items[].type
items[].operationalStatus
items[].state

New or Affected Resource(s)

  • google_compute_interconnect_attachment

Potential Terraform Configuration

# Create the Partner Google Interconnect
resource "google_compute_interconnect_attachment" "interconnect_1" {
  name          = var.interconnect_name
  region        = var.gcp_region1
  description   = "Interconnect to PacketFabric Network"
  type          = "PARTNER"
  admin_enabled = true # From the Google side: Accept (automatically) the connection.
  router        = google_compute_router.router_1.id
}

# Provision the Partner side of the connection
resource "packetfabric_google_cloud_router_connection" "crc_1" {
  provider                    = packetfabric
  description                 = var.description
  circuit_id                  = packetfabric_cloud_router.cr.id
  account_uuid                = var.pf_account_uuid
  google_pairing_key          = var.pf_crc_google_pairing_key
  google_vlan_attachment_name = var.pf_crc_google_vlan_attachment_name
  pop                         = var.pf_crc_pop2
  speed                       = var.pf_crc_speed
  maybe_nat                   = var.pf_crc_maybe_nat
}

# NEW DATA SOURCE: Fetch the google interconnect details to retrieve 
data "google_compute_interconnect_attachment" "interconnect_1" {
  name    = google_compute_interconnect_attachment.interconnect_1.name
}

# Setup BGP connection on the partner side
resource "packetfabric_cloud_router_bgp_session" "crbs_1" {
  provider       = packetfabric
  circuit_id     = packetfabric_cloud_router.cr.id
  connection_id  = packetfabric_aws_cloud_router_connection.crc_1.id
  address_family = var.pf_crbs_af
  multihop_ttl   = var.pf_crbs_mhttl
  remote_asn     = var.google_side_asn1
  orlonger       = var.pf_crbs_orlonger
  remote_address = google_compute_interconnect_attachment.interconnect_1.cloud_router_ip_address   # google side
  l3_address     = google_compute_interconnect_attachment.interconnect_1.customer_router_ip_address # PF side
}

References

b/302673037

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants