@@ -538,3 +538,36 @@ func testSweepComputeInstanceSecurityGroup(_ string) error {
538
538
return nil
539
539
})
540
540
}
541
+
542
+ func TestAccScalewayInstanceSecurityGroup_EnableSMTP (t * testing.T ) {
543
+ tt := NewTestTools (t )
544
+ defer tt .Cleanup ()
545
+ resource .Test (t , resource.TestCase {
546
+ PreCheck : func () { testAccPreCheck (t ) },
547
+ ProviderFactories : tt .ProviderFactories ,
548
+ CheckDestroy : testAccCheckScalewayInstanceSecurityGroupDestroy (tt ),
549
+ Steps : []resource.TestStep {
550
+ {
551
+ Config : `
552
+ resource "scaleway_instance_security_group" "base" {
553
+ enable_smtp = true
554
+ }
555
+ ` ,
556
+ Check : resource .ComposeTestCheckFunc (
557
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.0.action" , "accept" ),
558
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.0.protocol" , "TCP" ),
559
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.0.port" , "80" ),
560
+ resource .TestCheckResourceAttr ("scaleway_instance_security_group.base" , "inbound_rule.0.ip_range" , "0.0.0.0/0" ),
561
+ testAccCheckScalewayInstanceSecurityGroupRuleMatch (tt , "scaleway_instance_security_group.base" , 0 , & instance.SecurityGroupRule {
562
+ Direction : instance .SecurityGroupRuleDirectionInbound ,
563
+ IPRange : expandIPNet ("0.0.0.0/0" ),
564
+ DestPortFrom : scw .Uint32Ptr (80 ),
565
+ DestPortTo : nil ,
566
+ Protocol : instance .SecurityGroupRuleProtocolTCP ,
567
+ Action : instance .SecurityGroupRuleActionAccept ,
568
+ }),
569
+ ),
570
+ },
571
+ },
572
+ })
573
+ }
0 commit comments