From 45f394b5ae9a19b0d71642fcd5aed69e44d2e65a Mon Sep 17 00:00:00 2001 From: stack72 Date: Thu, 23 Jun 2016 02:33:29 +0100 Subject: [PATCH] provider/aws: Support Import for `aws_redshift_subnet_group` ``` make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSRedshiftSubnetGroup_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSRedshiftSubnetGroup_ -timeout 120m === RUN TestAccAWSRedshiftSubnetGroup_importBasic --- PASS: TestAccAWSRedshiftSubnetGroup_importBasic (47.76s) === RUN TestAccAWSRedshiftSubnetGroup_basic --- PASS: TestAccAWSRedshiftSubnetGroup_basic (47.75s) === RUN TestAccAWSRedshiftSubnetGroup_updateSubnetIds --- PASS: TestAccAWSRedshiftSubnetGroup_updateSubnetIds (77.74s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 173.271s ``` --- .../import_aws_redshift_subnet_group_test.go | 30 +++++++++++++++++++ .../aws/resource_aws_redshift_subnet_group.go | 3 ++ 2 files changed, 33 insertions(+) create mode 100644 builtin/providers/aws/import_aws_redshift_subnet_group_test.go diff --git a/builtin/providers/aws/import_aws_redshift_subnet_group_test.go b/builtin/providers/aws/import_aws_redshift_subnet_group_test.go new file mode 100644 index 000000000..a5ff9256e --- /dev/null +++ b/builtin/providers/aws/import_aws_redshift_subnet_group_test.go @@ -0,0 +1,30 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSRedshiftSubnetGroup_importBasic(t *testing.T) { + resourceName := "aws_redshift_subnet_group.foo" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckRedshiftSubnetGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccRedshiftSubnetGroupConfig, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "description"}, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_redshift_subnet_group.go b/builtin/providers/aws/resource_aws_redshift_subnet_group.go index d270c7b31..5b119ed7f 100644 --- a/builtin/providers/aws/resource_aws_redshift_subnet_group.go +++ b/builtin/providers/aws/resource_aws_redshift_subnet_group.go @@ -19,6 +19,9 @@ func resourceAwsRedshiftSubnetGroup() *schema.Resource { Read: resourceAwsRedshiftSubnetGroupRead, Update: resourceAwsRedshiftSubnetGroupUpdate, Delete: resourceAwsRedshiftSubnetGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{