@@ -20,6 +20,8 @@ var instanceResource = map[string]string{
2020 "project_id" : testutil .ProjectId ,
2121 "name" : testutil .ResourceNameWithDateTime ("postgresql" ),
2222 "plan_id" : "57d40175-0f4c-4bcc-b52d-cf5d2ee9f5a7" ,
23+ "plan_name" : "stackit-qa-postgresql-1.4.10-single" ,
24+ "version" : "13" ,
2325 "sgw_acl" : "192.168.0.0/16" ,
2426 "metrics_frequency" : "34" ,
2527 "plugins" : "foo-bar" ,
@@ -31,8 +33,9 @@ func resourceConfig(acls, frequency, plugins string) string {
3133
3234 resource "stackit_postgresql_instance" "instance" {
3335 project_id = "%s"
34- name = "%s"
35- plan_id = "%s"
36+ name = "%s"
37+ plan_name = "%s"
38+ version = "%s"
3639 parameters = {
3740 sgw_acl = "%s"
3841 plugins = ["%s"]
@@ -51,7 +54,8 @@ func resourceConfig(acls, frequency, plugins string) string {
5154 testutil .PostgreSQLProviderConfig (),
5255 instanceResource ["project_id" ],
5356 instanceResource ["name" ],
54- instanceResource ["plan_id" ],
57+ instanceResource ["plan_name" ],
58+ instanceResource ["version" ],
5559 acls ,
5660 plugins ,
5761 frequency ,
@@ -71,6 +75,8 @@ func TestAccPostgreSQLResource(t *testing.T) {
7175 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "project_id" , instanceResource ["project_id" ]),
7276 resource .TestCheckResourceAttrSet ("stackit_postgresql_instance.instance" , "instance_id" ),
7377 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "plan_id" , instanceResource ["plan_id" ]),
78+ resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "plan_name" , instanceResource ["plan_name" ]),
79+ resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "version" , instanceResource ["version" ]),
7480 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "name" , instanceResource ["name" ]),
7581 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "parameters.sgw_acl" , instanceResource ["sgw_acl" ]),
7682
@@ -106,15 +112,11 @@ func TestAccPostgreSQLResource(t *testing.T) {
106112 Check : resource .ComposeAggregateTestCheckFunc (
107113 // Instance data
108114 resource .TestCheckResourceAttr ("data.stackit_postgresql_instance.instance" , "project_id" , instanceResource ["project_id" ]),
109-
110115 resource .TestCheckResourceAttrPair ("stackit_postgresql_instance.instance" , "instance_id" ,
111116 "data.stackit_postgresql_instance.instance" , "instance_id" ),
112-
113117 resource .TestCheckResourceAttrPair ("stackit_postgresql_credentials.credentials" , "credentials_id" ,
114118 "data.stackit_postgresql_credentials.credentials" , "credentials_id" ),
115-
116119 resource .TestCheckResourceAttr ("data.stackit_postgresql_instance.instance" , "plan_id" , instanceResource ["plan_id" ]),
117-
118120 resource .TestCheckResourceAttr ("data.stackit_postgresql_instance.instance" , "name" , instanceResource ["name" ]),
119121 resource .TestCheckResourceAttr ("data.stackit_postgresql_instance.instance" , "parameters.sgw_acl" , instanceResource ["sgw_acl" ]),
120122 resource .TestCheckResourceAttr ("data.stackit_postgresql_instance.instance" , "parameters.plugins.#" , "1" ),
@@ -140,11 +142,11 @@ func TestAccPostgreSQLResource(t *testing.T) {
140142 if ! ok {
141143 return "" , fmt .Errorf ("couldn't find attribute instance_id" )
142144 }
143-
144145 return fmt .Sprintf ("%s,%s" , testutil .ProjectId , instanceId ), nil
145146 },
146- ImportState : true ,
147- ImportStateVerify : true ,
147+ ImportState : true ,
148+ ImportStateVerify : true ,
149+ ImportStateVerifyIgnore : []string {"plan_name" , "version" },
148150 },
149151 {
150152 ResourceName : "stackit_postgresql_credentials.credentials" ,
@@ -161,7 +163,6 @@ func TestAccPostgreSQLResource(t *testing.T) {
161163 if ! ok {
162164 return "" , fmt .Errorf ("couldn't find attribute credentials_id" )
163165 }
164-
165166 return fmt .Sprintf ("%s,%s,%s" , testutil .ProjectId , instanceId , credentialsId ), nil
166167 },
167168 ImportState : true ,
@@ -175,6 +176,8 @@ func TestAccPostgreSQLResource(t *testing.T) {
175176 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "project_id" , instanceResource ["project_id" ]),
176177 resource .TestCheckResourceAttrSet ("stackit_postgresql_instance.instance" , "instance_id" ),
177178 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "plan_id" , instanceResource ["plan_id" ]),
179+ resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "plan_name" , instanceResource ["plan_name" ]),
180+ resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "version" , instanceResource ["version" ]),
178181 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "name" , instanceResource ["name" ]),
179182 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "parameters.sgw_acl" , instanceResource ["sgw_acl" ]),
180183 resource .TestCheckResourceAttr ("stackit_postgresql_instance.instance" , "parameters.plugins.0" , fmt .Sprintf ("%s-baz" , instanceResource ["plugins" ])),
0 commit comments