Skip to content

[Bug]: Provider produced inconsistent result after apply on advanced_configuration.oplog_size_mb when cluster scales tier/disk #4404

@Dima-Diachenko

Description

@Dima-Diachenko

Is there an existing issue for this?

  • I have searched the existing issues

Provider Version

v2.9.0

Terraform Version

v1.14.8

Terraform Edition

Terraform Open Source (OSS)

Current Behavior

Atlas-side update completes successfully, but Terraform errors at the apply post-read:

Image

Terraform configuration to reproduce the issue

Minimal reproducer (single-region Azure replica set with compute auto-scaling enabled). advanced_configuration.oplog_size_mb is intentionally not set in HCL:

resource "mongodbatlas_advanced_cluster" "this" {
  project_id             = var.project_id
  name                   = "repro-rfp"
  cluster_type           = "REPLICASET"
  mongo_db_major_version = "8.0"
  backup_enabled         = true
  pit_enabled            = true
  advanced_configuration = {
    minimum_enabled_tls_protocol = "TLS1_2"
  }
  replication_specs = [{
    region_configs = [{
      provider_name = "AZURE"
      region_name   = "US_WEST"
      priority      = 7
      electable_specs = {
        instance_size = "M50"   # <-- changed to M40 in the second apply
        node_count    = 3
        disk_size_gb  = 1024     # <-- changed to 512 in the second apply
      }
      auto_scaling = {
        compute_enabled            = true
        compute_scale_down_enabled = true
        compute_min_instance_size  = "M50"   # <-- changed to M40
        compute_max_instance_size  = "M60"   # <-- changed to M50
        disk_gb_enabled            = true
      }
    }]
  }]
}

Steps To Reproduce

  1. Deploy the cluster via terraform apply the config above.
  2. Change electable_specs.instance_size, electable_specs.disk_size_gb, and the auto_scaling.compute_min/max_instance_size to the lower tier (e.g. M40/512/M40/M50).
  3. terraform plan shows an in-place update; the diff for advanced_configuration is hidden / unchanged
  4. terraform apply does the the cluster scale down but fails with the error in the end:
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ mongodbatlas_advanced_cluster.this["production-rfp"], provider
│ "provider[\"registry.terraform.io/mongodb/mongodbatlas\"]" produced an
│ unexpected new value: .advanced_configuration.oplog_size_mb: was
│ cty.NumberIntVal(52429), but now cty.NumberIntVal(26215).
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵

Logs

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions