generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocals.tf
30 lines (30 loc) · 2.34 KB
/
locals.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
locals {
environment = var.environment
project_name = var.project_name
existing_resource_group = var.existing_resource_group
azure_location = var.azure_location
resource_prefix = "${local.environment}${local.project_name}"
resource_group = local.existing_resource_group == "" ? azurerm_resource_group.default[0] : data.azurerm_resource_group.existing_resource_group[0]
enable_resource_group_lock = var.enable_resource_group_lock
key_vault_access_users = toset(var.key_vault_access_users)
key_vault_access_ipv4 = var.key_vault_access_ipv4
key_vault_access_subnet_ids = var.key_vault_access_subnet_ids
key_vault_access_use_rbac_authorization = var.key_vault_access_use_rbac_authorization
tfvars_filename = var.tfvars_filename
enable_tfvars_file_age_check = var.enable_tfvars_file_age_check
enable_diagnostic_setting = var.enable_diagnostic_setting
enable_diagnostic_storage_account = var.diagnostic_storage_account_id == "" ? var.enable_diagnostic_storage_account : false
enable_log_analytics_workspace = var.diagnostic_log_analytics_workspace_id == "" ? var.enable_log_analytics_workspace : false
diagnostic_log_analytics_workspace_id = var.diagnostic_log_analytics_workspace_id != "" ? var.diagnostic_log_analytics_workspace_id : (
local.enable_log_analytics_workspace ? azurerm_log_analytics_workspace.key_vault[0].id : null
)
log_analytics_destination_type = var.diagnostic_log_analytics_workspace_id != "" || local.enable_log_analytics_workspace ? "Dedicated" : null
diagnostic_storage_account_id = var.diagnostic_storage_account_id != "" ? var.diagnostic_storage_account_id : (
local.enable_diagnostic_storage_account ? azurerm_storage_account.logs[0].id : null
)
diagnostic_eventhub_name = var.diagnostic_eventhub_name != "" ? var.diagnostic_eventhub_name : null
tags = var.tags
secret_expiry_years = var.secret_expiry_years
timestamp_parts = regex("^(?P<year>\\d+)(?P<remainder>-.*)$", timestamp())
year_from_now = format("%d%s", local.timestamp_parts.year + local.secret_expiry_years, local.timestamp_parts.remainder)
}