Skip to content

Commit

Permalink
skip: update CI 272
Browse files Browse the repository at this point in the history
  • Loading branch information
vit-corp committed Sep 25, 2024
1 parent 33603a9 commit 28eede7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
2 changes: 1 addition & 1 deletion auto_policy_testing/green/cosmosdb/cosmosdb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "azurerm_cosmosdb_account" "this" {

ip_range_filter = "127.0.0.1"

key_vault_key_id = data.terraform_remote_state.common.outputs.key_versionless_id
key_vault_key_id = azurerm_key_vault_key.this.versionless_id

access_key_metadata_writes_enabled = false

Expand Down
52 changes: 51 additions & 1 deletion auto_policy_testing/green/cosmosdb/key_vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,58 @@ data "azuread_service_principal" "cosmosdb" {
display_name = "Azure Cosmos DB"
}

resource "azurerm_key_vault" "this" {
name = "${module.naming.resource_prefix.keyvault}kv${random_integer.this.result}"
location = data.terraform_remote_state.common.outputs.location
resource_group_name = data.terraform_remote_state.common.outputs.resource_group
tenant_id = data.azurerm_client_config.current.tenant_id
sku_name = "standard"
soft_delete_retention_days = 7
purge_protection_enabled = true

access_policy {
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azurerm_client_config.current.object_id

key_permissions = [
"Get", "Create", "Delete", "List", "Restore", "Recover", "UnwrapKey", "WrapKey", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "GetRotationPolicy", "SetRotationPolicy"
]

secret_permissions = [
"Get",
"List",
"Set",
"Delete",
"Purge",
]

}

tags = module.naming.default_tags
}

resource "azurerm_key_vault_key" "this" {
name = "${module.naming.resource_prefix.keyvaultkey}key${random_integer.this.result}"
key_vault_id = azurerm_key_vault.this.id
key_type = "RSA"
key_size = 2048
expiration_date = "2025-01-01T12:00:00Z"

key_opts = [
"decrypt",
"encrypt",
"sign",
"unwrapKey",
"verify",
"wrapKey",
]

tags = module.naming.default_tags
}


resource "azurerm_key_vault_access_policy" "cosmosdb" {
key_vault_id = data.terraform_remote_state.common.outputs.key_vault_id
key_vault_id = azurerm_key_vault.this.id
tenant_id = data.azurerm_client_config.current.tenant_id
object_id = data.azuread_service_principal.cosmosdb.id

Expand Down
7 changes: 6 additions & 1 deletion auto_policy_testing/green/cosmosdb/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ terraform {
}

provider "azurerm" {
features {}
features {
key_vault {
purge_soft_delete_on_destroy = true
purge_soft_deleted_keys_on_destroy = true
}
}
}

0 comments on commit 28eede7

Please sign in to comment.