Skip to content

Resource: awsApigatewayv2Stage

Manages an Amazon API Gateway Version 2 stage. More information can be found in the Amazon API Gateway Developer Guide.

Example Usage

Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.apigatewayv2Stage.Apigatewayv2Stage(this, "example", {
  apiId: "${aws_apigatewayv2_api.example.id}",
  name: "example-stage",
});

Argument Reference

The following arguments are required:

  • apiId - (Required) API identifier.
  • name - (Required) Name of the stage. Must be between 1 and 128 characters in length.

The following arguments are optional:

  • accessLogSettings - (Optional) Settings for logging access in this stage. Use the awsApiGatewayAccount resource to configure permissions for CloudWatch Logging.
  • autoDeploy - (Optional) Whether updates to an API automatically trigger a new deployment. Defaults to false. Applicable for HTTP APIs.
  • clientCertificateId - (Optional) Identifier of a client certificate for the stage. Use the awsApiGatewayClientCertificate resource to configure a client certificate. Supported only for WebSocket APIs.
  • defaultRouteSettings - (Optional) Default route settings for the stage.
  • deploymentId - (Optional) Deployment identifier of the stage. Use the awsApigatewayv2Deployment resource to configure a deployment.
  • description - (Optional) Description for the stage. Must be less than or equal to 1024 characters in length.
  • routeSettings - (Optional) Route settings for the stage.
  • stageVariables - (Optional) Map that defines the stage variables for the stage.
  • tags - (Optional) Map of tags to assign to the stage. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

accessLogSettings

  • destinationArn - (Required) ARN of the CloudWatch Logs log group to receive access logs. Any trailing :* is trimmed from the ARN.
  • format - (Required) Single line format of the access logs of data. Refer to log settings for HTTP or Websocket.

defaultRouteSettings

  • dataTraceEnabled - (Optional) Whether data trace logging is enabled for the default route. Affects the log entries pushed to Amazon CloudWatch Logs. Defaults to false. Supported only for WebSocket APIs.
  • detailedMetricsEnabled - (Optional) Whether detailed metrics are enabled for the default route. Defaults to false.
  • loggingLevel - (Optional) Logging level for the default route. Affects the log entries pushed to Amazon CloudWatch Logs. Valid values: error, info, off. Defaults to off. Supported only for WebSocket APIs. Terraform will only perform drift detection of its value when present in a configuration.
  • throttlingBurstLimit - (Optional) Throttling burst limit for the default route.
  • throttlingRateLimit - (Optional) Throttling rate limit for the default route.

routeSettings

  • routeKey - (Required) Route key.
  • dataTraceEnabled - (Optional) Whether data trace logging is enabled for the route. Affects the log entries pushed to Amazon CloudWatch Logs. Defaults to false. Supported only for WebSocket APIs.
  • detailedMetricsEnabled - (Optional) Whether detailed metrics are enabled for the route. Defaults to false.
  • loggingLevel - (Optional) Logging level for the route. Affects the log entries pushed to Amazon CloudWatch Logs. Valid values: error, info, off. Defaults to off. Supported only for WebSocket APIs. Terraform will only perform drift detection of its value when present in a configuration.
  • throttlingBurstLimit - (Optional) Throttling burst limit for the route.
  • throttlingRateLimit - (Optional) Throttling rate limit for the route.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - Stage identifier.
  • arn - ARN of the stage.
  • executionArn - ARN prefix to be used in an awsLambdaPermission's sourceArn attribute. For WebSocket APIs this attribute can additionally be used in an awsIamPolicy to authorize access to the @connections API. See the Amazon API Gateway Developer Guide for details.
  • invokeUrl - URL to invoke the API pointing to the stage, e.g., wss://z4675Bid1JExecuteApiEuWest2AmazonawsCom/exampleStage, or https://z4675Bid1JExecuteApiEuWest2AmazonawsCom/
  • tagsAll - Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

awsApigatewayv2Stage can be imported by using the API identifier and stage name, e.g.,

$ terraform import aws_apigatewayv2_stage.example aabbccddee/example-stage

-> Note: The API Gateway managed stage created as part of quick_create cannot be imported.