Skip to content

Object Storage: service is not enabled in initial apply #1262

@docqube

Description

@docqube

Description

When applying new object storage resources (e.g. stackit_objectstorage_credentials_group and stackit_objectstorage_credential) in a new STACKIT project, the Terraform provider will not enable the object storage with the service enablement API. It'll return an error in the apply, the plan works fine though.

Steps to reproduce

  • Create a new STACKIT project
  • do not enable the Object Storage via the Portal (or API)
  • apply a stackit_objectstorage_credentials_group and/or stackit_objectstorage_credential

Actual behavior

A plan could look like this:

  # stackit_objectstorage_credentials_group.test will be created
  + resource "stackit_objectstorage_credentials_group" "test" {
      + credentials_group_id = (known after apply)
      + id                   = (known after apply)
      + name                 = "test"
      + project_id           = "<redacted>"
      + region               = "eu02"
      + urn                  = (known after apply)
    }
  # stackit_objectstorage_credential.test will be created
  + resource "stackit_objectstorage_credential" "test" {
      + access_key           = (known after apply)
      + credential_id        = (known after apply)
      + credentials_group_id = (known after apply)
      + expiration_timestamp = (known after apply)
      + id                   = (known after apply)
      + name                 = (known after apply)
      + project_id           = "<redacted>"
      + region               = "eu02"
      + secret_access_key    = (sensitive value)
    }

The applied plan will result in the following error, when the object storage service is not enabled manually:

stackit_objectstorage_credentials_group.test: Creating...
Error: Error creating credentials group
  with stackit_objectstorage_credentials_group.test,
  on test.tf line 15, in resource "stackit_objectstorage_credentials_group" "test":
  15: resource "stackit_objectstorage_credentials_group" "test" {
Enabling object storage project before creation: failed to create object
storage project: 409 Conflict  (&[{%!s(*string=0x40001305f0)
%!s(*string=0x4000130600)}]), status code 409, Body:
{"detail":[{"key":"project.create_conflict","msg":"Two concurrent calls try
to create the same project"}]}

Expected behavior

I would expect, that the terraform provider will enable the object storage service on its own, as it also does for other cloud services, like SKE.

After the object storage service is enabled in the requested region, the apply job works perfectly fine.

Environment

  • OS: macOS / Pipelines
  • Terraform version (see terraform --version): v1.11.4
  • Version of the STACKIT Terraform provider: v0.79.1

Additional information

none

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