mongodb / terraform-provider-mongodbatlas

Terraform MongoDB Atlas Provider: Deploy, update, and manage MongoDB Atlas infrastructure as code through HashiCorp Terraform
https://registry.terraform.io/providers/mongodb/mongodbatlas
Mozilla Public License 2.0
230 stars 167 forks source link

fix: Define values of `altas_gcp_project_id` and `atlas_vpc_name` in network peering by fetching associated container #2315

Closed AgustinBettati closed 1 month ago

AgustinBettati commented 1 month ago

Description

Link to any related issue(s): https://github.com/mongodb/terraform-provider-mongodbatlas/issues/2308 (CLOUDP-250959)

During the SDK migration (https://github.com/mongodb/terraform-provider-mongodbatlas/pull/2245) we changed the way we populate the computed values of altas_gcp_project_id and atlas_vpc_name. This breaks our example for creating a gcp peering network as it makes use of these computed values related to gcp.

These values were (previous to 1.16.1) fetched by obtaining the associated container (reference) and are now using values provided directly from the peering network response.

Example network_peering state 1.16.0

"attributes": {
            "atlas_gcp_project_id": "p-c1zgxlsyh45xj2dwadq0nlbe",
            "atlas_vpc_name": "nt-66564bd12d057908c6243c07-ql63a9ab",
            "gcp_project_id": "ofuscating",
            "network_name": "randomName",
            ...
          },

Example network_peering state 1.16.1

"attributes": {
            "atlas_gcp_project_id": "ofuscating",
            "atlas_vpc_name": "randomName",
            "gcp_project_id": "ofuscating",
            "network_name": "randomName",
            ...
          },

Example network_peering state after fix

"attributes": {
            "atlas_gcp_project_id": "p-45nlqzaiphqffrdbmzjk3mvy",
            "atlas_vpc_name": "nt-66564bd12d057908c62e3c07-0o71uun2",
            "gcp_project_id": "ofuscating",
            "network_name": "randomName",
            ...
          },

Type of change:

Required Checklist:

Further comments

github-actions[bot] commented 1 month ago

APIx bot: a message has been sent to Docs Slack channel