providers/aws: aws_security_group import test

This commit is contained in:
Mitchell Hashimoto 2016-05-10 09:35:22 -07:00
parent 6a675b4a15
commit 1c81aa3471
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 37 additions and 0 deletions

View 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,
},
},
})
}