Manages an Amazon API Gateway Version 2 deployment. More information can be found in the Amazon API Gateway Developer Guide.
resource "aws_apigatewayv2_deployment" "example" {
api_id = aws_apigatewayv2_api.example.id
description = "Example deployment"
lifecycle {
create_before_destroy = true
}
}
resource "aws_apigatewayv2_deployment" "example" {
api_id = aws_apigatewayv2_api.example.id
description = "Example deployment"
triggers = {
redeployment = sha1(join(",", tolist([
jsonencode(aws_apigatewayv2_integration.example),
jsonencode(aws_apigatewayv2_route.example),
])))
}
lifecycle {
create_before_destroy = true
}
}
This resource supports the following arguments:
api_id
- (Required) API identifier.description
- (Optional) Description for the deployment resource. Must be less than or equal to 1024 characters in length.triggers
- (Optional) Map of arbitrary keys and values that, when changed, will trigger a redeployment. To force a redeployment without changing these keys/values, use the terraform taint
command.This resource exports the following attributes in addition to the arguments above:
id
- Deployment identifier.auto_deployed
- Whether the deployment was automatically released.In Terraform v1.5.0 and later, use an import
block to import aws_apigatewayv2_deployment
using the API identifier and deployment identifier. For example:
import {
to = aws_apigatewayv2_deployment.example
id = "aabbccddee/1122334"
}
Using terraform import
, import aws_apigatewayv2_deployment
using the API identifier and deployment identifier. For example:
% terraform import aws_apigatewayv2_deployment.example aabbccddee/1122334
The triggers
argument cannot be imported.