@@ -38,7 +38,6 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
3838 resource "scaleway_instance_security_group" "base" {
3939 name = "sg-name"
4040 inbound_default_policy = "drop"
41- tags = [ "test-terraform" ]
4241
4342 inbound_rule {
4443 action = "accept"
@@ -90,7 +89,7 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
9089 name = "sg-name"
9190 inbound_default_policy = "accept"
9291 tags = [ "test-terraform" ]
93-
92+
9493 inbound_rule {
9594 action = "drop"
9695 port = 80
@@ -113,6 +112,7 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
113112 Check : resource .ComposeTestCheckFunc (
114113 testAccCheckScalewayInstanceSecurityGroupExists (tt , "scaleway_instance_security_group.base" ),
115114 resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "name" , "sg-name" ),
115+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.0" , "test-terraform" ),
116116 resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_default_policy" , "accept" ),
117117 resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "outbound_default_policy" , "accept" ),
118118 resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.#" , "3" ),
@@ -159,10 +159,10 @@ func TestAccScalewayInstanceSecurityGroup_Basic(t *testing.T) {
159159 resource "scaleway_instance_security_group" "base" {
160160 name = "sg-name"
161161 inbound_default_policy = "accept"
162- tags = [ "test-terraform" ]
163162 }
164163 ` ,
165164 Check : resource .ComposeTestCheckFunc (
165+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "0" ),
166166 resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.#" , "0" ),
167167 ),
168168 },
@@ -349,12 +349,13 @@ func TestAccScalewayInstanceSecurityGroup_RemovePort(t *testing.T) {
349349 Protocol : instance .SecurityGroupRuleProtocolTCP ,
350350 Action : instance .SecurityGroupRuleActionAccept ,
351351 }),
352+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "1" ),
353+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.0" , "test-terraform" ),
352354 ),
353355 },
354356 {
355357 Config : `
356358 resource "scaleway_instance_security_group" "base" {
357- tags = [ "test-terraform" ]
358359 inbound_rule {
359360 action = "accept"
360361 ip_range = "0.0.0.0/0"
@@ -370,6 +371,7 @@ func TestAccScalewayInstanceSecurityGroup_RemovePort(t *testing.T) {
370371 Protocol : instance .SecurityGroupRuleProtocolTCP ,
371372 Action : instance .SecurityGroupRuleActionAccept ,
372373 }),
374+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "tags.#" , "0" ),
373375 ),
374376 },
375377 },
@@ -463,6 +465,15 @@ func TestAccScalewayInstanceSecurityGroup_Tags(t *testing.T) {
463465 resource .TestCheckResourceAttr ("scaleway_instance_security_group.main" , "tags.1" , "buzz" ),
464466 ),
465467 },
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+ },
466477 },
467478 })
468479}
0 commit comments