Fix/stackittpr 102 objectstorage handling region in individual resources (#711)

* Revert "fix: make resource/data-source specific region attribute read-only (#682)"

This reverts commit 3e8dcc542b.

* fix: Support individual regions

* fix: review findings
This commit is contained in:
Rüdiger Schmitz 2025-03-12 10:49:47 +01:00 committed by GitHub
parent 81f876adea
commit c257ac49e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
105 changed files with 176 additions and 143 deletions

View file

@ -87,7 +87,7 @@ func (r *credentialResource) modifyPlanRegion(ctx context.Context, req *resource
return
}
utils.AdaptRegion(ctx, configModel.Region, &planModel.Region, r.providerData.Region, resp)
utils.AdaptRegion(ctx, configModel.Region, &planModel.Region, r.providerData.GetRegion(), resp)
if resp.Diagnostics.HasError() {
return
}
@ -176,7 +176,7 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
"credentials_group_id": "The credential group ID.",
"project_id": "STACKIT Project ID to which the credential group is associated.",
"expiration_timestamp": "Expiration timestamp, in RFC339 format without fractional seconds. Example: \"2025-01-01T00:00:00Z\". If not set, the credential never expires.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
"region": "The resource region. If not defined, the provider region is used.",
}
resp.Schema = schema.Schema{
@ -246,7 +246,7 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
},
},
"region": schema.StringAttribute{
Optional: false,
Optional: true,
// must be computed to allow for storing the override value from the provider
Computed: true,
Description: descriptions["region"],
@ -349,7 +349,7 @@ func (r *credentialResource) Read(ctx context.Context, req resource.ReadRequest,
credentialId := model.CredentialId.ValueString()
region := model.Region.ValueString()
if region == "" {
region = r.providerData.Region
region = r.providerData.GetRegion()
}
ctx = tflog.SetField(ctx, "project_id", projectId)