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

Not able to obtain CSRS hostnames from mongodbatlas_cluster resource #543

Closed robbertkauffman closed 3 years ago

robbertkauffman commented 3 years ago

Terraform CLI and Terraform MongoDB Atlas Provider Version

Terraform: 1.0.4
Atlas provider: 1.0.0

Terraform Configuration File

# main.tf
resource "mongodbatlas_cluster" "test" {
  project_id   = "<YOUR-PROJECT-ID>"
  name         = "test"
  cluster_type = "REPLICASET"
  replication_specs {
    num_shards = 1
    regions_config {
      region_name     = "US_EAST_1"
      electable_nodes = 3
      priority        = 7
      read_only_nodes = 0
    }
  }
  provider_backup_enabled      = true
  auto_scaling_disk_gb_enabled = true
  mongo_db_major_version       = "4.4"
  provider_name               = "AZURE"
  provider_disk_type_name     = "P4"
  provider_instance_size_name = "M10"
}

# outputs.tf
output connection_strings {
  value = mongodbatlas_cluster.test.connection_strings
}

Steps to Reproduce

  1. terraform init
  2. terraform apply

Expected Behavior

One of the outputted connection strings (or via a separate exposed attribute), should include the CSRS (config server) hostnames. These hostnames are required when using a key manager like Azure Key Vault and access to the key manager is restricted to only allowed IPs. Without whitelisting the CSRS IPs, the cluster will not be able to be created (cluster automation will hang while trying to obtain the encryption keys).

Actual Behavior

All outputted connection strings contain the hostnames of the RS nodes only. Not the config server nodes.

Additional context

The reason why I consider this a bug rather than a feature request, is because CSRS hostnames/IPs are needed when setting network ACLs to key managers like Azure Key Vault. I currently have to use regex in order to 'get' the CSRS hostnames but this seems hacky.

themantissa commented 3 years ago

@robbertkauffman closing this issue as Terraform simply returns what's available in the API and CSRS hostnames are not returned - we cannot address this. This would be a better request to something like feedback.mongodb.com as it's not a bug but a feature/info request.