@@ -38,7 +38,6 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
38
38
resource "scaleway_instance_security_group" "base" {
39
39
name = "sg-name"
40
40
inbound_default_policy = "drop"
41
- tags = [ "test-terraform" ]
42
41
43
42
inbound_rule {
44
43
action = "accept"
@@ -90,7 +89,7 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
90
89
name = "sg-name"
91
90
inbound_default_policy = "accept"
92
91
tags = [ "test-terraform" ]
93
-
92
+
94
93
inbound_rule {
95
94
action = "drop"
96
95
port = 80
@@ -113,6 +112,7 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
113
112
Check : resource .ComposeTestCheckFunc (
114
113
testAccCheckScalewayInstanceSecurityGroupExists (tt , "scaleway_instance_security_group.base" ),
115
114
resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "name" , "sg-name" ),
115
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.0" , "test-terraform" ),
116
116
resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_default_policy" , "accept" ),
117
117
resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "outbound_default_policy" , "accept" ),
118
118
resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.#" , "3" ),
@@ -159,10 +159,10 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
159
159
resource "scaleway_instance_security_group" "base" {
160
160
name = "sg-name"
161
161
inbound_default_policy = "accept"
162
- tags = [ "test-terraform" ]
163
162
}
164
163
` ,
165
164
Check : resource .ComposeTestCheckFunc (
165
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "0" ),
166
166
resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.#" , "0" ),
167
167
),
168
168
},
@@ -349,12 +349,13 @@ func TestAccScalewayInstanceSecurityGroup_RemovePort(t *testing.T) {
349
349
Protocol : instance .SecurityGroupRuleProtocolTCP ,
350
350
Action : instance .SecurityGroupRuleActionAccept ,
351
351
}),
352
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "1" ),
353
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.0" , "test-terraform" ),
352
354
),
353
355
},
354
356
{
355
357
Config : `
356
358
resource "scaleway_instance_security_group" "base" {
357
- tags = [ "test-terraform" ]
358
359
inbound_rule {
359
360
action = "accept"
360
361
ip_range = "0.0.0.0/0"
@@ -370,6 +371,7 @@ func TestAccScalewayInstanceSecurityGroup_RemovePort(t *testing.T) {
370
371
Protocol : instance .SecurityGroupRuleProtocolTCP ,
371
372
Action : instance .SecurityGroupRuleActionAccept ,
372
373
}),
374
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "0" ),
373
375
),
374
376
},
375
377
},
@@ -463,6 +465,15 @@ func TestAccScalewayInstanceSecurityGroup_Tags(t *testing.T) {
463
465
resource .TestCheckResourceAttr ("scaleway_instance_security_group.main" , "tags.1" , "buzz" ),
464
466
),
465
467
},
468
+ {
469
+ Config : `
470
+ resource "scaleway_instance_security_group" "main" {
471
+ }
472
+ ` ,
473
+ Check : resource .ComposeTestCheckFunc (
474
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.main" , "tags.#" , "0" ),
475
+ ),
476
+ },
466
477
},
467
478
})
468
479
}
0 commit comments