Provides an API Gateway API Key.
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.
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
name = "MyDemoAPI"
}
resource "aws_api_gateway_api_key" "MyDemoApiKey" {
name = "demo"
stage_key {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
stage_name = "${aws_api_gateway_deployment.MyDemoDeployment.stage_name}"
}
}
resource "aws_api_gateway_deployment" "MyDemoDeployment" {
rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
stage_name = "test"
}
The following arguments are supported:
name - (Required) The name of the API key description - (Optional) The API key description. Defaults to "Managed by Terraform". enabled - (Optional) Specifies whether the API key can be used by callers. Defaults to true. value - (Optional) The value of the API key. If not specified, it will be automatically generated by AWS on creation. stage_key - (Optional) A list of stage keys associated with the API key - see below stage_key block supports the following:
rest_api_id - (Required) The ID of the associated REST API. stage_name - (Required) The name of the API Gateway stage. In addition to all arguments above, the following attributes are exported:
id - The ID of the API key created_date - The creation date of the API key last_updated_date - The last update date of the API key value - The value of the API key API Gateway Keys can be imported using the id, e.g.
$ terraform import aws_api_gateway_api_key.my_demo_key 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/api_gateway_api_key.html