From 20bc268d3430ee3f2b8fe081bcaf7de635598fd7 Mon Sep 17 00:00:00 2001 From: stack72 Date: Thu, 23 Jun 2016 09:52:45 +0100 Subject: [PATCH] provider/aws: Support Import for `aws_iam_account_password_policy` ``` make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSIAMAccountPasswordPolicy_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSIAMAccountPasswordPolicy_ -timeout 120m === RUN TestAccAWSIAMAccountPasswordPolicy_importBasic --- PASS: TestAccAWSIAMAccountPasswordPolicy_importBasic (14.75s) === RUN TestAccAWSIAMAccountPasswordPolicy_basic --- PASS: TestAccAWSIAMAccountPasswordPolicy_basic (26.06s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 40.831s ``` --- ...rt_aws_iam_account_password_policy_test.go | 28 +++++++++++++++++++ ...esource_aws_iam_account_password_policy.go | 3 ++ 2 files changed, 31 insertions(+) create mode 100644 builtin/providers/aws/import_aws_iam_account_password_policy_test.go diff --git a/builtin/providers/aws/import_aws_iam_account_password_policy_test.go b/builtin/providers/aws/import_aws_iam_account_password_policy_test.go new file mode 100644 index 000000000..b5fec9eca --- /dev/null +++ b/builtin/providers/aws/import_aws_iam_account_password_policy_test.go @@ -0,0 +1,28 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSIAMAccountPasswordPolicy_importBasic(t *testing.T) { + resourceName := "aws_iam_account_password_policy.default" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSIAMAccountPasswordPolicyDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSIAMAccountPasswordPolicy, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_iam_account_password_policy.go b/builtin/providers/aws/resource_aws_iam_account_password_policy.go index 6f4f092f9..71dfbf0c8 100644 --- a/builtin/providers/aws/resource_aws_iam_account_password_policy.go +++ b/builtin/providers/aws/resource_aws_iam_account_password_policy.go @@ -17,6 +17,9 @@ func resourceAwsIamAccountPasswordPolicy() *schema.Resource { Read: resourceAwsIamAccountPasswordPolicyRead, Update: resourceAwsIamAccountPasswordPolicyUpdate, Delete: resourceAwsIamAccountPasswordPolicyDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "allow_users_to_change_password": &schema.Schema{