-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
24 lines (22 loc) · 1.03 KB
/
main.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
locals {
tags = merge({ role = "eb-app" }, var.tags)
common_options = {
service_role = var.appversion_service_role_arn
delete_source_from_s3 = var.appversion_delete_source_from_s3
}
options = [var.appversion_max_count != "" && var.appversion_max_age_in_days == "" && var.appversion_service_role_arn != "" ? merge({ max_count = var.appversion_max_count }, local.common_options) : merge({ max_age_in_days = var.appversion_max_age_in_days }, local.common_options)]
}
resource "aws_elastic_beanstalk_application" "this" {
name = var.name
description = var.description
tags = local.tags
dynamic "appversion_lifecycle" {
for_each = local.options
content {
service_role = var.appversion_service_role_arn
max_age_in_days = lookup(appversion_lifecycle.value, "max_age_in_days", null)
delete_source_from_s3 = lookup(appversion_lifecycle.value, "delete_source_from_s3", null)
max_count = lookup(appversion_lifecycle.value, "max_count", null)
}
}
}