From 2a07f86041ad5f2271bba0c5f73d9b94dd8c251c Mon Sep 17 00:00:00 2001 From: stack72 Date: Thu, 23 Jun 2016 02:12:02 +0100 Subject: [PATCH] provider/aws: Support Import for `aws_elasticache_subnet_group` ``` make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheSubnetGroup_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheSubnetGroup_ -timeout 120m === RUN TestAccAWSElasticacheSubnetGroup_importBasic --- PASS: TestAccAWSElasticacheSubnetGroup_importBasic (46.80s) === RUN TestAccAWSElasticacheSubnetGroup_basic --- PASS: TestAccAWSElasticacheSubnetGroup_basic (48.79s) === RUN TestAccAWSElasticacheSubnetGroup_update --- PASS: TestAccAWSElasticacheSubnetGroup_update (76.81s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 172.431s ``` --- ...mport_aws_elasticache_subnet_group_test.go | 34 +++++++++++++++++++ .../resource_aws_elasticache_subnet_group.go | 3 ++ 2 files changed, 37 insertions(+) create mode 100644 builtin/providers/aws/import_aws_elasticache_subnet_group_test.go diff --git a/builtin/providers/aws/import_aws_elasticache_subnet_group_test.go b/builtin/providers/aws/import_aws_elasticache_subnet_group_test.go new file mode 100644 index 000000000..2ce156110 --- /dev/null +++ b/builtin/providers/aws/import_aws_elasticache_subnet_group_test.go @@ -0,0 +1,34 @@ +package aws + +import ( + "testing" + + "fmt" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSElasticacheSubnetGroup_importBasic(t *testing.T) { + resourceName := "aws_elasticache_subnet_group.bar" + config := fmt.Sprintf(testAccAWSElasticacheSubnetGroupConfig, acctest.RandInt()) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSElasticacheSubnetGroupDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{ + "description"}, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_elasticache_subnet_group.go b/builtin/providers/aws/resource_aws_elasticache_subnet_group.go index af684af42..efae2e703 100644 --- a/builtin/providers/aws/resource_aws_elasticache_subnet_group.go +++ b/builtin/providers/aws/resource_aws_elasticache_subnet_group.go @@ -19,6 +19,9 @@ func resourceAwsElasticacheSubnetGroup() *schema.Resource { Read: resourceAwsElasticacheSubnetGroupRead, Update: resourceAwsElasticacheSubnetGroupUpdate, Delete: resourceAwsElasticacheSubnetGroupDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "description": &schema.Schema{