-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployment.tf
33 lines (30 loc) · 1.02 KB
/
deployment.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
locals {
trigger = var.api_deployment_trigger != "" ? var.api_deployment_trigger : timestamp()
}
resource "aws_api_gateway_deployment" "tile" {
for_each = var.api_stages
rest_api_id = aws_api_gateway_rest_api.tile.id
description = local.trigger
lifecycle {
create_before_destroy = true
}
triggers = {
"redeployment" = local.trigger
}
depends_on = [
aws_api_gateway_rest_api.tile,
aws_api_gateway_method.json_get,
aws_api_gateway_method.json_options,
aws_api_gateway_method.tile_get,
aws_api_gateway_method.tile_options
]
}
resource "aws_api_gateway_stage" "tile" {
for_each = var.api_stages
stage_name = each.value.name
rest_api_id = aws_api_gateway_rest_api.tile.id
deployment_id = aws_api_gateway_deployment.tile[each.key].id
cache_cluster_enabled = each.value.cache_size != 0 ? true : false
cache_cluster_size = each.value.cache_size != 0 ? each.value.cache_size : null
xray_tracing_enabled = each.value.xray_tracing_enabled
}