provider/aws: removal of the duplicate import aws_iam_instance_profile test
This commit is contained in:
parent
a4dba89553
commit
4e0ebfde3f
|
@ -1,28 +0,0 @@
|
||||||
package aws
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestAccAWSIAMInstanceProfile_importBasic(t *testing.T) {
|
|
||||||
resourceName := "aws_iam_instance_profile.test"
|
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
|
||||||
Providers: testAccProviders,
|
|
||||||
CheckDestroy: testAccCheckAWSInstanceProfileDestroy,
|
|
||||||
Steps: []resource.TestStep{
|
|
||||||
resource.TestStep{
|
|
||||||
Config: testAccAwsIamInstanceProfileConfig,
|
|
||||||
},
|
|
||||||
|
|
||||||
resource.TestStep{
|
|
||||||
ResourceName: resourceName,
|
|
||||||
ImportState: true,
|
|
||||||
ImportStateVerify: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -6,7 +6,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
|
||||||
"github.com/aws/aws-sdk-go/service/iam"
|
"github.com/aws/aws-sdk-go/service/iam"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
|
@ -32,35 +31,6 @@ func TestAWSPolicy_namePrefix(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckAWSPolicyDestroy(s *terraform.State) error {
|
|
||||||
iamconn := testAccProvider.Meta().(*AWSClient).iamconn
|
|
||||||
|
|
||||||
for _, rs := range s.RootModule().Resources {
|
|
||||||
if rs.Type != "aws_iam_policy" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to get policy
|
|
||||||
_, err := iamconn.GetPolicy(&iam.GetPolicyInput{
|
|
||||||
PolicyArn: aws.String(rs.Primary.Attributes["arn"]),
|
|
||||||
})
|
|
||||||
if err == nil {
|
|
||||||
return fmt.Errorf("still exist.")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify the error is what we want
|
|
||||||
ec2err, ok := err.(awserr.Error)
|
|
||||||
if !ok {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if ec2err.Code() != "NoSuchEntity" {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func testAccCheckAWSPolicyExists(resource string, res *iam.GetPolicyOutput) resource.TestCheckFunc {
|
func testAccCheckAWSPolicyExists(resource string, res *iam.GetPolicyOutput) resource.TestCheckFunc {
|
||||||
return func(s *terraform.State) error {
|
return func(s *terraform.State) error {
|
||||||
rs, ok := s.RootModule().Resources[resource]
|
rs, ok := s.RootModule().Resources[resource]
|
||||||
|
|
Loading…
Reference in New Issue