github.com/simonswine/terraform@v0.9.0-beta2/website/source/docs/providers/aws/r/api_gateway_api_key.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_api_gateway_api_key" 4 sidebar_current: "docs-aws-resource-api-gateway-api-key" 5 description: |- 6 Provides an API Gateway API Key. 7 --- 8 9 # aws\_api\_gateway\_api\_key 10 11 Provides an API Gateway API Key. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_api_gateway_rest_api" "MyDemoAPI" { 17 name = "MyDemoAPI" 18 } 19 20 resource "aws_api_gateway_api_key" "MyDemoApiKey" { 21 name = "demo" 22 23 stage_key { 24 rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}" 25 stage_name = "${aws_api_gateway_deployment.MyDemoDeployment.stage_name}" 26 } 27 } 28 29 resource "aws_api_gateway_deployment" "MyDemoDeployment" { 30 rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}" 31 stage_name = "test" 32 } 33 ``` 34 35 ## Argument Reference 36 37 The following arguments are supported: 38 39 * `name` - (Required) The name of the API key 40 * `description` - (Optional) The API key description. Defaults to "Managed by Terraform". 41 * `enabled` - (Optional) Specifies whether the API key can be used by callers. Defaults to `true`. 42 * `stage_key` - (Optional) A list of stage keys associated with the API key - see below 43 44 `stage_key` block supports the following: 45 46 * `rest_api_id` - (Required) The ID of the associated REST API. 47 * `stage_name` - (Required) The name of the API Gateway stage. 48 49 ## Attribute Reference 50 51 The following attributes are exported: 52 53 * `id` - The ID of the API key 54 * `created_date` - The creation date of the API key 55 * `last_updated_date` - The last update date of the API key 56 57 58 ## Import 59 60 API Gateway Keys can be imported using the `id`, e.g. 61 62 ``` 63 $ terraform import aws_api_gateway_api_key.my_demo_key 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk 64 ```