@@ -113,6 +113,82 @@ func TestAccScalewaySecret_Basic(t *testing.T) {
113113 })
114114}
115115
116+ func TestAccScalewaySecret_Path (t * testing.T ) {
117+ tt := NewTestTools (t )
118+ defer tt .Cleanup ()
119+
120+ resource .ParallelTest (t , resource.TestCase {
121+ PreCheck : func () { testAccPreCheck (t ) },
122+ ProviderFactories : tt .ProviderFactories ,
123+ CheckDestroy : testAccCheckScalewaySecretDestroy (tt ),
124+ Steps : []resource.TestStep {
125+ {
126+ Config : `
127+ resource "scaleway_secret" "main" {
128+ name = "test-secret-path-secret"
129+ }
130+ ` ,
131+ Check : resource .ComposeTestCheckFunc (
132+ testAccCheckScalewaySecretExists (tt , "scaleway_secret.main" ),
133+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "name" , "test-secret-path-secret" ),
134+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "path" , "/" ),
135+ testCheckResourceAttrUUID ("scaleway_secret.main" , "id" ),
136+ ),
137+ },
138+ {
139+ Config : `
140+ resource "scaleway_secret" "main" {
141+ name = "test-secret-path-secret"
142+ path = "/test-secret-path"
143+ }
144+ ` ,
145+ Check : resource .ComposeTestCheckFunc (
146+ testAccCheckScalewaySecretExists (tt , "scaleway_secret.main" ),
147+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "name" , "test-secret-path-secret" ),
148+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "path" , "/test-secret-path" ),
149+ testCheckResourceAttrUUID ("scaleway_secret.main" , "id" ),
150+ ),
151+ },
152+ {
153+ Config : `
154+ resource "scaleway_secret" "main" {
155+ name = "test-secret-path-secret"
156+ path = "/test-secret-path/"
157+ }
158+ ` ,
159+ PlanOnly : true ,
160+ },
161+ {
162+ Config : `
163+ resource "scaleway_secret" "main" {
164+ name = "test-secret-path-secret"
165+ path = "/test-secret-path-change/"
166+ }
167+ ` ,
168+ Check : resource .ComposeTestCheckFunc (
169+ testAccCheckScalewaySecretExists (tt , "scaleway_secret.main" ),
170+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "name" , "test-secret-path-secret" ),
171+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "path" , "/test-secret-path-change" ),
172+ testCheckResourceAttrUUID ("scaleway_secret.main" , "id" ),
173+ ),
174+ },
175+ {
176+ Config : `
177+ resource "scaleway_secret" "main" {
178+ name = "test-secret-path-secret"
179+ }
180+ ` ,
181+ Check : resource .ComposeTestCheckFunc (
182+ testAccCheckScalewaySecretExists (tt , "scaleway_secret.main" ),
183+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "name" , "test-secret-path-secret" ),
184+ resource .TestCheckResourceAttr ("scaleway_secret.main" , "path" , "/" ),
185+ testCheckResourceAttrUUID ("scaleway_secret.main" , "id" ),
186+ ),
187+ },
188+ },
189+ })
190+ }
191+
116192func testAccCheckScalewaySecretExists (tt * TestTools , n string ) resource.TestCheckFunc {
117193 return func (state * terraform.State ) error {
118194 rs , ok := state .RootModule ().Resources [n ]
0 commit comments