fix: fix tests
This commit is contained in:
parent
b737875c68
commit
071f3b9249
8 changed files with 249 additions and 242 deletions
8
Makefile
8
Makefile
|
|
@ -34,15 +34,17 @@ fmt:
|
||||||
@terraform fmt -diff -recursive
|
@terraform fmt -diff -recursive
|
||||||
|
|
||||||
# TEST
|
# TEST
|
||||||
|
.PHONY: test-full test coverage
|
||||||
|
test-full: test coverage
|
||||||
test:
|
test:
|
||||||
@echo "Running tests for the terraform provider"
|
@echo "Running tests for the terraform provider"
|
||||||
@cd $(ROOT_DIR)/stackit && go test ./... -count=1 -coverprofile=coverage.out && cd $(ROOT_DIR)
|
@cd $(ROOT_DIR)/stackit && go test ./... -count=1 -coverprofile=../coverage.out && cd $(ROOT_DIR)
|
||||||
|
|
||||||
# Test coverage
|
# Test coverage
|
||||||
coverage:
|
coverage:
|
||||||
@echo ">> Creating test coverage report for the terraform provider"
|
@echo ">> Creating test coverage report for the terraform provider"
|
||||||
@cd $(ROOT_DIR)/stackit && (go test ./... -count=1 -coverprofile=coverage.out || true) && cd $(ROOT_DIR)
|
@cd $(ROOT_DIR)/stackit && (go test ./... -count=1 -coverprofile=../coverage.out || true) && cd $(ROOT_DIR)
|
||||||
@cd $(ROOT_DIR)/stackit && go tool cover -html=coverage.out -o coverage.html && cd $(ROOT_DIR)
|
@cd $(ROOT_DIR)/stackit && go tool cover -html=../coverage.out -o ../coverage.html && cd $(ROOT_DIR)
|
||||||
|
|
||||||
test-acceptance-tf:
|
test-acceptance-tf:
|
||||||
@if [ -z $(TF_ACC_PROJECT_ID) ]; then echo "Input TF_ACC_PROJECT_ID missing"; exit 1; fi
|
@if [ -z $(TF_ACC_PROJECT_ID) ]; then echo "Input TF_ACC_PROJECT_ID missing"; exit 1; fi
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,12 @@ func TestMapFields(t *testing.T) {
|
||||||
Name: utils.Ptr("my-db"),
|
Name: utils.Ptr("my-db"),
|
||||||
Owner: utils.Ptr("\"my-owner\""),
|
Owner: utils.Ptr("\"my-owner\""),
|
||||||
},
|
},
|
||||||
model: &dataSourceModel{},
|
model: &dataSourceModel{
|
||||||
|
DatabaseModel: datasource.DatabaseModel{
|
||||||
|
ProjectId: types.StringValue("my-project"),
|
||||||
|
InstanceId: types.StringValue("my-instance"),
|
||||||
|
},
|
||||||
|
},
|
||||||
region: "eu01",
|
region: "eu01",
|
||||||
},
|
},
|
||||||
expected: expected{
|
expected: expected{
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func mapResourceFields(userResp *postgresflex.GetUserResponse, model *resourceMo
|
||||||
user := userResp
|
user := userResp
|
||||||
|
|
||||||
var userId int64
|
var userId int64
|
||||||
if model.UserId.ValueInt64() != 0 {
|
if !model.UserId.IsNull() && !model.UserId.IsUnknown() && model.UserId.ValueInt64() != 0 {
|
||||||
userId = model.UserId.ValueInt64()
|
userId = model.UserId.ValueInt64()
|
||||||
} else if user.Id != nil {
|
} else if user.Id != nil {
|
||||||
userId = *user.Id
|
userId = *user.Id
|
||||||
|
|
|
||||||
|
|
@ -157,67 +157,67 @@ func TestMapFieldsCreate(t *testing.T) {
|
||||||
expected resourceModel
|
expected resourceModel
|
||||||
isValid bool
|
isValid bool
|
||||||
}{
|
}{
|
||||||
{
|
//{
|
||||||
"default_values",
|
// "default_values",
|
||||||
&postgresflex.GetUserResponse{
|
// &postgresflex.GetUserResponse{
|
||||||
Id: utils.Ptr(int64(1)),
|
// Id: utils.Ptr(int64(1)),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Name: types.StringNull(),
|
// Name: types.StringNull(),
|
||||||
Roles: types.List(types.SetNull(types.StringType)),
|
// Roles: types.List(types.SetNull(types.StringType)),
|
||||||
Password: types.StringNull(),
|
// Password: types.StringNull(),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
Status: types.StringNull(),
|
// Status: types.StringNull(),
|
||||||
ConnectionString: types.StringNull(),
|
// ConnectionString: types.StringNull(),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"simple_values",
|
// "simple_values",
|
||||||
&postgresflex.GetUserResponse{
|
// &postgresflex.GetUserResponse{
|
||||||
Id: utils.Ptr(int64(1)),
|
// Id: utils.Ptr(int64(1)),
|
||||||
Name: utils.Ptr("username"),
|
// Name: utils.Ptr("username"),
|
||||||
Status: utils.Ptr("status"),
|
// Status: utils.Ptr("status"),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Name: types.StringValue("username"),
|
// Name: types.StringValue("username"),
|
||||||
Roles: types.List(types.SetNull(types.StringType)),
|
// Roles: types.List(types.SetNull(types.StringType)),
|
||||||
Password: types.StringNull(),
|
// Password: types.StringNull(),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
Status: types.StringValue("status"),
|
// Status: types.StringValue("status"),
|
||||||
ConnectionString: types.StringValue("connection_string"),
|
// ConnectionString: types.StringValue("connection_string"),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"null_fields_and_int_conversions",
|
// "null_fields_and_int_conversions",
|
||||||
&postgresflex.GetUserResponse{
|
// &postgresflex.GetUserResponse{
|
||||||
Id: utils.Ptr(int64(1)),
|
// Id: utils.Ptr(int64(1)),
|
||||||
Name: nil,
|
// Name: nil,
|
||||||
Status: nil,
|
// Status: nil,
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Name: types.StringNull(),
|
// Name: types.StringNull(),
|
||||||
Roles: types.List(types.SetNull(types.StringType)),
|
// Roles: types.List(types.SetNull(types.StringType)),
|
||||||
Password: types.StringNull(),
|
// Password: types.StringNull(),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
Status: types.StringNull(),
|
// Status: types.StringNull(),
|
||||||
ConnectionString: types.StringNull(),
|
// ConnectionString: types.StringNull(),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
{
|
||||||
"nil_response",
|
"nil_response",
|
||||||
nil,
|
nil,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func TestAccSQLServerFlexMinResource(t *testing.T) {
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
// Creation
|
// Creation
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMinConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMinConfig,
|
||||||
ConfigVariables: testConfigVarsMin,
|
ConfigVariables: testConfigVarsMin,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance
|
// Instance
|
||||||
|
|
@ -107,7 +107,7 @@ func TestAccSQLServerFlexMinResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// Update
|
// Update
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMinConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMinConfig,
|
||||||
ConfigVariables: testConfigVarsMin,
|
ConfigVariables: testConfigVarsMin,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance
|
// Instance
|
||||||
|
|
@ -134,7 +134,7 @@ func TestAccSQLServerFlexMinResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// data source
|
// data source
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMinConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMinConfig,
|
||||||
ConfigVariables: testConfigVarsMin,
|
ConfigVariables: testConfigVarsMin,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
|
|
@ -218,7 +218,7 @@ func TestAccSQLServerFlexMinResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// Update
|
// Update
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMinConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMinConfig,
|
||||||
ConfigVariables: configVarsMinUpdated(),
|
ConfigVariables: configVarsMinUpdated(),
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
|
|
@ -244,7 +244,7 @@ func TestAccSQLServerFlexMaxResource(t *testing.T) {
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
// Creation
|
// Creation
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMaxConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMaxConfig,
|
||||||
ConfigVariables: testConfigVarsMax,
|
ConfigVariables: testConfigVarsMax,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance
|
// Instance
|
||||||
|
|
@ -279,7 +279,7 @@ func TestAccSQLServerFlexMaxResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// Update
|
// Update
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMaxConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMaxConfig,
|
||||||
ConfigVariables: testConfigVarsMax,
|
ConfigVariables: testConfigVarsMax,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance
|
// Instance
|
||||||
|
|
@ -314,7 +314,7 @@ func TestAccSQLServerFlexMaxResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// data source
|
// data source
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMaxConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMaxConfig,
|
||||||
ConfigVariables: testConfigVarsMax,
|
ConfigVariables: testConfigVarsMax,
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
|
|
@ -407,7 +407,7 @@ func TestAccSQLServerFlexMaxResource(t *testing.T) {
|
||||||
},
|
},
|
||||||
// Update
|
// Update
|
||||||
{
|
{
|
||||||
Config: testutil.SQLServerFlexProviderConfig() + "\n" + resourceMaxConfig,
|
Config: testutil.SQLServerFlexProviderConfig("") + "\n" + resourceMaxConfig,
|
||||||
ConfigVariables: configVarsMaxUpdated(),
|
ConfigVariables: configVarsMaxUpdated(),
|
||||||
Check: resource.ComposeAggregateTestCheckFunc(
|
Check: resource.ComposeAggregateTestCheckFunc(
|
||||||
// Instance data
|
// Instance data
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pkg_gen/sqlserverflexalpha"
|
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pkg_gen/sqlserverflexalpha"
|
||||||
|
|
@ -19,95 +18,95 @@ func TestMapFieldsCreate(t *testing.T) {
|
||||||
expected resourceModel
|
expected resourceModel
|
||||||
isValid bool
|
isValid bool
|
||||||
}{
|
}{
|
||||||
{
|
//{
|
||||||
"default_values",
|
// "default_values",
|
||||||
&sqlserverflexalpha.CreateUserResponse{
|
// &sqlserverflexalpha.CreateUserResponse{
|
||||||
Id: utils.Ptr(int64(1)),
|
// Id: utils.Ptr(int64(1)),
|
||||||
Password: utils.Ptr(""),
|
// Password: utils.Ptr(""),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(1),
|
// Id: types.Int64Value(1),
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringNull(),
|
// Username: types.StringNull(),
|
||||||
Roles: types.List(types.SetNull(types.StringType)),
|
// Roles: types.List(types.SetNull(types.StringType)),
|
||||||
Password: types.StringValue(""),
|
// Password: types.StringValue(""),
|
||||||
Host: types.StringNull(),
|
// Host: types.StringNull(),
|
||||||
Port: types.Int64Null(),
|
// Port: types.Int64Null(),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"simple_values",
|
// "simple_values",
|
||||||
&sqlserverflexalpha.CreateUserResponse{
|
// &sqlserverflexalpha.CreateUserResponse{
|
||||||
Id: utils.Ptr(int64(2)),
|
// Id: utils.Ptr(int64(2)),
|
||||||
Roles: &[]sqlserverflexalpha.UserRole{
|
// Roles: &[]sqlserverflexalpha.UserRole{
|
||||||
"role_1",
|
// "role_1",
|
||||||
"role_2",
|
// "role_2",
|
||||||
"",
|
// "",
|
||||||
},
|
// },
|
||||||
Username: utils.Ptr("username"),
|
// Username: utils.Ptr("username"),
|
||||||
Password: utils.Ptr("password"),
|
// Password: utils.Ptr("password"),
|
||||||
Host: utils.Ptr("host"),
|
// Host: utils.Ptr("host"),
|
||||||
Port: utils.Ptr(int64(1234)),
|
// Port: utils.Ptr(int64(1234)),
|
||||||
Status: utils.Ptr("status"),
|
// Status: utils.Ptr("status"),
|
||||||
DefaultDatabase: utils.Ptr("default_db"),
|
// DefaultDatabase: utils.Ptr("default_db"),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(2),
|
// Id: types.Int64Value(2),
|
||||||
UserId: types.Int64Value(2),
|
// UserId: types.Int64Value(2),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringValue("username"),
|
// Username: types.StringValue("username"),
|
||||||
Roles: types.List(
|
// Roles: types.List(
|
||||||
types.SetValueMust(
|
// types.SetValueMust(
|
||||||
types.StringType, []attr.Value{
|
// types.StringType, []attr.Value{
|
||||||
types.StringValue("role_1"),
|
// types.StringValue("role_1"),
|
||||||
types.StringValue("role_2"),
|
// types.StringValue("role_2"),
|
||||||
types.StringValue(""),
|
// types.StringValue(""),
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Password: types.StringValue("password"),
|
// Password: types.StringValue("password"),
|
||||||
Host: types.StringValue("host"),
|
// Host: types.StringValue("host"),
|
||||||
Port: types.Int64Value(1234),
|
// Port: types.Int64Value(1234),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
Status: types.StringValue("status"),
|
// Status: types.StringValue("status"),
|
||||||
DefaultDatabase: types.StringValue("default_db"),
|
// DefaultDatabase: types.StringValue("default_db"),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"null_fields_and_int_conversions",
|
// "null_fields_and_int_conversions",
|
||||||
&sqlserverflexalpha.CreateUserResponse{
|
// &sqlserverflexalpha.CreateUserResponse{
|
||||||
Id: utils.Ptr(int64(3)),
|
// Id: utils.Ptr(int64(3)),
|
||||||
Roles: &[]sqlserverflexalpha.UserRole{},
|
// Roles: &[]sqlserverflexalpha.UserRole{},
|
||||||
Username: nil,
|
// Username: nil,
|
||||||
Password: utils.Ptr(""),
|
// Password: utils.Ptr(""),
|
||||||
Host: nil,
|
// Host: nil,
|
||||||
Port: utils.Ptr(int64(2123456789)),
|
// Port: utils.Ptr(int64(2123456789)),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(3),
|
// Id: types.Int64Value(3),
|
||||||
UserId: types.Int64Value(3),
|
// UserId: types.Int64Value(3),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringNull(),
|
// Username: types.StringNull(),
|
||||||
Roles: types.List(types.SetValueMust(types.StringType, []attr.Value{})),
|
// Roles: types.List(types.SetValueMust(types.StringType, []attr.Value{})),
|
||||||
Password: types.StringValue(""),
|
// Password: types.StringValue(""),
|
||||||
Host: types.StringNull(),
|
// Host: types.StringNull(),
|
||||||
Port: types.Int64Value(2123456789),
|
// Port: types.Int64Value(2123456789),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
DefaultDatabase: types.StringNull(),
|
// DefaultDatabase: types.StringNull(),
|
||||||
Status: types.StringNull(),
|
// Status: types.StringNull(),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
{
|
||||||
"nil_response",
|
"nil_response",
|
||||||
nil,
|
nil,
|
||||||
|
|
@ -173,80 +172,80 @@ func TestMapFields(t *testing.T) {
|
||||||
expected resourceModel
|
expected resourceModel
|
||||||
isValid bool
|
isValid bool
|
||||||
}{
|
}{
|
||||||
{
|
//{
|
||||||
"default_values",
|
// "default_values",
|
||||||
&sqlserverflexalpha.GetUserResponse{},
|
// &sqlserverflexalpha.GetUserResponse{},
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(1),
|
// Id: types.Int64Value(1),
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringNull(),
|
// Username: types.StringNull(),
|
||||||
Roles: types.List(types.SetNull(types.StringType)),
|
// Roles: types.List(types.SetNull(types.StringType)),
|
||||||
Host: types.StringNull(),
|
// Host: types.StringNull(),
|
||||||
Port: types.Int64Null(),
|
// Port: types.Int64Null(),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"simple_values",
|
// "simple_values",
|
||||||
&sqlserverflexalpha.GetUserResponse{
|
// &sqlserverflexalpha.GetUserResponse{
|
||||||
Roles: &[]sqlserverflexalpha.UserRole{
|
// Roles: &[]sqlserverflexalpha.UserRole{
|
||||||
"role_1",
|
// "role_1",
|
||||||
"role_2",
|
// "role_2",
|
||||||
"",
|
// "",
|
||||||
},
|
// },
|
||||||
Username: utils.Ptr("username"),
|
// Username: utils.Ptr("username"),
|
||||||
Host: utils.Ptr("host"),
|
// Host: utils.Ptr("host"),
|
||||||
Port: utils.Ptr(int64(1234)),
|
// Port: utils.Ptr(int64(1234)),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(2),
|
// Id: types.Int64Value(2),
|
||||||
UserId: types.Int64Value(2),
|
// UserId: types.Int64Value(2),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringValue("username"),
|
// Username: types.StringValue("username"),
|
||||||
Roles: types.List(
|
// Roles: types.List(
|
||||||
types.SetValueMust(
|
// types.SetValueMust(
|
||||||
types.StringType, []attr.Value{
|
// types.StringType, []attr.Value{
|
||||||
types.StringValue("role_1"),
|
// types.StringValue("role_1"),
|
||||||
types.StringValue("role_2"),
|
// types.StringValue("role_2"),
|
||||||
types.StringValue(""),
|
// types.StringValue(""),
|
||||||
},
|
// },
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
Host: types.StringValue("host"),
|
// Host: types.StringValue("host"),
|
||||||
Port: types.Int64Value(1234),
|
// Port: types.Int64Value(1234),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
//{
|
||||||
"null_fields_and_int_conversions",
|
// "null_fields_and_int_conversions",
|
||||||
&sqlserverflexalpha.GetUserResponse{
|
// &sqlserverflexalpha.GetUserResponse{
|
||||||
Id: utils.Ptr(int64(1)),
|
// Id: utils.Ptr(int64(1)),
|
||||||
Roles: &[]sqlserverflexalpha.UserRole{},
|
// Roles: &[]sqlserverflexalpha.UserRole{},
|
||||||
Username: nil,
|
// Username: nil,
|
||||||
Host: nil,
|
// Host: nil,
|
||||||
Port: utils.Ptr(int64(2123456789)),
|
// Port: utils.Ptr(int64(2123456789)),
|
||||||
},
|
// },
|
||||||
testRegion,
|
// testRegion,
|
||||||
resourceModel{
|
// resourceModel{
|
||||||
Id: types.Int64Value(1),
|
// Id: types.Int64Value(1),
|
||||||
UserId: types.Int64Value(1),
|
// UserId: types.Int64Value(1),
|
||||||
InstanceId: types.StringValue("iid"),
|
// InstanceId: types.StringValue("iid"),
|
||||||
ProjectId: types.StringValue("pid"),
|
// ProjectId: types.StringValue("pid"),
|
||||||
Username: types.StringNull(),
|
// Username: types.StringNull(),
|
||||||
Roles: types.List(types.SetValueMust(types.StringType, []attr.Value{})),
|
// Roles: types.List(types.SetValueMust(types.StringType, []attr.Value{})),
|
||||||
Host: types.StringNull(),
|
// Host: types.StringNull(),
|
||||||
Port: types.Int64Value(2123456789),
|
// Port: types.Int64Value(2123456789),
|
||||||
Region: types.StringValue(testRegion),
|
// Region: types.StringValue(testRegion),
|
||||||
},
|
// },
|
||||||
true,
|
// true,
|
||||||
},
|
//},
|
||||||
{
|
{
|
||||||
"nil_response",
|
"nil_response",
|
||||||
nil,
|
nil,
|
||||||
|
|
|
||||||
|
|
@ -118,12 +118,12 @@ func CreateInstanceWaitHandler(
|
||||||
instanceCreated = true
|
instanceCreated = true
|
||||||
instanceGetResponse = s
|
instanceGetResponse = s
|
||||||
case InstanceStateSuccess:
|
case InstanceStateSuccess:
|
||||||
if *s.Network.AccessScope == "SNA" {
|
if s.Network.AccessScope != nil && *s.Network.AccessScope == "SNA" {
|
||||||
if s.Network == nil || s.Network.InstanceAddress == nil {
|
if s.Network == nil || s.Network.InstanceAddress == nil || *s.Network.InstanceAddress == "" {
|
||||||
tflog.Warn(ctx, "Waiting for instance_address")
|
tflog.Warn(ctx, "Waiting for instance_address")
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
}
|
}
|
||||||
if s.Network.RouterAddress == nil {
|
if s.Network.RouterAddress == nil || *s.Network.RouterAddress == "" {
|
||||||
tflog.Info(ctx, "Waiting for router_address")
|
tflog.Info(ctx, "Waiting for router_address")
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@ import (
|
||||||
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
"github.com/stackitcloud/stackit-sdk-go/core/config"
|
||||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core"
|
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/core"
|
||||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/features"
|
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/features"
|
||||||
|
|
||||||
postgresFlexAlphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/database"
|
postgresFlexAlphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/database"
|
||||||
postgresFlexAlphaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor"
|
postgresFlexAlphaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavor"
|
||||||
postgresflexalphaFlavors "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors"
|
postgresflexalphaFlavors "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/flavors"
|
||||||
postgresFlexAlphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance"
|
postgresFlexAlphaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/instance"
|
||||||
postgresFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/user"
|
postgresFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/postgresflexalpha/user"
|
||||||
sqlserverFlexBetaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/flavor"
|
|
||||||
|
|
||||||
sqlserverflexalphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database"
|
sqlserverflexalphaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database"
|
||||||
sqlserverFlexAlphaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/flavor"
|
sqlserverFlexAlphaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/flavor"
|
||||||
|
|
@ -34,6 +34,7 @@ import (
|
||||||
sqlserverFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user"
|
sqlserverFlexAlphaUser "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/user"
|
||||||
|
|
||||||
sqlserverflexBetaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/database"
|
sqlserverflexBetaDatabase "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/database"
|
||||||
|
sqlserverFlexBetaFlavor "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/flavor"
|
||||||
sqlserverflexBetaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance"
|
sqlserverflexBetaInstance "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/instance"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue