-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modularise Terraform Vars Key Vault (#335)
* Added Event Hub deployment option * Modularised TF Vars Key Vault
- Loading branch information
1 parent
7a9dde8
commit 1bfb434
Showing
6 changed files
with
26 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,13 @@ | ||
resource "azurerm_key_vault" "tfvars" { | ||
name = "${local.environment}${local.project_name}-tfvars" | ||
location = module.azure_container_apps_hosting.azurerm_resource_group_default.location | ||
resource_group_name = module.azure_container_apps_hosting.azurerm_resource_group_default.name | ||
tenant_id = data.azurerm_client_config.current.tenant_id | ||
sku_name = "standard" | ||
soft_delete_retention_days = 7 | ||
enable_rbac_authorization = false | ||
|
||
dynamic "access_policy" { | ||
for_each = data.azuread_user.key_vault_access | ||
|
||
content { | ||
tenant_id = data.azurerm_client_config.current.tenant_id | ||
object_id = access_policy.value["object_id"] | ||
|
||
key_permissions = [ | ||
"Create", | ||
"Get", | ||
] | ||
|
||
secret_permissions = [ | ||
"Set", | ||
"Get", | ||
"Delete", | ||
"Purge", | ||
"Recover", | ||
"List", | ||
] | ||
} | ||
} | ||
|
||
# It won't be possible to add/manage a network acl for this | ||
# vault, as it will need to be accessable for multiple people. | ||
# tfsec:ignore:azure-keyvault-specify-network-acl | ||
network_acls { | ||
bypass = "None" | ||
default_action = "Allow" | ||
} | ||
|
||
purge_protection_enabled = true | ||
|
||
tags = local.tags | ||
} | ||
|
||
# Expiry doesn't need to be set, as this is just used as a way to | ||
# store and share the tfvars | ||
# tfsec:ignore:azure-keyvault-ensure-secret-expiry | ||
resource "azurerm_key_vault_secret" "tfvars" { | ||
name = "${local.environment}${local.project_name}-tfvars" | ||
value = base64encode(file(local.tfvars_filename)) | ||
key_vault_id = azurerm_key_vault.tfvars.id | ||
content_type = "text/plain+base64" | ||
module "azurerm_key_vault" { | ||
source = "github.com/DFE-Digital/terraform-azurerm-key-vault-tfvars?ref=v0.1.1" | ||
|
||
environment = local.environment | ||
project_name = local.project_name | ||
resource_group_name = module.azure_container_apps_hosting.azurerm_resource_group_default.name | ||
azure_location = local.azure_location | ||
key_vault_access_users = local.key_vault_access_users | ||
tfvars_filename = local.tfvars_filename | ||
diagnostic_log_analytics_workspace_id = module.azure_container_apps_hosting.azurerm_log_analytics_workspace_container_app.id | ||
diagnostic_eventhub_name = local.enable_event_hub ? module.azure_container_apps_hosting.azurerm_eventhub_container_app.name : "" | ||
tags = local.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters