Skip to content

Commit

Permalink
fix: link the stage with the deployment to make the API available (#75)
Browse files Browse the repository at this point in the history
We were creating the API Gateway deployment and stage properly, but
missed associating them both, which prevented the API from being
available.
  • Loading branch information
volmedo authored Dec 19, 2024
1 parent 509382b commit e564257
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions deploy/app/gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ resource "aws_apigatewayv2_integration" "postclaims" {
}

resource "aws_apigatewayv2_deployment" "deployment" {
depends_on = [aws_apigatewayv2_integration.getclaims, aws_apigatewayv2_integration.getroot, aws_apigatewayv2_integration.postclaims]
depends_on = [aws_apigatewayv2_integration.getclaim, aws_apigatewayv2_integration.getclaims, aws_apigatewayv2_integration.getroot, aws_apigatewayv2_integration.postclaims]
triggers = {
redeployment = sha1(join(",", [
jsonencode(aws_apigatewayv2_integration.getclaim),
jsonencode(aws_apigatewayv2_integration.postclaims),
jsonencode(aws_apigatewayv2_integration.getclaims),
jsonencode(aws_apigatewayv2_integration.postclaims),
jsonencode(aws_apigatewayv2_integration.getroot),
jsonencode(aws_apigatewayv2_route.getclaim),
jsonencode(aws_apigatewayv2_route.getclaims),
jsonencode(aws_apigatewayv2_route.getroot),
jsonencode(aws_apigatewayv2_route.postclaims),
Expand Down Expand Up @@ -134,6 +135,8 @@ resource "aws_apigatewayv2_domain_name" "custom_domain" {
resource "aws_apigatewayv2_stage" "stage" {
api_id = aws_apigatewayv2_api.api.id
name = "$default"
deployment_id = aws_apigatewayv2_deployment.deployment.id

lifecycle {
create_before_destroy = true
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/app/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ provider "aws" {
"Environment" = terraform.workspace
"ManagedBy" = "OpenTofu"
Owner = "storacha"
Team = "Storacha Engineer"
Team = "Storacha Engineering"
Organization = "Storacha"
Project = "${var.app}"
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/shared/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ provider "aws" {
"Environment" = terraform.workspace
"ManagedBy" = "OpenTofu"
Owner = "storacha"
Team = "Storacha Engineer"
Team = "Storacha Engineering"
Organization = "Storacha"
Project = "${var.app}"
}
Expand Down

0 comments on commit e564257

Please # to comment.