Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/appsync_graphql_api: Support import #3500

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aws/resource_aws_appsync_graphql_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ func resourceAwsAppsyncGraphqlApi() *schema.Resource {
Update: resourceAwsAppsyncGraphqlApiUpdate,
Delete: resourceAwsAppsyncGraphqlApiDelete,

Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
"authentication_type": {
Type: schema.TypeString,
Expand Down
20 changes: 20 additions & 0 deletions aws/resource_aws_appsync_graphql_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@ func TestAccAWSAppsyncGraphqlApi_cognito(t *testing.T) {
})
}

func TestAccAWSAppsyncGraphqlApi_import(t *testing.T) {
resourceName := "aws_appsync_graphql_api.test_apikey"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAppsyncGraphqlApiConfig_apikey(acctest.RandString(5)),
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCheckAwsAppsyncGraphqlApiDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).appsyncconn
for _, rs := range s.RootModule().Resources {
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/appsync_graphql_api.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,11 @@ The following attributes are exported:

* `id` - API ID
* `arn` - The ARN

## Import

AppSync GraphQL API can be imported using the GraphQL API ID, e.g.

```
$ terraform import aws_appsync_graphql_api.example 0123456789
```