github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/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 ~> **Warning:** Since the API Gateway usage plans feature was launched on August 11, 2016, usage plans are now **required** to associate an API key with an API stage. 14 15 ## Example Usage 16 17 ```hcl 18 resource "aws_api_gateway_rest_api" "MyDemoAPI" { 19 name = "MyDemoAPI" 20 } 21 22 resource "aws_api_gateway_api_key" "MyDemoApiKey" { 23 name = "demo" 24 25 stage_key { 26 rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}" 27 stage_name = "${aws_api_gateway_deployment.MyDemoDeployment.stage_name}" 28 } 29 } 30 31 resource "aws_api_gateway_deployment" "MyDemoDeployment" { 32 rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}" 33 stage_name = "test" 34 } 35 ``` 36 37 ## Argument Reference 38 39 The following arguments are supported: 40 41 * `name` - (Required) The name of the API key 42 * `description` - (Optional) The API key description. Defaults to "Managed by Terraform". 43 * `enabled` - (Optional) Specifies whether the API key can be used by callers. Defaults to `true`. 44 * `value` - (Optional) The value of the API key. If not specified, it will be automatically generated by AWS on creation. 45 * `stage_key` - (Optional) A list of stage keys associated with the API key - see below 46 47 `stage_key` block supports the following: 48 49 * `rest_api_id` - (Required) The ID of the associated REST API. 50 * `stage_name` - (Required) The name of the API Gateway stage. 51 52 ## Attribute Reference 53 54 The following attributes are exported: 55 56 * `id` - The ID of the API key 57 * `created_date` - The creation date of the API key 58 * `last_updated_date` - The last update date of the API key 59 * `value` - The value of the API key 60 61 62 ## Import 63 64 API Gateway Keys can be imported using the `id`, e.g. 65 66 ``` 67 $ terraform import aws_api_gateway_api_key.my_demo_key 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk 68 ```