Skip to content

Provider encounters a 404 error when creating a stackit_postgresflex_instance #1350

@dirkcjelli

Description

@dirkcjelli

Description

I face the same issue as in #1249

When provisioning a stackit_postgresflex_instance, tofu will error out with a 404 Not Found. In my case, the error occurs everytime.

Steps to reproduce

terraform {
  required_providers {
    stackit = {
      source  = "stackitcloud/stackit"
      version = "0.89.0"
    }
  }
}
provider "stackit" {
  default_region           = "eu01"
  service_account_key_path = "sa_key.json"
}

resource "stackit_postgresflex_instance" "test" {
  project_id      = var.project_id
  name            = "${var.psql_config.instance_name_prefix}-${var.stage_name}"
  acl             = var.psql_config.acl
  backup_schedule = var.psql_config.backup_schedule

  flavor = {
    cpu = var.psql_config.cpu
    ram = var.psql_config.ram
  }

  replicas = var.psql_config.replicas

  storage = {
    class = var.psql_config.storage_class
    size  = var.psql_config.storage_size
  }

  version = var.psql_config.version
  region  = var.psql_config.region

  lifecycle {
    prevent_destroy = true
  }
}

To reproduce:

  1. create a valid configuration for a stackit_postgresflex_instance (my code is above for reference
  2. run tofu apply

Actual behavior

I tried this multiple times today, both in our infra pipeline as well as manually and the error below always occurs (this is a difference to the ticket #1249 where the error seemed to be non-deterministic)

$ tofu apply
stackit_postgresflex_instance.test: Creating...
stackit_postgresflex_instance.test: Still creating... [10s elapsed]
╷
│ Error: Error creating instance
│
│   with stackit_postgresflex_instance.test,
│   on postgres-flex.tf line 1, in resource "stackit_postgresflex_instance" "test":
│    1: resource "stackit_postgresflex_instance" "test" {
│
│ Instance creation waiting: 404 Not Found, status code 404, Body: {"message":"Requested instance with ID: d516bdb0-aa15-49da-8a1c-cf6c8772f8a3 cannot be found","code":404,"type":"NotFound"}
│
│
│ Trace ID: "6495945cf7d608b4919fdfbbf8342df6"

The instance with the id d516bdb0-aa15-49da-8a1c-cf6c8772f8a3 (as seen in the error message) DOES get created, is visible in the Portal and works afterwards. Just tofu fails.

Expected behavior

Instance gets created without the provider erroring out

Environment

  • OS: both MacOS (locally) and Linux (Pipeline)
  • Terraform version (see terraform --version): OpenTofu v1.10.1
  • Version of the STACKIT Terraform provider: v0.89.0

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