Provides an API Gateway Stage.
resource "aws_api_gateway_stage" "test" { stage_name = "prod" rest_api_id = "${aws_api_gateway_rest_api.test.id}" deployment_id = "${aws_api_gateway_deployment.test.id}" } resource "aws_api_gateway_rest_api" "test" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" } resource "aws_api_gateway_deployment" "test" { depends_on = ["aws_api_gateway_integration.test"] rest_api_id = "${aws_api_gateway_rest_api.test.id}" stage_name = "dev" } resource "aws_api_gateway_resource" "test" { rest_api_id = "${aws_api_gateway_rest_api.test.id}" parent_id = "${aws_api_gateway_rest_api.test.root_resource_id}" path_part = "mytestresource" } resource "aws_api_gateway_method" "test" { rest_api_id = "${aws_api_gateway_rest_api.test.id}" resource_id = "${aws_api_gateway_resource.test.id}" http_method = "GET" authorization = "NONE" } resource "aws_api_gateway_method_settings" "s" { rest_api_id = "${aws_api_gateway_rest_api.test.id}" stage_name = "${aws_api_gateway_stage.test.stage_name}" method_path = "${aws_api_gateway_resource.test.path_part}/${aws_api_gateway_method.test.http_method}" settings { metrics_enabled = true logging_level = "INFO" } } resource "aws_api_gateway_integration" "test" { rest_api_id = "${aws_api_gateway_rest_api.test.id}" resource_id = "${aws_api_gateway_resource.test.id}" http_method = "${aws_api_gateway_method.test.http_method}" type = "MOCK" }
The following arguments are supported:
rest_api_id
- (Required) The ID of the associated REST API stage_name
- (Required) The name of the stage deployment_id
- (Required) The ID of the deployment that the stage points to access_log_settings
- (Optional) Enables access logs for the API stage. Detailed below. cache_cluster_enabled
- (Optional) Specifies whether a cache cluster is enabled for the stage cache_cluster_size
- (Optional) The size of the cache cluster for the stage, if enabled. Allowed values include 0.5
, 1.6
, 6.1
, 13.5
, 28.4
, 58.2
, 118
and 237
. client_certificate_id
- (Optional) The identifier of a client certificate for the stage. description
- (Optional) The description of the stage documentation_version
- (Optional) The version of the associated API documentation variables
- (Optional) A map that defines the stage variables tags
- (Optional) A mapping of tags to assign to the resource. access_log_settings
destination_arn
- (Required) ARN of the log group to send the logs to. Automatically removes trailing :*
if present. format
- (Required) The formatting and values recorded in the logs. For more information on configuring the log format rules visit the AWS documentation In addition to all arguments above, the following attributes are exported:
id
- The ID of the stage invoke_url
- The URL to invoke the API pointing to the stage, e.g. https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/prod
execution_arn
- The execution ARN to be used in lambda_permission
's source_arn
when allowing API Gateway to invoke a Lambda function, e.g. arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j/prod
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/api_gateway_stage.html