@@ -67,7 +67,7 @@ func TestAccNamespace_Basic(t *testing.T) {
6767 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "description" , "" ),
6868 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "name" , "test-cr-ns-01" ),
6969 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "environment_variables.test" , "test" ),
70- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
70+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
7171
7272 acctest .CheckResourceAttrUUID ("scaleway_container_namespace.main" , "id" ),
7373 ),
@@ -90,7 +90,7 @@ func TestAccNamespace_Basic(t *testing.T) {
9090 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "description" , "" ),
9191 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "name" , "test-cr-ns-01" ),
9292 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "environment_variables.test" , "test" ),
93- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
93+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
9494 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "tags.#" , "2" ),
9595 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "tags.0" , "tag1" ),
9696 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "tags.1" , "tag2" ),
@@ -127,7 +127,7 @@ func TestAccNamespace_Basic(t *testing.T) {
127127 isNamespacePresent (tt , "scaleway_container_namespace.main" ),
128128 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "name" , "tf-env-test" ),
129129 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "environment_variables.test" , "test" ),
130- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
130+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.test_secret" , "test_secret" ),
131131 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "tags.#" , "0" ),
132132 acctest .CheckResourceAttrUUID ("scaleway_container_namespace.main" , "id" ),
133133 ),
@@ -148,7 +148,7 @@ func TestAccNamespace_Basic(t *testing.T) {
148148 isNamespacePresent (tt , "scaleway_container_namespace.main" ),
149149 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "name" , "tf-env-test" ),
150150 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "environment_variables.foo" , "bar" ),
151- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.foo_secret" , "bar_secret" ),
151+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.foo_secret" , "bar_secret" ),
152152 resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "tags.#" , "0" ),
153153 acctest .CheckResourceAttrUUID ("scaleway_container_namespace.main" , "id" ),
154154 ),
@@ -189,24 +189,14 @@ func TestAccNamespace_SecretManagement(t *testing.T) {
189189 name = "test-secret-ns"
190190 secret_environment_variables = {
191191 "SECRET_1" = "value1"
192+ "SECRET_2" = "value2"
192193 }
193194 }
194195 ` ,
195196 Check : resource .ComposeTestCheckFunc (
196197 isNamespacePresent (tt , "scaleway_container_namespace.main" ),
197- resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
198- ),
199- },
200- {
201- Config : `
202- resource scaleway_container_namespace main {
203- name = "test-secret-ns"
204- secret_environment_variables = {}
205- }
206- ` ,
207- Check : resource .ComposeTestCheckFunc (
208- isNamespacePresent (tt , "scaleway_container_namespace.main" ),
209- resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" ),
198+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
199+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "value2" ),
210200 ),
211201 },
212202 {
@@ -215,44 +205,31 @@ func TestAccNamespace_SecretManagement(t *testing.T) {
215205 name = "test-secret-ns"
216206 secret_environment_variables = {
217207 "SECRET_1" = "value1"
218- "SECRET_2" = "value2 "
208+ "SECRET_2" = "updated_value2 "
219209 }
220210 }
221211 ` ,
222212 Check : resource .ComposeTestCheckFunc (
223213 isNamespacePresent (tt , "scaleway_container_namespace.main" ),
224- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
225- resource . TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "value2 " ),
214+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
215+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "updated_value2 " ),
226216 ),
227217 },
228218 {
229219 Config : `
230220 resource scaleway_container_namespace main {
231221 name = "test-secret-ns"
232222 secret_environment_variables = {
233- "SECRET_2" = "value2"
223+ "SECRET_KEY_1" = "value1"
224+ "SECRET_2" = "updated_value2"
234225 }
235226 }
236227 ` ,
237228 Check : resource .ComposeTestCheckFunc (
238229 isNamespacePresent (tt , "scaleway_container_namespace.main" ),
230+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_KEY_1" , "value1" ),
239231 resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" ),
240- resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "value2" ),
241- ),
242- },
243- {
244- Config : `
245- resource scaleway_container_namespace main {
246- name = "test-secret-ns"
247- secret_environment_variables = {
248- "SECRET_3" = "value3"
249- }
250- }
251- ` ,
252- Check : resource .ComposeTestCheckFunc (
253- isNamespacePresent (tt , "scaleway_container_namespace.main" ),
254- resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" ),
255- resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_3" , "value3" ),
232+ passwordMatchHash ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "updated_value2" ),
256233 ),
257234 },
258235 },
0 commit comments