Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from nfrappart/fix-access-policy-Nate
Browse files Browse the repository at this point in the history
fix missing access policy - Nate
  • Loading branch information
nfrappart authored Jun 30, 2021
2 parents 488b60e + 957cc14 commit 8ce0a2a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Module to create Keyvault Resource #
#######################################

#Get current session informations
data "azurerm_client_config" "TerraClientConfig" {}

#KeyVault Creation

resource "azurerm_key_vault" "TerraKeyVault" {
name = var.Name
location = var.Location
Expand Down Expand Up @@ -37,3 +38,29 @@ resource "azurerm_key_vault" "TerraKeyVault" {
]
}
}


# add access to keyvault for terraform Service Principal
resource "azurerm_key_vault_access_policy" "TerraKeyVaultPolicyForTFSP" {
key_vault_id = azurerm_key_vault.TerraKeyVault.id
tenant_id = data.azurerm_client_config.TerraClientConfig.tenant_id
object_id = data.azurerm_client_config.TerraClientConfig.object_id

key_permissions = [
"backup", "create", "decrypt", "delete", "encrypt", "get", "import", "list", "purge", "recover", "restore", "sign", "unwrapKey", "update", "verify", "wrapKey"
]

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

certificate_permissions = [
"create",
"delete",
"get",
"getissuers",
"list",
"listissuers",
"update",
]
}

0 comments on commit 8ce0a2a

Please sign in to comment.