diff --git a/docs/resources/objectstorage_bucket.md b/docs/resources/objectstorage_bucket.md index b8252f1b..a57260bd 100644 --- a/docs/resources/objectstorage_bucket.md +++ b/docs/resources/objectstorage_bucket.md @@ -3,12 +3,12 @@ page_title: "stackit_objectstorage_bucket Resource - stackit" subcategory: "" description: |- - ObjectStorage bucket resource schema. Must have a region specified in the provider configuration. + ObjectStorage bucket resource schema. Must have a region specified in the provider configuration. If you are creating credentialsgroup and bucket resources simultaneously, please include the depends_on field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background. --- # stackit_objectstorage_bucket (Resource) -ObjectStorage bucket resource schema. Must have a `region` specified in the provider configuration. +ObjectStorage bucket resource schema. Must have a `region` specified in the provider configuration. If you are creating `credentialsgroup` and `bucket` resources simultaneously, please include the `depends_on` field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background. ## Example Usage diff --git a/docs/resources/objectstorage_credentials_group.md b/docs/resources/objectstorage_credentials_group.md index ac2b51ea..4f7c0d74 100644 --- a/docs/resources/objectstorage_credentials_group.md +++ b/docs/resources/objectstorage_credentials_group.md @@ -3,12 +3,12 @@ page_title: "stackit_objectstorage_credentials_group Resource - stackit" subcategory: "" description: |- - ObjectStorage credentials group resource schema. Must have a region specified in the provider configuration. + ObjectStorage credentials group resource schema. Must have a region specified in the provider configuration. If you are creating credentialsgroup and bucket resources simultaneously, please include the depends_on field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background. --- # stackit_objectstorage_credentials_group (Resource) -ObjectStorage credentials group resource schema. Must have a `region` specified in the provider configuration. +ObjectStorage credentials group resource schema. Must have a `region` specified in the provider configuration. If you are creating `credentialsgroup` and `bucket` resources simultaneously, please include the `depends_on` field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background. ## Example Usage diff --git a/stackit/internal/services/objectstorage/bucket/resource.go b/stackit/internal/services/objectstorage/bucket/resource.go index 2486996c..b1671885 100644 --- a/stackit/internal/services/objectstorage/bucket/resource.go +++ b/stackit/internal/services/objectstorage/bucket/resource.go @@ -90,7 +90,7 @@ func (r *bucketResource) Configure(ctx context.Context, req resource.ConfigureRe // Schema defines the schema for the resource. func (r *bucketResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { descriptions := map[string]string{ - "main": "ObjectStorage bucket resource schema. Must have a `region` specified in the provider configuration.", + "main": "ObjectStorage bucket resource schema. Must have a `region` specified in the provider configuration. If you are creating `credentialsgroup` and `bucket` resources simultaneously, please include the `depends_on` field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background.", "id": "Terraform's internal resource identifier. It is structured as \"`project_id`,`name`\".", "name": "The bucket name. It must be DNS conform.", "project_id": "STACKIT Project ID to which the bucket is associated.", @@ -156,7 +156,7 @@ func (r *bucketResource) Create(ctx context.Context, req resource.CreateRequest, // Handle project init err := enableProject(ctx, &model, r.client) - if resp.Diagnostics.HasError() { + if err != nil { core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating bucket", fmt.Sprintf("Enabling object storage project before creation: %v", err)) return } diff --git a/stackit/internal/services/objectstorage/credential/resource.go b/stackit/internal/services/objectstorage/credential/resource.go index b6acaf15..f6baaa12 100644 --- a/stackit/internal/services/objectstorage/credential/resource.go +++ b/stackit/internal/services/objectstorage/credential/resource.go @@ -186,7 +186,7 @@ func (r *credentialResource) Create(ctx context.Context, req resource.CreateRequ // Handle project init err := enableProject(ctx, &model, r.client) - if resp.Diagnostics.HasError() { + if err != nil { core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credential", fmt.Sprintf("Enabling object storage project before creation: %v", err)) return } diff --git a/stackit/internal/services/objectstorage/credentialsgroup/resource.go b/stackit/internal/services/objectstorage/credentialsgroup/resource.go index b75b31a9..0be0f390 100644 --- a/stackit/internal/services/objectstorage/credentialsgroup/resource.go +++ b/stackit/internal/services/objectstorage/credentialsgroup/resource.go @@ -90,7 +90,7 @@ func (r *credentialsGroupResource) Configure(ctx context.Context, req resource.C // Schema defines the schema for the resource. func (r *credentialsGroupResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { descriptions := map[string]string{ - "main": "ObjectStorage credentials group resource schema. Must have a `region` specified in the provider configuration.", + "main": "ObjectStorage credentials group resource schema. Must have a `region` specified in the provider configuration. If you are creating `credentialsgroup` and `bucket` resources simultaneously, please include the `depends_on` field so that they are created sequentially. This prevents errors from concurrent calls to the service enablement that is done in the background.", "id": "Terraform's internal data source identifier. It is structured as \"`project_id`,`credentials_group_id`\".", "credentials_group_id": "The credentials group ID", "name": "The credentials group's display name.", @@ -159,7 +159,7 @@ func (r *credentialsGroupResource) Create(ctx context.Context, req resource.Crea // Handle project init err := enableProject(ctx, &model, r.client) - if resp.Diagnostics.HasError() { + if err != nil { core.LogAndAddError(ctx, &resp.Diagnostics, "Error creating credentials group", fmt.Sprintf("Enabling object storage project before creation: %v", err)) return }