Resource: aws_apigatewayv2_deployment

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

Example Usage

Basic

resource "aws_apigatewayv2_deployment" "example" {
  api_id      = aws_apigatewayv2_api.example.id
  description = "Example deployment"

  lifecycle {
    create_before_destroy = true
  }
}

Redeployment Triggers

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
  }
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

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.