Skip to content

stackit_server produced an unexpected new value: .keypair_name: was xyz, but now null. #1069

@david-mey-STACKIT

Description

@david-mey-STACKIT

Description


│ Error: Provider produced inconsistent result after apply

│ When applying changes to
│ module.testproject["access-e2e-alb-v2b2-new-dev"].stackit_server.backend_servers["echo-1"],
│ provider "provider["registry.terraform.io/stackitcloud/stackit"]"
│ produced an unexpected new value: .keypair_name: was
│ cty.StringVal("ssh-backend-server-access-e2e-alb-v2b2-new-dev"), but now
│ null.

│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Steps to reproduce

resource "stackit_key_pair" "keypair" {
  name       = "ssh-backend-server-${var.project_name}"
  public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8XE1yErbjudtG3QSvwy6w6pqf/DUIdTmLvojKpHbjg+F1A5hnv2pi1RFvFo9qyLKw45m5quCXy1YFkyrlVx38qn6PvLX9g4nSWN/4eqY/W+HYpTXlW3HBGVZJVpdQFF6bsP5S8Ulh0HseuGW9eO6Bgox9cqyYqbPJ1xiqoaygsJ2eiPI9WT2mKIeoBIA+k4frI/K8jvGITWbTt5tbaEYgQdlxNXZ4JiVz/ylqhXTdcAF2Y4R4UbRbXInqgfQB8y/wQ+tTixYDQ+8rQcderUDbUKN7pWn3Je51Pep4a8srou1PX9ZfPZwF6MZbYWEg0N/vdE0xtkZRFxNcA1EdJVi1ySAeMBuM8GtudfTDocZEwXI05iy2L2VB4JBojsIGI7FjGm48/NV5cUaSez5vxFEUKNUiKwXbs3J0GitZrKwdEIu+xBHOCLxtJoLTQ8rHkZxoGPKK7UJb20heZZeDtqZv5IAN5VeeBcG3wNV62jLs6khGPKXIRj0WWu9219KBeXM="
}

resource "stackit_server" "backend_servers" {
  for_each   = var.backend_servers
  project_id = stackit_resourcemanager_project.test_project.project_id
  boot_volume = {
    size                  = 20
    source_type           = "image"
    source_id             = each.value.image_id
    delete_on_termination = true
  }
  name              = each.key
  machine_type      = each.value.flavor
  keypair_name      = stackit_key_pair.keypair.name
  availability_zone = each.value.availability_zone
  network_interfaces = [
    stackit_network_interface.nic[each.key].network_interface_id
  ]
  user_data = templatefile("${path.module}/userdata/userdata.yaml", {
    custom_ca_pem   = var.custom_ca_pem
    private_key_pem = var.private_key_pem
  })

  depends_on = [stackit_network.test_project_subnetwork, stackit_key_pair.keypair]
}
  1. Run terraform apply

Actual behavior

keypair is "null" after apply, but its actually in the VM and I can login

Expected behavior

no error

Environment

  • OS: ubuntu:24.04
  • Terraform version (see terraform --version): v1.10.5
  • Version of the STACKIT Terraform provider: v0.71.0

Additional information

The ssh key is actually in the VM and I can log in

Metadata

Metadata

Assignees

No one assigned

    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