This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
forked from aztfmod/terraform-azurerm-caf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyvault.tf
60 lines (48 loc) · 2.37 KB
/
keyvault.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
module "keyvaults" {
source = "./modules/security/keyvault"
for_each = var.keyvaults
global_settings = local.global_settings
client_config = local.client_config
settings = each.value
resource_groups = local.combined_objects_resource_groups
diagnostics = local.combined_diagnostics
vnets = local.combined_objects_networking
azuread_groups = local.combined_objects_azuread_groups
managed_identities = local.combined_objects_managed_identities
base_tags = try(local.global_settings.inherit_tags, false) ? try(local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][try(each.value.resource_group.key, each.value.resource_group_key)].tags, {}) : {}
private_dns = local.combined_objects_private_dns
}
#
# Keyvault access policies
#-
module "keyvault_access_policies" {
source = "./modules/security/keyvault_access_policies"
for_each = var.keyvault_access_policies
keyvault_key = each.key
keyvaults = local.combined_objects_keyvaults
access_policies = each.value
azuread_groups = local.combined_objects_azuread_groups
client_config = local.client_config
resources = {
azuread_service_principals = local.combined_objects_azuread_service_principals
diagnostic_storage_accounts = local.combined_objects_diagnostic_storage_accounts
managed_identities = local.combined_objects_managed_identities
mssql_managed_instances = local.combined_objects_mssql_managed_instances
mssql_managed_instances_secondary = local.combined_objects_mssql_managed_instances_secondary
storage_accounts = local.combined_objects_storage_accounts
}
}
# Need to separate keyvault policies from azure AD apps to get the keyvault with the default policies.
# Reason - Azure AD apps passwords are stored into keyvault secrets and combining would create a circular reference
module "keyvault_access_policies_azuread_apps" {
source = "./modules/security/keyvault_access_policies"
for_each = var.keyvault_access_policies_azuread_apps
keyvault_key = each.key
keyvaults = local.combined_objects_keyvaults
access_policies = each.value
client_config = local.client_config
azuread_apps = local.combined_objects_azuread_apps
}
output "keyvaults" {
value = module.keyvaults
}