fix(deps): update stackit sdk modules (#327)

* fix(deps): update stackit sdk modules

* remove deprecated fields from credentials resources

* remove deprecated fields from credentials resources

* add newly added fields to credentials resources

* remove deprecated fields from credentials datasource

* add newly added credential fields to datasources

* update acceptance tests

---------

Co-authored-by: Renovate Bot <renovate@whitesourcesoftware.com>
Co-authored-by: Gökçe Gök Klingel <goekce.goek_klingel@mail.schwarz>
This commit is contained in:
stackit-pipeline 2024-04-15 09:52:35 +02:00 committed by GitHub
parent 4917eda1ad
commit 18d3f4d1fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 262 additions and 284 deletions

View file

@ -10,7 +10,6 @@ import (
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
@ -35,9 +34,6 @@ type Model struct {
InstanceId types.String `tfsdk:"instance_id"`
ProjectId types.String `tfsdk:"project_id"`
Host types.String `tfsdk:"host"`
Hosts types.List `tfsdk:"hosts"`
HttpAPIURI types.String `tfsdk:"http_api_uri"`
Name types.String `tfsdk:"name"`
Password types.String `tfsdk:"password"`
Port types.Int64 `tfsdk:"port"`
Uri types.String `tfsdk:"uri"`
@ -153,16 +149,6 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
"host": schema.StringAttribute{
Computed: true,
},
"hosts": schema.ListAttribute{
ElementType: types.StringType,
Computed: true,
},
"http_api_uri": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"password": schema.StringAttribute{
Computed: true,
Sensitive: true,
@ -346,22 +332,8 @@ func mapFields(credentialsResp *logme.CredentialsResponse, model *Model) error {
strings.Join(idParts, core.Separator),
)
model.CredentialId = types.StringValue(credentialId)
model.Hosts = types.ListNull(types.StringType)
if credentials != nil {
if credentials.Hosts != nil {
var hosts []attr.Value
for _, host := range *credentials.Hosts {
hosts = append(hosts, types.StringValue(host))
}
hostsList, diags := types.ListValue(types.StringType, hosts)
if diags.HasError() {
return fmt.Errorf("failed to map hosts: %w", core.DiagsToError(diags))
}
model.Hosts = hostsList
}
model.Host = types.StringPointerValue(credentials.Host)
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
model.Name = types.StringPointerValue(credentials.Name)
model.Password = types.StringPointerValue(credentials.Password)
model.Port = types.Int64PointerValue(credentials.Port)
model.Uri = types.StringPointerValue(credentials.Uri)