From 92fe1c82fc954c5060bed76ec036c321e01bebef Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Tue, 28 Jun 2016 16:03:24 +0100 Subject: [PATCH] provider/aws: Support Import `aws_api_gateway_account` (#7368) ``` make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSAPIGatewayAccount_importBasic' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /vendor/) TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAPIGatewayAccount_importBasic -timeout 120m === RUN TestAccAWSAPIGatewayAccount_importBasic --- PASS: TestAccAWSAPIGatewayAccount_importBasic (16.43s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 16.450s ``` --- .../import_aws_api_gateway_account_test.go | 28 +++++++++++++++++++ .../aws/resource_aws_api_gateway_account.go | 3 ++ 2 files changed, 31 insertions(+) create mode 100644 builtin/providers/aws/import_aws_api_gateway_account_test.go diff --git a/builtin/providers/aws/import_aws_api_gateway_account_test.go b/builtin/providers/aws/import_aws_api_gateway_account_test.go new file mode 100644 index 000000000..cb60a4929 --- /dev/null +++ b/builtin/providers/aws/import_aws_api_gateway_account_test.go @@ -0,0 +1,28 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSAPIGatewayAccount_importBasic(t *testing.T) { + resourceName := "aws_api_gateway_account.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAPIGatewayAccountDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSAPIGatewayAccountConfig_empty, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_api_gateway_account.go b/builtin/providers/aws/resource_aws_api_gateway_account.go index 2f562e63b..fd6dfca8e 100644 --- a/builtin/providers/aws/resource_aws_api_gateway_account.go +++ b/builtin/providers/aws/resource_aws_api_gateway_account.go @@ -18,6 +18,9 @@ func resourceAwsApiGatewayAccount() *schema.Resource { Read: resourceAwsApiGatewayAccountRead, Update: resourceAwsApiGatewayAccountUpdate, Delete: resourceAwsApiGatewayAccountDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "cloudwatch_role_arn": &schema.Schema{