Skip to content

Commit

Permalink
feat(rbac): key vault data plane access example
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-ng committed Oct 14, 2020
1 parent 314f52c commit 455a5df
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions modules/workspace/_rbac-key-vault.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# RBAC Example for Key Vault
# --------------------------
# Key Vault access is managed on the data plane
# Instead of applying role assignments, we apply key
# vault access policies.
#
# In this demo's organization, only admins have access to
# destructive functionality.

resource "azurerm_key_vault_access_policy" "team_group" {
key_vault_id = azurerm_key_vault.kv.id
object_id = var.team_group_id
tenant_id = local.client_tenant_id

secret_permissions = [
"backup",
# "delete", # Admins-only
"get",
"list",
# "purge", # Admins-only
# "recover", # Admins-only
"restore",
"set"
]
}

resource "azurerm_key_vault_access_policy" "admins_group" {
key_vault_id = azurerm_key_vault.kv.id
object_id = var.admin_group_id
tenant_id = local.client_tenant_id

secret_permissions = [
"backup",
"delete",
"get",
"list",
"purge",
"recover",
"restore",
"set"
]
}

# Important Footnotes
#
# - For brevity, this demo only applies permissions to secrets.
# In real life, you will want to do the same for certificates
# and keys.
#
# - In real life, you probably want to give developers admin
# access to the key vault in their development environment.
#
# - As of Oct 2020 there is an alternate permissions model,
# the RBAC Permission Model, which is in preview. For details, see:
# https://docs.microsoft.com/en-us/azure/key-vault/general/rbac-guide

0 comments on commit 455a5df

Please sign in to comment.