forked from aztfmod/level0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyvault.tf
66 lines (47 loc) · 1.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
61
62
63
64
65
data "azurerm_client_config" "current" {}
resource "azurecaf_naming_convention" "keyvault" {
name = var.resource_keyvault_name
prefix = local.prefix_start_alpha
resource_type = "kv"
convention = "cafrandom"
}
resource "azurerm_key_vault" "launchpad" {
name = azurecaf_naming_convention.keyvault.result
location = azurerm_resource_group.rg_security.location
resource_group_name = azurerm_resource_group.rg_security.name
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
tags = {
tfstate = var.workspace
workspace = var.workspace
}
}
resource "azurerm_key_vault_access_policy" "launchpad" {
key_vault_id = azurerm_key_vault.launchpad.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = azuread_service_principal.launchpad.object_id
key_permissions = []
secret_permissions = [
"Get",
"List",
"Set",
"Delete"
]
}
resource "azurerm_key_vault_access_policy" "bootstrap_account" {
key_vault_id = azurerm_key_vault.launchpad.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = var.logged_user_objectId
key_permissions = []
secret_permissions = [
"Get",
"List",
"Set",
"Delete"
]
lifecycle {
ignore_changes = [
object_id
]
}
}