@@ -172,6 +172,91 @@ func TestAccNamespace_Basic(t *testing.T) {
172
172
})
173
173
}
174
174
175
+ func TestAccNamespace_SecretManagement (t * testing.T ) {
176
+ tt := acctest .NewTestTools (t )
177
+ defer tt .Cleanup ()
178
+
179
+ resource .ParallelTest (t , resource.TestCase {
180
+ PreCheck : func () { acctest .PreCheck (t ) },
181
+ ProviderFactories : tt .ProviderFactories ,
182
+ CheckDestroy : isNamespaceDestroyed (tt ),
183
+ Steps : []resource.TestStep {
184
+ {
185
+ Config : `
186
+ resource scaleway_container_namespace main {
187
+ name = "test-secret-ns"
188
+ secret_environment_variables = {
189
+ "SECRET_1" = "value1"
190
+ }
191
+ }
192
+ ` ,
193
+ Check : resource .ComposeTestCheckFunc (
194
+ isNamespacePresent (tt , "scaleway_container_namespace.main" ),
195
+ resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
196
+ ),
197
+ },
198
+ {
199
+ Config : `
200
+ resource scaleway_container_namespace main {
201
+ name = "test-secret-ns"
202
+ secret_environment_variables = {}
203
+ }
204
+ ` ,
205
+ Check : resource .ComposeTestCheckFunc (
206
+ isNamespacePresent (tt , "scaleway_container_namespace.main" ),
207
+ resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" ),
208
+ ),
209
+ },
210
+ {
211
+ Config : `
212
+ resource scaleway_container_namespace main {
213
+ name = "test-secret-ns"
214
+ secret_environment_variables = {
215
+ "SECRET_1" = "value1"
216
+ "SECRET_2" = "value2"
217
+ }
218
+ }
219
+ ` ,
220
+ Check : resource .ComposeTestCheckFunc (
221
+ isNamespacePresent (tt , "scaleway_container_namespace.main" ),
222
+ resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" , "value1" ),
223
+ resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "value2" ),
224
+ ),
225
+ },
226
+ {
227
+ Config : `
228
+ resource scaleway_container_namespace main {
229
+ name = "test-secret-ns"
230
+ secret_environment_variables = {
231
+ "SECRET_2" = "value2"
232
+ }
233
+ }
234
+ ` ,
235
+ Check : resource .ComposeTestCheckFunc (
236
+ isNamespacePresent (tt , "scaleway_container_namespace.main" ),
237
+ resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_1" ),
238
+ resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" , "value2" ),
239
+ ),
240
+ },
241
+ {
242
+ Config : `
243
+ resource scaleway_container_namespace main {
244
+ name = "test-secret-ns"
245
+ secret_environment_variables = {
246
+ "SECRET_3" = "value3"
247
+ }
248
+ }
249
+ ` ,
250
+ Check : resource .ComposeTestCheckFunc (
251
+ isNamespacePresent (tt , "scaleway_container_namespace.main" ),
252
+ resource .TestCheckNoResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_2" ),
253
+ resource .TestCheckResourceAttr ("scaleway_container_namespace.main" , "secret_environment_variables.SECRET_3" , "value3" ),
254
+ ),
255
+ },
256
+ },
257
+ })
258
+ }
259
+
175
260
func TestAccNamespace_DestroyRegistry (t * testing.T ) {
176
261
tt := acctest .NewTestTools (t )
177
262
defer tt .Cleanup ()
0 commit comments