Skip to content

Adding labels to a stackit_server resource is causing a replacement #1065

@NilsGriebner

Description

@NilsGriebner

Description

When adding a label to a existing stackit_server resource, terraform plan wants to replace the whole resource.

Steps to reproduce

First add a stackit_server resource like

resource "stackit_server" "my_server" {
  project_id = "my-project"
  name       = "myserver"
  boot_volume = {
    source_type = "volume"
    source_id   = "my-volume-id"
  }
  availability_zone = "my favorite az"
  machine_type      = "c1.2"
}

After that run terraform plan and terraform apply so that the resource is created. Now add the labels map to the resource like this:

resource "stackit_server" "my_server" {
  project_id = "my-project"
  name       = "myserver"
  labels = {
    mylabel = "foo"
 }
  boot_volume = {
    source_type = "volume"
    source_id   = "my-volume-id"
  }
  availability_zone = "my favorite az"
  machine_type      = "c1.2"
}

Run terraform plan again and observe the output. In my case Terraform wants to recreate the whole server.

Actual behavior

Terraform wants to replace the server.

Expected behavior

I'd expect that the labels are just added, without a resource replacement.

Environment

  • OS: Debian sid
  • OpenTofu version: v1.10.6
  • Version of the STACKIT Terraform provider: v0.69.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions