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

@ -120,12 +120,6 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
ElementType: types.StringType,
Computed: true,
},
"http_api_uri": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"password": schema.StringAttribute{
Computed: true,
Sensitive: true,
@ -133,6 +127,9 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
"port": schema.Int64Attribute{
Computed: true,
},
"scheme": schema.StringAttribute{
Computed: true,
},
"uri": schema.StringAttribute{
Computed: true,
},

View file

@ -36,10 +36,9 @@ type Model struct {
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"`
Scheme types.String `tfsdk:"scheme"`
Uri types.String `tfsdk:"uri"`
Username types.String `tfsdk:"username"`
}
@ -157,12 +156,6 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
ElementType: types.StringType,
Computed: true,
},
"http_api_uri": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"password": schema.StringAttribute{
Computed: true,
Sensitive: true,
@ -170,6 +163,9 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
"port": schema.Int64Attribute{
Computed: true,
},
"scheme": schema.StringAttribute{
Computed: true,
},
"uri": schema.StringAttribute{
Computed: true,
},
@ -360,10 +356,9 @@ func mapFields(credentialsResp *opensearch.CredentialsResponse, model *Model) er
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.Scheme = types.StringPointerValue(credentials.Scheme)
model.Uri = types.StringPointerValue(credentials.Uri)
model.Username = types.StringPointerValue(credentials.Username)
}

View file

@ -30,10 +30,9 @@ func TestMapFields(t *testing.T) {
ProjectId: types.StringValue("pid"),
Host: types.StringNull(),
Hosts: types.ListNull(types.StringType),
HttpAPIURI: types.StringNull(),
Name: types.StringNull(),
Password: types.StringNull(),
Port: types.Int64Null(),
Scheme: types.StringNull(),
Uri: types.StringNull(),
Username: types.StringNull(),
},
@ -50,12 +49,11 @@ func TestMapFields(t *testing.T) {
"host_1",
"",
},
HttpApiUri: utils.Ptr("http"),
Name: utils.Ptr("name"),
Password: utils.Ptr("password"),
Port: utils.Ptr(int64(1234)),
Uri: utils.Ptr("uri"),
Username: utils.Ptr("username"),
Password: utils.Ptr("password"),
Port: utils.Ptr(int64(1234)),
Scheme: utils.Ptr("scheme"),
Uri: utils.Ptr("uri"),
Username: utils.Ptr("username"),
},
},
},
@ -69,12 +67,11 @@ func TestMapFields(t *testing.T) {
types.StringValue("host_1"),
types.StringValue(""),
}),
HttpAPIURI: types.StringValue("http"),
Name: types.StringValue("name"),
Password: types.StringValue("password"),
Port: types.Int64Value(1234),
Uri: types.StringValue("uri"),
Username: types.StringValue("username"),
Password: types.StringValue("password"),
Port: types.Int64Value(1234),
Scheme: types.StringValue("scheme"),
Uri: types.StringValue("uri"),
Username: types.StringValue("username"),
},
true,
},
@ -84,14 +81,13 @@ func TestMapFields(t *testing.T) {
Id: utils.Ptr("cid"),
Raw: &opensearch.RawCredentials{
Credentials: &opensearch.Credentials{
Host: utils.Ptr(""),
Hosts: &[]string{},
HttpApiUri: nil,
Name: nil,
Password: utils.Ptr(""),
Port: utils.Ptr(int64(2123456789)),
Uri: nil,
Username: utils.Ptr(""),
Host: utils.Ptr(""),
Hosts: &[]string{},
Password: utils.Ptr(""),
Port: utils.Ptr(int64(2123456789)),
Scheme: nil,
Uri: nil,
Username: utils.Ptr(""),
},
},
},
@ -102,10 +98,9 @@ func TestMapFields(t *testing.T) {
ProjectId: types.StringValue("pid"),
Host: types.StringValue(""),
Hosts: types.ListValueMust(types.StringType, []attr.Value{}),
HttpAPIURI: types.StringNull(),
Name: types.StringNull(),
Password: types.StringValue(""),
Port: types.Int64Value(2123456789),
Scheme: types.StringNull(),
Uri: types.StringNull(),
Username: types.StringValue(""),
},

View file

@ -21,7 +21,7 @@ var instanceResource = map[string]string{
"project_id": testutil.ProjectId,
"name": testutil.ResourceNameWithDateTime("opensearch"),
"plan_id": "9e4eac4b-b03d-4d7b-b01b-6d1224aa2d68",
"plan_name": "stackit-qa-opensearch-1.2.10-replica",
"plan_name": "stackit-opensearch-1.2.10-replica",
"version": "2",
"sgw_acl": "192.168.0.0/24",
}
@ -144,6 +144,7 @@ func TestAccOpenSearchResource(t *testing.T) {
resource.TestCheckResourceAttrSet("data.stackit_opensearch_credential.credential", "host"),
resource.TestCheckResourceAttrSet("data.stackit_opensearch_credential.credential", "port"),
resource.TestCheckResourceAttrSet("data.stackit_opensearch_credential.credential", "uri"),
resource.TestCheckResourceAttrSet("data.stackit_opensearch_credential.credential", "scheme"),
),
},
// Import
@ -208,7 +209,9 @@ func testAccCheckOpenSearchDestroy(s *terraform.State) error {
var client *opensearch.APIClient
var err error
if testutil.OpenSearchCustomEndpoint == "" {
client, err = opensearch.NewAPIClient()
client, err = opensearch.NewAPIClient(
config.WithRegion("eu01"),
)
} else {
client, err = opensearch.NewAPIClient(
config.WithEndpoint(testutil.OpenSearchCustomEndpoint),