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
242 stars 168 forks source link

Docs - Example - Return a Connection String - Azure Private Endpoint #713

Closed Marcus-James-Adams closed 1 year ago

Marcus-James-Adams commented 2 years ago

Terraform CLI and Terraform MongoDB Atlas Provider Version

C:\work\repo\orgs\novia-financial\cloud_infrastructure\projects\platform\c17\UK_South\3.5.mongodb.atlas>terraform -version
Terraform v1.1.7
on windows_amd64
+ provider registry.terraform.io/hashicorp/azurerm v3.1.0
+ provider registry.terraform.io/mongodb/mongodbatlas v1.3.1

Terraform Configuration File

In the document the example is given as

output "plstring" {
    value = lookup(mongodbatlas_cluster.cluster-test.connection_strings[0].private_endpoint[0].srv_connection_string, azurerm_private_endpoint.test.id)
}
# Example return string: plstring = mongodb+srv://cluster-atlas-pl-0.za3fb.mongodb.net

Steps to Reproduce

My code

output "plstring" {
  value = lookup(mongodbatlas_cluster.main.connection_strings[0].private_endpoint[0].srv_connection_string, azurerm_private_endpoint.main.id)
}

Expected Behavior

Should return the connection string

Actual Behavior

 Error: Invalid function argument
│
│   on output.tf line 28, in output "plstring":
│   28:   value = lookup(mongodbatlas_cluster.main.connection_strings[0].private_endpoint[0].srv_connection_string, azurerm_private_endpoint.main.id)
│     ├────────────────
│     │ mongodbatlas_cluster.main.connection_strings[0].private_endpoint[0].srv_connection_string is "mongodb+srv://redacted-mongodb-cluster-pl-0.3xib3.mongodb.net"
│
│ Invalid value for "inputMap" parameter: lookup() requires a map as the first argument.

Other info

Both endpoints are showing up and connected The terraform has been refreshed

References

themantissa commented 2 years ago

Internal ticket created INTMDB-434 cc @Zuhairahmed

Zuhairahmed commented 1 year ago

@Marcus-James-Adams just FYI we released v1.6.1 today which includes this doc fix. feel free to re-open issue if you need anything else here and thanks again for raising issue!