resource "aws_api_gateway_rest_api" "transponder-tracker" { name = "transponder-tracker" } resource "aws_api_gateway_deployment" "transponder-tracker" { rest_api_id = aws_api_gateway_rest_api.transponder-tracker.id triggers = { # NOTE: The configuration below will satisfy ordering considerations, # but not pick up all future REST API changes. More advanced patterns # are possible, such as using the filesha1() function against the # Terraform configuration file(s) or removing the .id references to # calculate a hash against whole resources. Be aware that using whole # resources will show a difference after the initial implementation. # It will stabilize to only change when resources change afterwards. redeployment = sha1(jsonencode([ aws_api_gateway_resource.transponder-tracker-load.id, aws_api_gateway_method.transponder-tracker-load.id, aws_api_gateway_integration.transponder-tracker-load.id, ])) } lifecycle { create_before_destroy = true } } resource "aws_api_gateway_stage" "transponder-tracker" { deployment_id = aws_api_gateway_deployment.transponder-tracker.id rest_api_id = aws_api_gateway_rest_api.transponder-tracker.id stage_name = "sandbox" }