Fix error handling on object storage service enablement (#165)
* Fix error handling on objecto storage service enablement * Add message about depends_on * Update docs
This commit is contained in:
parent
35275fd336
commit
506d1afdc2
5 changed files with 9 additions and 9 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue