Skip to content

stackit_intake_runner: Create/Update wait handler queries Intake instead of Intake Runner endpoint (false 404, resource incorrectly tainted) #1618

Description

@ChrsBaur

Description

When creating (and likely updating) a stackit_intake_runner resource, Terraform reports a 404 error during the post-create readiness wait, even though the Intake Runner itself is created successfully and becomes active. As a result, Terraform marks the resource as tainted, which would cause a destroy+recreate on the next apply of a perfectly healthy, running resource.

Root Cause

In stackit/internal/services/intake/runner/resource.go, both the Create and Update functions call the wrong SDK wait handler — the one for the Intake resource instead of the Intake Runner resource:

// Create(), line 255:
_, err = wait.CreateIntakeWaitHandler(ctx, r.client.DefaultAPI, projectId, region, runnerResp.GetId()).WaitWithContext(ctx)

// Update(), line 354:
_, err = wait.UpdateIntakeWaitHandler(ctx, r.client.DefaultAPI, projectId, region, runnerId).WaitWithContext(ctx)

wait.CreateIntakeWaitHandler / wait.UpdateIntakeWaitHandler (from stackit-sdk-go/services/intake/v1betaapi/wait) call GetIntake(...) internally — i.e. they look up an Intake, not an Intake Runner — but they're being passed the Runner's ID. Since no Intake with that ID exists, the SDK call returns 404.

The SDK already provides the correct handlers, which the provider simply isn't calling:

  • wait.CreateIntakeRunnerWaitHandler(...) (should be used in Create)
  • wait.UpdateIntakeRunnerWaitHandler(...) (should be used in Update)

For reference, Delete() (line 407) correctly calls wait.DeleteIntakeRunnerWaitHandler, which confirms the correct pattern already exists elsewhere in the same file — this looks like a copy-paste mistake in Create/Update only.

Steps to Reproduce

resource "stackit_intake_runner" "this" {
  project_id            = "<project-id>"
  name                  = "example-runner"
  max_message_size_kib  = 256
  max_messages_per_hour = 20000
}

Run terraform apply.

Expected Behavior

Resource is created and Terraform waits on the Intake Runner's own readiness state.

Actual Behavior

Error: Error creating runner

  with stackit_intake_runner.this,
  on main.tf line X, in resource "stackit_intake_runner" "this":
   X: resource "stackit_intake_runner" "this" {

Intake runner creation waiting: 404 Not Found, status code 404, Body: {"message":"failed to get intake: Intake.api.intake.stackit.cloud
"intake-<runner-id>" not found"}

Terraform marks the resource tainted in state, even though stackit beta intake runner list confirms the runner was created and is "state": "active".

Impact

Running terraform apply again while the resource is tainted would destroy and recreate a healthy, already-running Intake Runner (new ID, breaking anything referencing the old one — e.g. an Intake created via stackit beta intake create --runner-id ...), and would presumably hit the same 404 again on recreation, since Create() has the same bug.

Current workaround: terraform untaint on the affected resource(s) after the error.

Versions

  • stackitcloud/stackit provider: confirmed present in v0.101.0 through v0.105.0 (latest at time of writing)
  • Terraform: 1.15.x

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