Skip to content

stackit_redis_instance forces replacement on parameter change #1677

Description

@codello

Description

When I change the parameters of a stackit_redis_instance, the redis instance is force-replaced, because its region changed. However, the region is actually the same value (provider default).

Steps to reproduce

Apply the following configuration:

terraform {
  required_version = ">= 1.11.1"
  required_providers {
    stackit = {
      source  = "stackitcloud/stackit"
      version = "0.108.0"
    }
  }
}

provider "stackit" {
  default_region = "eu01"
}

resource "stackit_redis_instance" "test" {
  project_id = "<some-id>"
  name       = "repro-test"
  plan_name  = "stackit-redis-1.4.10-single"
  version    = "7"

  #parameters = {
  #  maxmemory_policy = "noeviction"
  #}
}
  1. Run terraform init
  2. Run terraform apply
  3. Uncomment the parameters section (or change the maxmemory_policy to volatile-lru or something else)
  4. Run terraform apply again (or terraform plan)

Actual behavior

The first apply creates the redis instance. The second apply reports the following change (shortened for readability):

  # stackit_redis_instance.test must be replaced
-/+ resource "stackit_redis_instance" "test" {
        ...
        name                 = "repro-test"
      ~ parameters           = {
          ~ max_disk_threshold      = 80 -> (known after apply)
          + maxmemory_policy        = "noeviction"
          ...
        }
      ~ plan_id              = "3849f72f-99cc-4e2c-afda-700d66ef08f2" -> (known after apply)
      ~ region               = "eu01" # forces replacement -> (known after apply) # forces replacement
        # (3 unchanged attributes hidden)
    }

Expected behavior

I would expect this change to work without replacing the redis instance.

Known Workaround

Setting the region attribute of the redis instance to region = "eu01" solves the problem. The redis instance is updated in-place. The error seems to only occur when using the provider-default region.

The workaround only works during plan time. On apply I still get an error (see comment below).

Environment

  • OS: macOS 26.5.2
  • Terraform version (see terraform --version): OpenTofu v1.12.5 (also tested with Terraform v1.15.8)
  • Version of the STACKIT Terraform provider: v0.110.0

Additional information

This feels like the kind of problem that might affect other resources as well. I haven't explicitly checked any other resources.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions