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

[Bug]: mongodbatlas_network_peering returning incorrect outputs after update to 1.16.1 #2308

Closed
2 tasks done
a88zach opened this issue May 28, 2024 · 4 comments
Closed
2 tasks done

Comments

@a88zach
Copy link

a88zach commented May 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Provider Version

1.16.1

Terraform Version

1.8.4

Terraform Edition

Terraform Cloud

Current Behavior

After updating to version 1.16.1, the mongodbatlas_network_peering resource is returning incorrect outputs for a gcp peering connection.

Before:

output "atlas_vpc_project_id" {
  value = mongodbatlas_network_peering.gcp_peering.atlas_gcp_project_id # p-cwoo1hny1spwjsrffawz****
}

output "atlas_vpc_name" {
  value = mongodbatlas_network_peering.gcp_peering.atlas_vpc_name # nt-6579b219eabfad1605b3e2dc-qetx****
}

After:

output "atlas_vpc_project_id" {
  value = mongodbatlas_network_peering.gcp_peering.atlas_gcp_project_id # my-project-id
}

output "atlas_vpc_name" {
  value = mongodbatlas_network_peering.gcp_peering.atlas_vpc_name # my-network-name
}

Terraform configuration to reproduce the issue

locals {
  provider_name = mongodbatlas_advanced_cluster.cluster_rtd.replication_specs.0.region_configs.0.provider_name
  region_name   = mongodbatlas_advanced_cluster.cluster_rtd.replication_specs.0.region_configs.0.region_name
}

locals {
  container_id = "${local.provider_name}:${local.region_name}"
}

resource "mongodbatlas_network_peering" "gcp_peering" {
  project_id       = mongodbatlas_project.main_project.id
  atlas_cidr_block = "192.168.0.0/16"

  container_id   = mongodbatlas_advanced_cluster.cluster_rtd.replication_specs.0.container_id[local.container_id]
  provider_name  = "GCP"
  gcp_project_id = var.gcp_project_id
  network_name   = var.gcp_serverless_network_name
}

resource "google_compute_network_peering" "atlas_peering" {
  name         = "atlas-peering"
  network      = google_compute_network.serverless_network.self_link
  peer_network = "https://www.googleapis.com/compute/v1/projects/${mongodbatlas_network_peering.gcp_peering.atlas_gcp_project_id}/global/networks/${mongodbatlas_network_peering.gcp_peering.atlas_vpc_name}"
}

Steps To Reproduce

Set up a peering connection for GCP following the documentation. The peer_network for the google_compute_network_peering resource will be incorrect as the atlas_gcp_project_id will be the customer's project id and the atlas_vpc_name will be the customers network name

Logs

update
peer_network :
"https://www.googleapis.com/compute/v1/projects/p-cwoo1hny1spwjsrffawz****/global/networks/nt-6579b219eabfad1605b3e2dc-qetx****"
change to
"https://www.googleapis.com/compute/v1/projects/my-project-name/global/networks/my-network-name"
Forces replacement

Code of Conduct

  • I agree to follow this project's Code of Conduct
Copy link
Contributor

Thanks for opening this issue! Please make sure you've followed our guidelines when opening the issue. In short, to help us reproduce the issue we need:

  • Terraform configuration file used to reproduce the issue
  • Terraform log files from the run where the issue occurred
  • Terraform Atlas provider version used to reproduce the issue
  • Terraform version used to reproduce the issue
  • Confirmation if Terraform OSS, Terraform Cloud, or Terraform Enterprise deployment

The ticket CLOUDP-250959 was created for internal tracking.

@AgustinBettati
Copy link
Member

Hello @a88zach.
Thank you for bringing this up on a short notice, I was able to reproduce the issue and we are looking into a fix. I will keep you updated.

@AgustinBettati
Copy link
Member

Hi @a88zach, the fix associated to this issue has been merged and will be included in the next release. Thank you again for bringing this up.

@AgustinBettati
Copy link
Member

@a88zach The new 1.16.2 release includes this fix.

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

No branches or pull requests

2 participants