forked from aztfmod/terraform-azurerm-caf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyvault.tf
executable file
·59 lines (47 loc) · 2.14 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
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.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) ? local.resource_groups[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 = {
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
diagnostic_storage_accounts = local.combined_objects_diagnostic_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_applications
}
output "keyvaults" {
value = module.keyvaults
}