-
Notifications
You must be signed in to change notification settings - Fork 178
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]: error updating MongoDB Network Peering Connection - 400 (request "INVALID_ATTRIBUTE") Invalid attribute azureDirectoryId specified #2281
Comments
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:
The ticket CLOUDP-249269 was created for internal tracking. |
Hi @milesbarnard, it looks like you are passing an invalid azure directory_id. Few things I suggest:
|
Hi @marcosuma - this code worked previously, with the only change being I'm moving the peering to a different VNET. I tried it with the CLI command and it worked. Code: Please note I have tried adding the subscription id and directory id directly also locals { needed for Azure Onlyazure_directory_id = data.azurerm_client_config.current.tenant_id resource "azurerm_role_definition" "atlas_peering_role" { permissions { assignable_scopes = [ provider = azurerm.connectivity data "azurerm_client_config" "current" {} resource "azurerm_role_assignment" "atlas_peering_role" { data "azurerm_key_vault_secret" "mongodb-pubkey" { data "azurerm_key_vault_secret" "mongodb-privkey" { Configure the MongoDB Atlas Providerprovider "mongodbatlas" { Ensure you have created the required Azure service principal first, seesee https://docs.atlas.mongodb.com/security-vpc-peering/Container example provided but not always required,see network_container documentation for details.resource "mongodbatlas_network_container" "container" { Create the peering connection requestresource "mongodbatlas_network_peering" "peering" { Create the cluster once the peering connection is completedresource "mongodbatlas_cluster" "data-explorer" { cluster_type = "REPLICASET" auto_scaling_disk_gb_enabled = true Provider Settings "block"provider_name = "AZURE" depends_on = [mongodbatlas_network_peering.peering] The debug section is enormous and doesn't seem to contain anything more useful than this at first glance: |
Hi @milesbarnard, I have been able to reproduce your issue and found the root cause. The issue happens because in the PATCH endpoint to update peering connection (both in v1 and v2) have all the attributes as required, as if it was the POST operation used to create it. Terraform provider is only populating the attributes which have changed, so the final request fails because it's missing the other attributes. I will work on a fix and will let you know once the fix is available. Thanks again, |
Hi @milesbarnard, |
@oarbusi thanks so much for the speedy fix! |
Hi @milesbarnard, v1.16.1 has been released with the fix. |
Is there an existing issue for this?
Provider Version
v1.16.0
Terraform Version
v1.8.3
Terraform Edition
Terraform Open Source (OSS)
Current Behavior
When attempting to create a networking peering with Azure using Terraform I get the error:
│ Error: error updating MongoDB Network Peering Connection (<>): PATCH https://cloud.mongodb.com/api/atlas/v1.0/groups/<>/peers/<>: 400 (request "INVALID_ATTRIBUTE") Invalid attribute azureDirectoryId specified.
Terraform configuration to reproduce the issue
Steps To Reproduce
Using Terraform v1.8.3, mongodbatlas provider version v1.16.0 apply the above configuration
Logs
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: