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
232 stars 164 forks source link

[Bug]: No way to fetch online archive's connection string #2205

Closed marqueurs404 closed 2 months ago

marqueurs404 commented 2 months ago

Is there an existing issue for this?

Provider Version

1.15.3

Terraform Version

1.7.4

Terraform Edition

Terraform Open Source (OSS)

Current Behavior

I have spun up an online archive using the mongodbatlas_online_archive resource but can't seem to find a way to retrieve the archive-only connection string nor the cluster+archive connection string within terraform.

Terraform configuration to reproduce the issue

resource "mongodbatlas_advanced_cluster" "app" {
  project_id             = "development"
  name                   = "app"
  backup_enabled         = true
  cluster_type           = "REPLICASET"
  version_release_system = "CONTINUOUS"

  replication_specs {
    region_configs {
      provider_name = "AWS"
      region_name = "US_EAST_1"
      priority    = 7

      auto_scaling {
        compute_enabled            = true
        compute_scale_down_enabled = true
        compute_min_instance_size  = "M30"
        compute_max_instance_size  = "M50"
        disk_gb_enabled            = true
      }

      electable_specs {
        instance_size = "M30"
        node_count    = 3
      }
    }
  }
}

resource "mongodbatlas_online_archive" "events" {
  depends_on   = [mongodbatlas_advanced_cluster.app]
  project_id   = "development"
  cluster_name = "app"
  coll_name    = "events"
  db_name      = "main"

  data_process_region {
    cloud_provider = "AWS"
    region         = "US_EAST_1"
  }

  partition_fields {
    field_name = "createdAt"
    order      = 0
  }

  partition_fields {
    field_name = "_id"
    order      = 1
  }

  partition_fields {
    field_name = "obj_pk"
    order      = 2
  }

  criteria {
    type              = "DATE"
    date_field        = "createdAt"
    expire_after_days = 30
  }
}

Steps To Reproduce

  1. terragrunt apply
  2. terragrunt state show mongodbatlas_online_archive.events (can't find any connection strings)
  3. terragrunt state show mongodbatlas_advanced_cluster.app (not found in cluster's connection strings either)
  4. I can only get the string from atlas UI

Logs

No response

Code of Conduct

github-actions[bot] commented 2 months ago

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-245344 was created for internal tracking.

lantoli commented 2 months ago

thanks @marqueurs404 for opening the issue.

you're right that at the moment it's not exposed, it's not in the public Atlas API either.

I recommend you to create a feature request here: https://feedback.mongodb.com/forums/924145-atlas?category_id=389002

thanks and sorry the inconvenience