Skip to content

Server resource: Availability Zone is mandatory / gets calculated as eu01-m #1073

@mkesper

Description

@mkesper

Description

Availability Zone is marked as optional in server resource.
Not filling it will lead to calculated zone of eu01-m and result in server creation waiting: found non-GenericOpenApiError: create failed for server with id xxx: No valid host was found. There are not enough hosts available.

Steps to reproduce

terraform {
  required_providers {
    stackit = {
      source = "stackitcloud/stackit"
    }
  }
}

provider "stackit" {
  default_region = "eu01"
}


resource "stackit_server" "myhost" {
  project_id   = var.project_id
  machine_type = var.arm_1c_4gb
  name         = "myhost"
  boot_volume = {
    size        = 20
    source_type = "image"
    source_id   = var.debian_12_arm64
  }
}
  1. tofu plan -out plan.out
  2. tofu apply plan.out

Actual behavior

$ tofu plan -out plan.out
...
OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

OpenTofu will perform the following actions:

  # stackit_server.myhost will be created
  + resource "stackit_server" "myhost" {
      + availability_zone = (known after apply)
      + boot_volume       = {
          + delete_on_termination = (known after apply)
          + id                    = (known after apply)
          + size                  = 20
          + source_id             = "61443b25-97fc-4f5a-acd5-0645c3b1ed5d"
          + source_type           = "image"
        }
      + created_at        = (known after apply)
      + id                = (known after apply)
      + launched_at       = (known after apply)
      + machine_type      = "g1r.1d"
      + name              = "myhost"
      + project_id        = "xxx"
      + server_id         = (known after apply)
      + updated_at        = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.out

To perform exactly these actions, run the following command to apply:
    tofu apply "plan.out"

$ tofu apply plan.out
stackit_server.myhost: Creating...
╷
│ Error: Error creating server
│ 
│   with stackit_server.myhost,
│   on main.tf line 14, in resource "stackit_server" "myhost":
│   14: resource "stackit_server" "myhost" {
│ 
│ server creation waiting: found non-GenericOpenApiError: create failed for server with id 6d947931-xxx No valid
│ host was found. There are not enough hosts available.
╵

Expected behavior

  • Require availability zone or
  • Calculate single AZ available to server deployments

Environment

  • OS: Debian GNU/Linux 13.2
  • Terraform version (see terraform --version): OpenTofu v1.10.7
  • Version of the STACKIT Terraform provider: v0.71.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions