Skip to content

Commit

Permalink
Merge pull request #42 from RSS-Engineering/kevinsecrist/simpler-rede…
Browse files Browse the repository at this point in the history
…ployment

Hash full resources for apigw redeployment
  • Loading branch information
kevin-secrist authored Oct 24, 2023
2 parents ee19ba3 + aca5839 commit 4171bcf
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions modules/api_gateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,17 @@ locals {
level_3_routes = { for key, value in local.routes : key => value if length(split("/", key)) == 3 }
level_4_routes = { for key, value in local.routes : key => value if length(split("/", key)) == 4 }
level_5_routes = { for key, value in local.routes : key => value if length(split("/", key)) == 5 }
redeployment_hash = var.redeployment_hash != "" ? var.redeployment_hash : sha1(jsonencode(concat(
[
var.name,
], [
for key, value in aws_api_gateway_resource.rest_api_route_1d_resource : value.id
], [
for key, value in aws_api_gateway_resource.rest_api_route_2d_resource : value.id
], [
for key, value in aws_api_gateway_resource.rest_api_route_3d_resource : value.id
], [
for key, value in aws_api_gateway_resource.rest_api_route_4d_resource : value.id
], [
for key, value in aws_api_gateway_resource.rest_api_route_5d_resource : value.id
], [
for key, value in aws_api_gateway_method.rest_api_route_method : value.id
], [
for key, value in aws_api_gateway_integration.rest_api_route_integration : value.id
], [
for key, value in aws_api_gateway_authorizer.authorizer : value.id
]
)))
redeployment_hash = var.redeployment_hash != "" ? var.redeployment_hash : sha1(jsonencode([
var.name,
aws_api_gateway_resource.rest_api_route_1d_resource,
aws_api_gateway_resource.rest_api_route_2d_resource,
aws_api_gateway_resource.rest_api_route_3d_resource,
aws_api_gateway_resource.rest_api_route_4d_resource,
aws_api_gateway_resource.rest_api_route_5d_resource,
aws_api_gateway_method.rest_api_route_method,
aws_api_gateway_integration.rest_api_route_integration,
aws_api_gateway_authorizer.authorizer,
]))
}

data "aws_region" "current" {}
Expand Down

0 comments on commit 4171bcf

Please sign in to comment.