Skip to content

Commit

Permalink
Updating Terraform locks
Browse files Browse the repository at this point in the history
  • Loading branch information
frasermolyneux committed Feb 8, 2024
1 parent 6e02101 commit 8a9bab4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions terraform/common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ resource "azurerm_resource_group" "rg" {
}

resource "azurerm_management_lock" "rg_lock" {
count = var.environment == "prd" ? 1 : 0

name = "Terraform (CanNotDelete) - ${random_id.lock.hex}"
scope = azurerm_resource_group.rg.id
lock_level = "CanNotDelete"
Expand Down
2 changes: 2 additions & 0 deletions terraform/key_vault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resource "azurerm_key_vault" "kv" {
}

resource "azurerm_management_lock" "kv_lock" {
count = var.environment == "prd" ? 1 : 0

name = "Terraform (CanNotDelete) - ${random_id.lock.hex}"
scope = azurerm_key_vault.kv.id
lock_level = "CanNotDelete"
Expand Down
2 changes: 2 additions & 0 deletions terraform/sql_database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ resource "azurerm_mssql_database" "repo" {
}

resource "azurerm_management_lock" "repo_lock" {
count = var.environment == "prd" ? 1 : 0

name = "Terraform (CanNotDelete) - ${random_id.lock.hex}"
scope = azurerm_mssql_database.repo.id
lock_level = "CanNotDelete"
Expand Down

0 comments on commit 8a9bab4

Please sign in to comment.