-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Description
When creating a resource which is not yet enabled via the STACKIT UI the provider gives an unhelpful, unformatted error message.
Steps to reproduce
- Create a fresh STACKIT account
- Create credentials
- Create this terraform config
locals {
apps = ["monitoring", "a", "b", "c"]
stackit_project_id = "xxxxxx"
}
resource "stackit_objectstorage_credentials_group" "bucket_credentials_group" {
for_each = local.apps
project_id = local.stackit_project_id
name = each.value
}- Apply it
Actual behavior
I get this error message:
Error: Error creating credentials group
with stackit_objectstorage_credentials_group.bucket_credentials_group["monitoring"],
on buckets.tf line 18, in resource "stackit_objectstorage_credentials_group" "bucket_credentials_group":
18: resource "stackit_objectstorage_credentials_group" "bucket_credentials_group" {
Enabling object storage project before creation: failed to create object
storage project: 409 Conflict (&[{%!s(*string=0xc00003d200)
%!s(*string=0xc00003d210)}]), status code 409, Body:
{"detail":[{"key":"project.create_conflict","msg":"Two concurrent calls try
to create the same project"}]}
I see - now, while creating this issue - that the line Enabling object storage project before creation might be a hint to the problem. As a STACKIT User I find it confusing which services are enabled by default and which must be enabled by hand -- this is a different issue tho.
While debugging this, I focused on the API response: 409 Conflict - Two concurrent calls try to create the same project and assumed this was an issue with the resource names, an API call being "stuck" somewhere, or whatever.
Only when I logged into the UI and tried to check if there's anything to see, it showed me that the whole Object Storage had to be enabled.
After enabling, it worked as intended.
Expected behavior
I expect to get some hint that the remote (STACKIT) doesn't allow creation of the resource because it must be enabled first. Something like
Error: Error creating credentials group
with stackit_objectstorage_credentials_group.bucket_credentials_group["monitoring"],
on buckets.tf line 18, in resource "stackit_objectstorage_credentials_group" "bucket_credentials_group":
18: resource "stackit_objectstorage_credentials_group" "bucket_credentials_group" {
Enabling object storage project before creation: failed to create object
storage project: object storage is not enabled for your account, please activate it first on portal.stackit.cloud
Environment
- OS: Some Linux Git runner
- Terraform version (see
terraform --version):OpenTofu v1.9.1 - Version of the STACKIT Terraform provider:
~> 0.53