mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-16 18:35:03 -06:00
providers/aws: aws_security_group import test
This commit is contained in:
parent
6a675b4a15
commit
1c81aa3471
37
builtin/providers/aws/import_aws_security_group_test.go
Normal file
37
builtin/providers/aws/import_aws_security_group_test.go
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package aws
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccAWSSecurityGroup_importBasic(t *testing.T) {
|
||||||
|
checkFn := func(s []*terraform.InstanceState) error {
|
||||||
|
// Expect 3: group, 2 rules
|
||||||
|
if len(s) != 3 {
|
||||||
|
return fmt.Errorf("expected 3 states: %#v", s)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSSecurityGroupConfig,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: "aws_security_group.web",
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateCheck: checkFn,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user