@@ -167,6 +167,77 @@ func TestAccScalewayRedisCluster_Migrate(t *testing.T) {
167
167
})
168
168
}
169
169
170
+ func TestAccScalewayRedisCluster_ACL (t * testing.T ) {
171
+ tt := NewTestTools (t )
172
+ defer tt .Cleanup ()
173
+ resource .ParallelTest (t , resource.TestCase {
174
+ PreCheck : func () { testAccPreCheck (t ) },
175
+ ProviderFactories : tt .ProviderFactories ,
176
+ CheckDestroy : testAccCheckScalewayRedisClusterDestroy (tt ),
177
+ Steps : []resource.TestStep {
178
+ {
179
+ Config : `
180
+ resource "scaleway_redis_cluster" "main" {
181
+ name = "test_redis_acl"
182
+ version = "6.2.6"
183
+ node_type = "MDB-BETA-M"
184
+ user_name = "my_initial_user"
185
+ password = "thiZ_is_v&ry_s3cret"
186
+ acl {
187
+ ip = "0.0.0.0/0"
188
+ description = "An acl description"
189
+ }
190
+ acl {
191
+ ip = "192.168.10.0/24"
192
+ description = "A second acl description"
193
+ }
194
+ }
195
+ ` ,
196
+ Check : resource .ComposeTestCheckFunc (
197
+ testAccCheckScalewayRedisExists (tt , "scaleway_redis_cluster.main" ),
198
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "name" , "test_redis_acl" ),
199
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "version" , "6.2.6" ),
200
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "node_type" , "MDB-BETA-M" ),
201
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "user_name" , "my_initial_user" ),
202
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "password" , "thiZ_is_v&ry_s3cret" ),
203
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.0.ip" , "0.0.0.0/0" ),
204
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.0.description" , "An acl description" ),
205
+ resource .TestCheckResourceAttrSet ("scaleway_redis_cluster.main" , "acl.0.id" ),
206
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.1.ip" , "192.168.10.0/24" ),
207
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.1.description" , "A second acl description" ),
208
+ resource .TestCheckResourceAttrSet ("scaleway_redis_cluster.main" , "acl.1.id" ),
209
+ ),
210
+ },
211
+ {
212
+ Config : `
213
+ resource "scaleway_redis_cluster" "main" {
214
+ name = "test_redis_acl"
215
+ version = "6.2.6"
216
+ node_type = "MDB-BETA-M"
217
+ user_name = "my_initial_user"
218
+ password = "thiZ_is_v&ry_s3cret"
219
+ acl {
220
+ ip = "192.168.11.0/24"
221
+ description = "Another acl description"
222
+ }
223
+ }
224
+ ` ,
225
+ Check : resource .ComposeTestCheckFunc (
226
+ testAccCheckScalewayRedisExists (tt , "scaleway_redis_cluster.main" ),
227
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "name" , "test_redis_acl" ),
228
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "version" , "6.2.6" ),
229
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "node_type" , "MDB-BETA-M" ),
230
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "user_name" , "my_initial_user" ),
231
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "password" , "thiZ_is_v&ry_s3cret" ),
232
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.0.ip" , "192.168.11.0/24" ),
233
+ resource .TestCheckResourceAttr ("scaleway_redis_cluster.main" , "acl.0.description" , "Another acl description" ),
234
+ resource .TestCheckResourceAttrSet ("scaleway_redis_cluster.main" , "acl.0.id" ),
235
+ ),
236
+ },
237
+ },
238
+ })
239
+ }
240
+
170
241
func testAccCheckScalewayRedisClusterDestroy (tt * TestTools ) resource.TestCheckFunc {
171
242
return func (state * terraform.State ) error {
172
243
for _ , rs := range state .RootModule ().Resources {
0 commit comments