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:
parent
4917eda1ad
commit
18d3f4d1fb
22 changed files with 262 additions and 284 deletions
30
go.mod
30
go.mod
|
|
@ -11,22 +11,22 @@ require (
|
|||
github.com/hashicorp/terraform-plugin-go v0.22.1
|
||||
github.com/hashicorp/terraform-plugin-log v0.9.0
|
||||
github.com/hashicorp/terraform-plugin-testing v1.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.10.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.9.5
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.8.4
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.10.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.10.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.10.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.6
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.10.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.12.0
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.12.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.10.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.11.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.1
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.7
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.6.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.11.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.12.0
|
||||
golang.org/x/mod v0.17.0
|
||||
)
|
||||
|
||||
|
|
|
|||
60
go.sum
60
go.sum
|
|
@ -146,38 +146,38 @@ github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
|||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ=
|
||||
github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.10.1 h1:lzyualywD/2xIsYUHwlqCurG1OwlqCJVtJbOcPO6OzE=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.10.1/go.mod h1:mDX1mSTsB3mP+tNBGcFNx6gH1mGBN4T+dVt+lcw7nlw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.9.5 h1:RLsA2jO9sMNpn7NYdtFyumY5Vj4n4WtBm2J2NBKlsnw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.9.5/go.mod h1:lzGbqwV0hqeX/kUvaaFTgjOJRxUlsZ911TX1YAcKwqc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.8.4 h1:n/X2pVdETDXGHk+vCsg0p3b2zGxSRMJ065to/aAoncg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.8.4/go.mod h1:PvgUVFLgELRADWk2epZdCryk0fs8b4DN47ghEJjNWhk=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.10.0 h1:eX1v4n1nIyHmV5Z+GxrXy3MMbK1Li3f22ibkP/fOW30=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.10.0/go.mod h1:+VWG8mzoVDNx8Ga0O//rUdPbXpNG2p95dP1ijfM+h4U=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.10.1 h1:/yEAySr1P+52l82g93EBEBHLcu74UNZxBg/32EwOzDo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.10.1/go.mod h1:HSMbEONG7BoixaR7McsYgYmt/lKRc5GMzn2eIj3HFKs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.10.1 h1:Y0BwYv2+B3Dg8Wo9GkaWYf+CcNww9Xm38FB/chj6OiM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.10.1/go.mod h1:2KR68oxSpkiuBGYTYlESMP37oNlSMZXVgyQbSC4PZ+8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.1 h1:SDeQf60BgAwsnB3366yz58ElvVwlyd7M/lPZIEqv9gU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.1/go.mod h1:/hQ7GW2hAqcKjKlNCcVJA9zNu3vGFzRaPdhMjfoIKFo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.6 h1:+mcoBKs6ae4eJM0Whuf6lcGuwU341vaBQjr7W/WEGZg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.8.6/go.mod h1:W9BML8bqZb2dOZe1K+M+qBBs8/QNirr3jA0xxy9tNRY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.10.1 h1:LKic8dXtXKsRst2+wY9dNjjkMyJ05QIDpOJuRmVb410=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.10.1/go.mod h1:g1o1bmqtTliy9UkFlRV/6bn6GQk+hkvnny3UjMI69S0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.12.0 h1:W2WSYUyhKaHQ+BZfmyRw9PKv5q7ihGRyNhNgIlyM+Y8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.12.0/go.mod h1:P0YyvgwIsVKJijdWGVJVOp/ac7PVX99Oj+dr4v1zECc=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.12.0 h1:auIzUUNRuydKOScvpICP4MifGgvOajiDQd+ncGmBL0U=
|
||||
github.com/stackitcloud/stackit-sdk-go/core v0.12.0/go.mod h1:mDX1mSTsB3mP+tNBGcFNx6gH1mGBN4T+dVt+lcw7nlw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.10.0 h1:FAYOt6UBy/F2jPH2C/NnZnbjLZryJBjtM3afLVgGc4w=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/argus v0.10.0/go.mod h1:nVllQfYODhX1q3bgwVTLO7wHOp+8NMLiKbn3u/Dg5nU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.0 h1:sxvlcey7EcBc52rU6vYJEFguWkz9dNbSv2xJ3+c+97M=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/dns v0.9.0/go.mod h1:MdZcRbs19s2NLeJmSLSoqTzm9IPIQhE1ZEMpo9gePq0=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.11.0 h1:EYAmDHJzVjGefCQS3iz+SUjnp4QVfLvlHGKWqFvNAqA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.11.0/go.mod h1:wsO3+vXe1XiKLeCIctWAptaHQZ07Un7kmLTQ+drbj7w=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0 h1:/wqs+pfHSjFWTakJVQGD/KwArxmFN8qdYrJDUgA1Gxw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/logme v0.13.0/go.mod h1:bj9cn1treNSxKTRCEmESwqfENN8vCYn60HUnEA0P83c=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0 h1:qioXHNeQ2xdwT5iGOk0c3hQIpct7zlAYzLRqXvsJ7CA=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.13.0/go.mod h1:kPetkX9hNm9HkRyiKQL/tlgdi8frZdMP8afg0mEvQ9s=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0 h1:/m6N/CdsFxomexsowU7PwT1S4UTmI39PnEvvWGsDh1s=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.12.0/go.mod h1:iFerEzGmkg6R13ldFUyHUWHm0ac9cS4ftTDLhP0k/dU=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0 h1:rWgy4/eCIgyA2dUuc4a30pldmS6taQDwiLqoeZmyeP8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/objectstorage v0.9.0/go.mod h1:dkVMJI88eJ3Xs0ZV15r4tUpgitUGJXcvrX3RL4Zq2bQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0 h1:dzt2wd1QkFVctKPQDBlyMCsHEJV4Bf2bRkZTUFFCZhs=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/opensearch v0.13.0/go.mod h1:ZecMIf9oYj2DGZqWh93l97WdVaRdLl+tW5Fq3YKGwBM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0 h1:PGLjBZxWM7NIrH1+W1+f+/4kZEgwv9DGnXcUzOqM0M8=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.13.0/go.mod h1:SdrqGLCkilL6wl1+jcxmLtks2IocgIg+bsyeyYUIzR4=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.1 h1:u2jNFPPLM2TlpM1qUu1UuG9XKx/EYPjwg2nJqAK1HUY=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/postgresql v0.12.1/go.mod h1:rTbdB/rl+e9o9sJNrT3yMIaSNVBGqR5G2Vh4opKrEwo=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0 h1:Fle394socpyf662g3jMrtZpZaWVgBMBIEFnh4fnGock=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.10.0/go.mod h1:JvqOSrTCiynS0x6Y9OsK54yvdB6AtIWLwXDEjoCkAIg=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.1 h1:/tRad17HUcGRm448l8XyX6uhnnHVfj3VdUQquIwNq2Q=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.10.1/go.mod h1:vR/0cYTcVrPTTAHJGH2VT0H2g1D+wlx1n2WiAo6r5LI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.7 h1:yFxTdMj5al2pR4ZIOKKxoN8CHo2kTylurArt+jJMzxI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.7.7/go.mod h1:GvNV2GR0x0VGHzixGNgAJibqjwiVFwbxakpyu+qdijc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.6.0 h1:VC7VWadRo8r0eQUXMrYv6vEyS/5acW8faMSv9lxQMgw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.6.0/go.mod h1:KRoLXZdH8yuO6FBu2Grl5VGqW9arH03qYAC0P6H8h9o=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.11.0 h1:BJ1Op7f3KJPNROkEXzqAREl55JCqyIAyQJ+Gfu4LYCM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.11.0/go.mod h1:yFLjTx58pjHCp0KZTaqHlW9Qk60CY5HpnBWR/zztv8Y=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0 h1:bdmZhVAuyPiaAeJnBRLMVtVix6DYzNYbpdPiq/Z3XCI=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/rabbitmq v0.13.0/go.mod h1:eSgnPBknTJh7t+jVKN+xzeAh+Cg1USOlH3QCyfvG20g=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0 h1:MlREN/9zDntk90kahS0aJa/gPGAoUV4NLNnrTLs9CLc=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/redis v0.13.0/go.mod h1:3LhiTR/DMbKR2HuleTzlFHltR1MT1KD0DeW46X6K2GE=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0 h1:7AIvLkB7JZ5lYKtYLwI0rgJ0185hwQC1PFiUrjcinDM=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/resourcemanager v0.8.0/go.mod h1:p16qz/pAW8b1gEhqMpIgJfutRPeDPqQLlbVGyCo3f8o=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0 h1:1Ho+M4DyZHrwbDe1peW//x+/hegIuaUdZqbQEbPlr4k=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.7.0/go.mod h1:LX0Mcyr7/QP77zf7e05fHCJO38RMuTxr7nEDUDZ3oPQ=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.12.0 h1:sG45CkR+v8BUQBREROjTbJV/ZK5Xg+Rd6ulzM25UoGw=
|
||||
github.com/stackitcloud/stackit-sdk-go/services/ske v0.12.0/go.mod h1:0fFs4R7kg+gU7FNAIzzFvlCZJz6gyZ8CFhbK3eSrAwQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/logme"
|
||||
)
|
||||
|
|
@ -116,16 +115,6 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
|
|||
"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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/logme"
|
||||
|
|
@ -29,9 +28,6 @@ func TestMapFields(t *testing.T) {
|
|||
InstanceId: types.StringValue("iid"),
|
||||
ProjectId: types.StringValue("pid"),
|
||||
Host: types.StringNull(),
|
||||
Hosts: types.ListNull(types.StringType),
|
||||
HttpAPIURI: types.StringNull(),
|
||||
Name: types.StringNull(),
|
||||
Password: types.StringNull(),
|
||||
Port: types.Int64Null(),
|
||||
Uri: types.StringNull(),
|
||||
|
|
@ -45,17 +41,11 @@ func TestMapFields(t *testing.T) {
|
|||
Id: utils.Ptr("cid"),
|
||||
Raw: &logme.RawCredentials{
|
||||
Credentials: &logme.Credentials{
|
||||
Host: utils.Ptr("host"),
|
||||
Hosts: &[]string{
|
||||
"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"),
|
||||
Host: utils.Ptr("host"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -65,16 +55,10 @@ func TestMapFields(t *testing.T) {
|
|||
InstanceId: types.StringValue("iid"),
|
||||
ProjectId: types.StringValue("pid"),
|
||||
Host: types.StringValue("host"),
|
||||
Hosts: types.ListValueMust(types.StringType, []attr.Value{
|
||||
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),
|
||||
Uri: types.StringValue("uri"),
|
||||
Username: types.StringValue("username"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -84,14 +68,11 @@ func TestMapFields(t *testing.T) {
|
|||
Id: utils.Ptr("cid"),
|
||||
Raw: &logme.RawCredentials{
|
||||
Credentials: &logme.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(""),
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -101,9 +82,6 @@ func TestMapFields(t *testing.T) {
|
|||
InstanceId: types.StringValue("iid"),
|
||||
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),
|
||||
Uri: types.StringNull(),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ var instanceResource = map[string]string{
|
|||
"project_id": testutil.ProjectId,
|
||||
"name": testutil.ResourceNameWithDateTime("logme"),
|
||||
"plan_id": "201d743c-0f06-4af2-8f20-649baf4819ae",
|
||||
"plan_name": "stackit-qa-logme2-1.2.50-replica",
|
||||
"plan_name": "stackit-logme2-1.2.50-replica",
|
||||
"version": "2",
|
||||
"sgw_acl-1": "192.168.0.0/16",
|
||||
"sgw_acl-2": "192.168.0.0/24",
|
||||
|
|
@ -184,7 +184,9 @@ func testAccCheckLogMeDestroy(s *terraform.State) error {
|
|||
var client *logme.APIClient
|
||||
var err error
|
||||
if testutil.LogMeCustomEndpoint == "" {
|
||||
client, err = logme.NewAPIClient()
|
||||
client, err = logme.NewAPIClient(
|
||||
config.WithRegion("eu01"),
|
||||
)
|
||||
} else {
|
||||
client, err = logme.NewAPIClient(
|
||||
config.WithEndpoint(testutil.LogMeCustomEndpoint),
|
||||
|
|
|
|||
|
|
@ -120,9 +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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ 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"`
|
||||
|
|
@ -157,9 +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,
|
||||
},
|
||||
|
|
@ -360,7 +356,6 @@ func mapFields(credentialsResp *mariadb.CredentialsResponse, model *Model) error
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ 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(),
|
||||
|
|
@ -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"),
|
||||
Name: utils.Ptr("name"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
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"),
|
||||
Name: types.StringValue("name"),
|
||||
Password: types.StringValue("password"),
|
||||
Port: types.Int64Value(1234),
|
||||
Uri: types.StringValue("uri"),
|
||||
Username: types.StringValue("username"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -84,14 +81,13 @@ func TestMapFields(t *testing.T) {
|
|||
Id: utils.Ptr("cid"),
|
||||
Raw: &mariadb.RawCredentials{
|
||||
Credentials: &mariadb.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{},
|
||||
Name: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -102,7 +98,6 @@ 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),
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ var instanceResource = map[string]string{
|
|||
"project_id": testutil.ProjectId,
|
||||
"name": testutil.ResourceNameWithDateTime("mariadb"),
|
||||
"plan_id": "683be856-3587-42de-b1b5-a792ff854f52",
|
||||
"plan_name": "stackit-qa-mariadb-1.4.10-single",
|
||||
"plan_name": "stackit-mariadb-1.4.10-single",
|
||||
"version": "10.6",
|
||||
"sgw_acl-1": "192.168.0.0/16",
|
||||
"sgw_acl-2": "192.168.0.0/24",
|
||||
|
|
@ -183,7 +183,9 @@ func testAccCheckMariaDBDestroy(s *terraform.State) error {
|
|||
var client *mariadb.APIClient
|
||||
var err error
|
||||
if testutil.MariaDBCustomEndpoint == "" {
|
||||
client, err = mariadb.NewAPIClient()
|
||||
client, err = mariadb.NewAPIClient(
|
||||
config.WithRegion("eu01"),
|
||||
)
|
||||
} else {
|
||||
client, err = mariadb.NewAPIClient(
|
||||
config.WithEndpoint(testutil.MariaDBCustomEndpoint),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(""),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -123,7 +123,11 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
|
|||
"http_api_uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
"http_api_uris": schema.ListAttribute{
|
||||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"management": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
|
|
@ -136,6 +140,10 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
|
|||
"uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uris": schema.ListAttribute{
|
||||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"username": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,10 +37,12 @@ type Model struct {
|
|||
Host types.String `tfsdk:"host"`
|
||||
Hosts types.List `tfsdk:"hosts"`
|
||||
HttpAPIURI types.String `tfsdk:"http_api_uri"`
|
||||
Name types.String `tfsdk:"name"`
|
||||
HttpAPIURIs types.List `tfsdk:"http_api_uris"`
|
||||
Management types.String `tfsdk:"management"`
|
||||
Password types.String `tfsdk:"password"`
|
||||
Port types.Int64 `tfsdk:"port"`
|
||||
Uri types.String `tfsdk:"uri"`
|
||||
Uris types.List `tfsdk:"uris"`
|
||||
Username types.String `tfsdk:"username"`
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +162,11 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
|
|||
"http_api_uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
"http_api_uris": schema.ListAttribute{
|
||||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"management": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
|
|
@ -173,6 +179,10 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
|
|||
"uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"uris": schema.ListAttribute{
|
||||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"username": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
|
|
@ -347,6 +357,8 @@ func mapFields(credentialsResp *rabbitmq.CredentialsResponse, model *Model) erro
|
|||
)
|
||||
model.CredentialId = types.StringValue(credentialId)
|
||||
model.Hosts = types.ListNull(types.StringType)
|
||||
model.Uris = types.ListNull(types.StringType)
|
||||
model.HttpAPIURIs = types.ListNull(types.StringType)
|
||||
if credentials != nil {
|
||||
if credentials.Hosts != nil {
|
||||
var hosts []attr.Value
|
||||
|
|
@ -360,10 +372,32 @@ func mapFields(credentialsResp *rabbitmq.CredentialsResponse, model *Model) erro
|
|||
model.Hosts = hostsList
|
||||
}
|
||||
model.Host = types.StringPointerValue(credentials.Host)
|
||||
if credentials.HttpApiUris != nil {
|
||||
var httpApiUris []attr.Value
|
||||
for _, httpApiUri := range *credentials.HttpApiUris {
|
||||
httpApiUris = append(httpApiUris, types.StringValue(httpApiUri))
|
||||
}
|
||||
httpApiUrisList, diags := types.ListValue(types.StringType, httpApiUris)
|
||||
if diags.HasError() {
|
||||
return fmt.Errorf("failed to map httpApiUris: %w", core.DiagsToError(diags))
|
||||
}
|
||||
model.HttpAPIURIs = httpApiUrisList
|
||||
}
|
||||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.Management = types.StringPointerValue(credentials.Management)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
if credentials.Uris != nil {
|
||||
var uris []attr.Value
|
||||
for _, uri := range *credentials.Uris {
|
||||
uris = append(uris, types.StringValue(uri))
|
||||
}
|
||||
urisList, diags := types.ListValue(types.StringType, uris)
|
||||
if diags.HasError() {
|
||||
return fmt.Errorf("failed to map uris: %w", core.DiagsToError(diags))
|
||||
}
|
||||
model.Uris = urisList
|
||||
}
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
model.Username = types.StringPointerValue(credentials.Username)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@ func TestMapFields(t *testing.T) {
|
|||
Host: types.StringNull(),
|
||||
Hosts: types.ListNull(types.StringType),
|
||||
HttpAPIURI: types.StringNull(),
|
||||
Name: types.StringNull(),
|
||||
HttpAPIURIs: types.ListNull(types.StringType),
|
||||
Management: types.StringNull(),
|
||||
Password: types.StringNull(),
|
||||
Port: types.Int64Null(),
|
||||
Uri: types.StringNull(),
|
||||
Uris: types.ListNull(types.StringType),
|
||||
Username: types.StringNull(),
|
||||
},
|
||||
true,
|
||||
|
|
@ -51,11 +53,19 @@ func TestMapFields(t *testing.T) {
|
|||
"",
|
||||
},
|
||||
HttpApiUri: utils.Ptr("http"),
|
||||
Name: utils.Ptr("name"),
|
||||
HttpApiUris: &[]string{
|
||||
"http_api_uri_1",
|
||||
"",
|
||||
},
|
||||
Management: utils.Ptr("management"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
Uri: utils.Ptr("uri"),
|
||||
Username: utils.Ptr("username"),
|
||||
Uris: &[]string{
|
||||
"uri_1",
|
||||
"",
|
||||
},
|
||||
Username: utils.Ptr("username"),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -70,11 +80,19 @@ func TestMapFields(t *testing.T) {
|
|||
types.StringValue(""),
|
||||
}),
|
||||
HttpAPIURI: types.StringValue("http"),
|
||||
Name: types.StringValue("name"),
|
||||
HttpAPIURIs: types.ListValueMust(types.StringType, []attr.Value{
|
||||
types.StringValue("http_api_uri_1"),
|
||||
types.StringValue(""),
|
||||
}),
|
||||
Management: types.StringValue("management"),
|
||||
Password: types.StringValue("password"),
|
||||
Port: types.Int64Value(1234),
|
||||
Uri: types.StringValue("uri"),
|
||||
Username: types.StringValue("username"),
|
||||
Uris: types.ListValueMust(types.StringType, []attr.Value{
|
||||
types.StringValue("uri_1"),
|
||||
types.StringValue(""),
|
||||
}),
|
||||
Username: types.StringValue("username"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -84,14 +102,16 @@ func TestMapFields(t *testing.T) {
|
|||
Id: utils.Ptr("cid"),
|
||||
Raw: &rabbitmq.RawCredentials{
|
||||
Credentials: &rabbitmq.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{},
|
||||
HttpApiUri: nil,
|
||||
HttpApiUris: &[]string{},
|
||||
Management: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Uris: &[]string{},
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -103,10 +123,12 @@ func TestMapFields(t *testing.T) {
|
|||
Host: types.StringValue(""),
|
||||
Hosts: types.ListValueMust(types.StringType, []attr.Value{}),
|
||||
HttpAPIURI: types.StringNull(),
|
||||
Name: types.StringNull(),
|
||||
HttpAPIURIs: types.ListValueMust(types.StringType, []attr.Value{}),
|
||||
Management: types.StringNull(),
|
||||
Password: types.StringValue(""),
|
||||
Port: types.Int64Value(2123456789),
|
||||
Uri: types.StringNull(),
|
||||
Uris: types.ListValueMust(types.StringType, []attr.Value{}),
|
||||
Username: types.StringValue(""),
|
||||
},
|
||||
true,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var instanceResource = map[string]string{
|
|||
"project_id": testutil.ProjectId,
|
||||
"name": testutil.ResourceNameWithDateTime("rabbitmq"),
|
||||
"plan_id": "7e1f8394-5dd5-40b1-8608-16b4344eb51b",
|
||||
"plan_name": "stackit-qa-rabbitmq-2.4.10-single",
|
||||
"plan_name": "stackit-rabbitmq-2.4.10-single",
|
||||
"version": "3.10",
|
||||
"sgw_acl_invalid": "1.2.3.4/4",
|
||||
"sgw_acl_valid": "192.168.0.0/16",
|
||||
|
|
@ -166,6 +166,8 @@ func TestAccRabbitMQResource(t *testing.T) {
|
|||
resource.TestCheckResourceAttrSet("data.stackit_rabbitmq_credential.credential", "host"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_rabbitmq_credential.credential", "port"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_rabbitmq_credential.credential", "uri"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_rabbitmq_credential.credential", "management"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_rabbitmq_credential.credential", "http_api_uri"),
|
||||
),
|
||||
},
|
||||
// Import
|
||||
|
|
@ -229,7 +231,9 @@ func testAccCheckRabbitMQDestroy(s *terraform.State) error {
|
|||
var client *rabbitmq.APIClient
|
||||
var err error
|
||||
if testutil.RabbitMQCustomEndpoint == "" {
|
||||
client, err = rabbitmq.NewAPIClient()
|
||||
client, err = rabbitmq.NewAPIClient(
|
||||
config.WithRegion("eu01"),
|
||||
)
|
||||
} else {
|
||||
client, err = rabbitmq.NewAPIClient(
|
||||
config.WithEndpoint(testutil.RabbitMQCustomEndpoint),
|
||||
|
|
|
|||
|
|
@ -121,10 +121,7 @@ func (r *credentialDataSource) Schema(_ context.Context, _ datasource.SchemaRequ
|
|||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"http_api_uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
"load_balanced_host": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
|
|
|
|||
|
|
@ -30,18 +30,17 @@ var (
|
|||
)
|
||||
|
||||
type Model struct {
|
||||
Id types.String `tfsdk:"id"` // needed by TF
|
||||
CredentialId types.String `tfsdk:"credential_id"`
|
||||
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"`
|
||||
Username types.String `tfsdk:"username"`
|
||||
Id types.String `tfsdk:"id"` // needed by TF
|
||||
CredentialId types.String `tfsdk:"credential_id"`
|
||||
InstanceId types.String `tfsdk:"instance_id"`
|
||||
ProjectId types.String `tfsdk:"project_id"`
|
||||
Host types.String `tfsdk:"host"`
|
||||
Hosts types.List `tfsdk:"hosts"`
|
||||
LoadBalancedHost types.String `tfsdk:"load_balanced_host"`
|
||||
Password types.String `tfsdk:"password"`
|
||||
Port types.Int64 `tfsdk:"port"`
|
||||
Uri types.String `tfsdk:"uri"`
|
||||
Username types.String `tfsdk:"username"`
|
||||
}
|
||||
|
||||
// NewCredentialResource is a helper function to simplify the provider implementation.
|
||||
|
|
@ -158,10 +157,7 @@ func (r *credentialResource) Schema(_ context.Context, _ resource.SchemaRequest,
|
|||
ElementType: types.StringType,
|
||||
Computed: true,
|
||||
},
|
||||
"http_api_uri": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"name": schema.StringAttribute{
|
||||
"load_balanced_host": schema.StringAttribute{
|
||||
Computed: true,
|
||||
},
|
||||
"password": schema.StringAttribute{
|
||||
|
|
@ -362,8 +358,7 @@ func mapFields(credentialsResp *redis.CredentialsResponse, model *Model) error {
|
|||
model.Hosts = hostsList
|
||||
}
|
||||
model.Host = types.StringPointerValue(credentials.Host)
|
||||
model.HttpAPIURI = types.StringPointerValue(credentials.HttpApiUri)
|
||||
model.Name = types.StringPointerValue(credentials.Name)
|
||||
model.LoadBalancedHost = types.StringPointerValue(credentials.LoadBalancedHost)
|
||||
model.Password = types.StringPointerValue(credentials.Password)
|
||||
model.Port = types.Int64PointerValue(credentials.Port)
|
||||
model.Uri = types.StringPointerValue(credentials.Uri)
|
||||
|
|
|
|||
|
|
@ -24,18 +24,17 @@ func TestMapFields(t *testing.T) {
|
|||
Raw: &redis.RawCredentials{},
|
||||
},
|
||||
Model{
|
||||
Id: types.StringValue("pid,iid,cid"),
|
||||
CredentialId: types.StringValue("cid"),
|
||||
InstanceId: types.StringValue("iid"),
|
||||
ProjectId: types.StringValue("pid"),
|
||||
Host: types.StringNull(),
|
||||
Hosts: types.ListNull(types.StringType),
|
||||
HttpAPIURI: types.StringNull(),
|
||||
Name: types.StringNull(),
|
||||
Password: types.StringNull(),
|
||||
Port: types.Int64Null(),
|
||||
Uri: types.StringNull(),
|
||||
Username: types.StringNull(),
|
||||
Id: types.StringValue("pid,iid,cid"),
|
||||
CredentialId: types.StringValue("cid"),
|
||||
InstanceId: types.StringValue("iid"),
|
||||
ProjectId: types.StringValue("pid"),
|
||||
Host: types.StringNull(),
|
||||
Hosts: types.ListNull(types.StringType),
|
||||
LoadBalancedHost: types.StringNull(),
|
||||
Password: types.StringNull(),
|
||||
Port: types.Int64Null(),
|
||||
Uri: types.StringNull(),
|
||||
Username: types.StringNull(),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -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"),
|
||||
LoadBalancedHost: utils.Ptr("load_balanced_host"),
|
||||
Password: utils.Ptr("password"),
|
||||
Port: utils.Ptr(int64(1234)),
|
||||
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"),
|
||||
LoadBalancedHost: types.StringValue("load_balanced_host"),
|
||||
Password: types.StringValue("password"),
|
||||
Port: types.Int64Value(1234),
|
||||
Uri: types.StringValue("uri"),
|
||||
Username: types.StringValue("username"),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -84,30 +81,28 @@ func TestMapFields(t *testing.T) {
|
|||
Id: utils.Ptr("cid"),
|
||||
Raw: &redis.RawCredentials{
|
||||
Credentials: &redis.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{},
|
||||
LoadBalancedHost: nil,
|
||||
Password: utils.Ptr(""),
|
||||
Port: utils.Ptr(int64(2123456789)),
|
||||
Uri: nil,
|
||||
Username: utils.Ptr(""),
|
||||
},
|
||||
},
|
||||
},
|
||||
Model{
|
||||
Id: types.StringValue("pid,iid,cid"),
|
||||
CredentialId: types.StringValue("cid"),
|
||||
InstanceId: types.StringValue("iid"),
|
||||
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),
|
||||
Uri: types.StringNull(),
|
||||
Username: types.StringValue(""),
|
||||
Id: types.StringValue("pid,iid,cid"),
|
||||
CredentialId: types.StringValue("cid"),
|
||||
InstanceId: types.StringValue("iid"),
|
||||
ProjectId: types.StringValue("pid"),
|
||||
Host: types.StringValue(""),
|
||||
Hosts: types.ListValueMust(types.StringType, []attr.Value{}),
|
||||
LoadBalancedHost: types.StringNull(),
|
||||
Password: types.StringValue(""),
|
||||
Port: types.Int64Value(2123456789),
|
||||
Uri: types.StringNull(),
|
||||
Username: types.StringValue(""),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ var instanceResource = map[string]string{
|
|||
"project_id": testutil.ProjectId,
|
||||
"name": testutil.ResourceNameWithDateTime("redis"),
|
||||
"plan_id": "96e24604-7a43-4ff8-9ba4-609d4235a137",
|
||||
"plan_name": "stackit-qa-redis-1.4.10-single",
|
||||
"plan_name": "stackit-redis-1.4.10-single",
|
||||
"version": "6",
|
||||
"sgw_acl_invalid": "1.2.3.4/4",
|
||||
"sgw_acl_valid": "192.168.0.0/16",
|
||||
|
|
@ -166,6 +166,7 @@ func TestAccRedisResource(t *testing.T) {
|
|||
resource.TestCheckResourceAttrSet("data.stackit_redis_credential.credential", "host"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_redis_credential.credential", "port"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_redis_credential.credential", "uri"),
|
||||
resource.TestCheckResourceAttrSet("data.stackit_redis_credential.credential", "load_balanced_host"),
|
||||
),
|
||||
},
|
||||
// Import
|
||||
|
|
@ -244,7 +245,9 @@ func testAccCheckRedisDestroy(s *terraform.State) error {
|
|||
var client *redis.APIClient
|
||||
var err error
|
||||
if testutil.RedisCustomEndpoint == "" {
|
||||
client, err = redis.NewAPIClient()
|
||||
client, err = redis.NewAPIClient(
|
||||
config.WithRegion("eu01"),
|
||||
)
|
||||
} else {
|
||||
client, err = redis.NewAPIClient(
|
||||
config.WithEndpoint(testutil.RedisCustomEndpoint),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue