generated from appvia/terraform-aws-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvault.tf
65 lines (52 loc) · 1.53 KB
/
vault.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
61
62
63
64
65
resource "aws_cloudformation_stack_set" "vault" {
for_each = {
for v in var.vaults :
v.name => v
}
name = lower(format("%s-vault-%s", var.name, each.key))
description = format("Provisions Vaults for AWS Backup")
template_body = local.cf_vault_tpl
parameters = {
VaultName = "BackupVault"
VaultLockChangeableDays = 0
VaultLockMinRetentionDays = 0
VaultLockMaxRetentionDays = 0
}
permission_model = "SERVICE_MANAGED"
capabilities = [
"CAPABILITY_NAMED_IAM",
"CAPABILITY_AUTO_EXPAND",
"CAPABILITY_IAM",
]
tags = merge(var.tags, {
Name = var.name
})
auto_deployment {
enabled = true
retain_stacks_on_account_removal = false
}
operation_preferences {
failure_tolerance_count = 0
max_concurrent_percentage = 100
region_concurrency_type = "PARALLEL"
}
lifecycle {
ignore_changes = [
administration_role_arn,
]
}
}
resource "aws_cloudformation_stack_set_instance" "vault" {
for_each = local.vaults_per_region
stack_set_name = aws_cloudformation_stack_set.vault[each.value.vault.name].name
region = each.value.region
parameter_overrides = {
VaultName = each.value.vault.name
VaultLockChangeableDays = each.value.vault.change_grace_days
VaultLockMinRetentionDays = each.value.vault.min_retention_days
VaultLockMaxRetentionDays = each.value.vault.max_retention_days
}
deployment_targets {
organizational_unit_ids = var.deployment_targets
}
}