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

* fix: make resource/data-source specific region attribute read-only

* fix: implemented review feedback
This commit is contained in:
Rüdiger Schmitz 2025-02-18 10:51:34 +01:00 committed by GitHub
parent bb472001de
commit 3e8dcc542b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 12 deletions

View file

@ -84,7 +84,7 @@ func (r *bucketDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
"project_id": "STACKIT Project ID to which the bucket is associated.",
"url_path_style": "URL in path style.",
"url_virtual_hosted_style": "URL in virtual hosted style.",
"region": "The resource region. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -117,7 +117,8 @@ func (r *bucketDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
},
"region": schema.StringAttribute{
// the region cannot be found automatically, so it has to be passed
Optional: true,
Optional: false,
Computed: true,
Description: descriptions["region"],
},
},

View file

@ -132,7 +132,7 @@ func (r *bucketResource) Schema(_ context.Context, _ resource.SchemaRequest, res
"project_id": "STACKIT Project ID to which the bucket is associated.",
"url_path_style": "URL in path style.",
"url_virtual_hosted_style": "URL in virtual hosted style.",
"region": "The resource region. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -175,7 +175,7 @@ func (r *bucketResource) Schema(_ context.Context, _ resource.SchemaRequest, res
Computed: true,
},
"region": schema.StringAttribute{
Optional: true,
Optional: false,
// must be computed to allow for storing the override value from the provider
Computed: true,
Description: descriptions["region"],

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. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -116,7 +116,8 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
},
"region": schema.StringAttribute{
// the region cannot be found automatically, so it has to be passed
Optional: true,
Optional: false,
Computed: true,
Description: descriptions["region"],
},
},

View file

@ -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. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -246,7 +246,7 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
},
},
"region": schema.StringAttribute{
Optional: true,
Optional: false,
// must be computed to allow for storing the override value from the provider
Computed: true,
Description: descriptions["region"],

View file

@ -83,7 +83,7 @@ func (r *credentialsGroupDataSource) Schema(_ context.Context, _ datasource.Sche
"name": "The credentials group's display name.",
"project_id": "Object Storage Project ID to which the credentials group is associated.",
"urn": "Credentials group uniform resource name (URN)",
"region": "The resource region. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -117,7 +117,8 @@ func (r *credentialsGroupDataSource) Schema(_ context.Context, _ datasource.Sche
},
"region": schema.StringAttribute{
// the region cannot be found automatically, so it has to be passed
Optional: true,
Optional: false,
Computed: true,
Description: descriptions["region"],
},
},

View file

@ -132,7 +132,7 @@ func (r *credentialsGroupResource) Schema(_ context.Context, _ resource.SchemaRe
"name": "The credentials group's display name.",
"project_id": "Project ID to which the credentials group is associated.",
"urn": "Credentials group uniform resource name (URN)",
"region": "The resource region. If not defined, the provider region is used.",
"region": "The resource region. Read-only attribute that reflects the provider region.",
}
resp.Schema = schema.Schema{
@ -174,7 +174,7 @@ func (r *credentialsGroupResource) Schema(_ context.Context, _ resource.SchemaRe
Computed: true,
},
"region": schema.StringAttribute{
Optional: true,
Optional: false,
// must be computed to allow for storing the override value from the provider
Computed: true,
Description: descriptions["region"],