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

@ -79,7 +79,7 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
"credential_id": "The credential ID.",
"credentials_group_id": "The credential group ID.",
"project_id": "STACKIT Project ID to which the credential group is associated.",
"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{
@ -116,8 +116,7 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
},
"region": schema.StringAttribute{
// the region cannot be found automatically, so it has to be passed
Optional: false,
Computed: true,
Optional: true,
Description: descriptions["region"],
},
},
@ -138,7 +137,7 @@ func (r *credentialDataSource) Read(ctx context.Context, req datasource.ReadRequ
credentialId := model.CredentialId.ValueString()
var region string
if utils.IsUndefined(model.Region) {
region = r.providerData.Region
region = r.providerData.GetRegion()
} else {
region = model.Region.ValueString()
}