generated from Azure/terraform-azurerm-avm-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.encryption.tf
36 lines (32 loc) · 1.19 KB
/
main.encryption.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
#get the CMK vault
data "azurerm_key_vault" "this_vault" {
count = var.customer_managed_key == null ? 0 : 1
name = split("/", var.customer_managed_key.key_vault_resource_id)[8]
resource_group_name = split("/", var.customer_managed_key.key_vault_resource_id)[4]
}
#update the private cloud resource to use a CMK
resource "azapi_update_resource" "customer_managed_key" {
count = var.customer_managed_key == null ? 0 : 1
type = "Microsoft.AVS/privateClouds@2023-09-01"
body = {
properties = {
encryption = {
status = "Enabled"
keyVaultProperties = {
keyName = var.customer_managed_key.key_name
keyVaultUrl = data.azurerm_key_vault.this_vault[0].vault_uri
keyVersion = var.customer_managed_key.key_version
}
}
}
}
#name = "${azapi_resource.this_private_cloud.name}-${var.customer_managed_key.key_name}"
resource_id = azapi_resource.this_private_cloud.id
depends_on = [
azapi_resource.this_private_cloud,
azapi_resource.clusters,
azurerm_role_assignment.this_private_cloud,
azurerm_monitor_diagnostic_setting.this_private_cloud_diags,
#azapi_update_resource.managed_identity
]
}