Skip to content

Commit

Permalink
Slot resource has been renamed (it's conditional)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertGHippo committed Oct 7, 2024
1 parent 4a1f1cd commit 40fa5cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ provider "azurerm" {
}
}

moved {
from = module.webapp.azurerm_key_vault_access_policy.webapp_kv_app_service_slot
to = module.webapp.azurerm_key_vault_access_policy.webapp_kv_app_service_slot[0]
}

# Create Resource Group
resource "azurerm_resource_group" "rg" {
name = "${var.resource_name_prefix}-rg"
Expand Down
13 changes: 9 additions & 4 deletions terraform/modules/azure-web/web-app.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
moved {
from = resource.azurerm_linux_web_app_slot.webapp_slot
to = resource.azurerm_linux_web_app_slot.webapp_slot[0]
}

# Create Log Analytics
resource "azurerm_log_analytics_workspace" "webapp_logs" {
name = "${var.resource_name_prefix}-log"
Expand Down Expand Up @@ -151,7 +156,7 @@ resource "azurerm_linux_web_app" "webapp" {
resource "azurerm_linux_web_app_slot" "webapp_slot" {

count = var.environment != "development" ? 1 : 0

name = var.webapp_slot_name
app_service_id = azurerm_linux_web_app.webapp.id
https_only = true
Expand Down Expand Up @@ -206,7 +211,7 @@ resource "azurerm_linux_web_app_slot" "webapp_slot" {
}

resource "azurerm_monitor_diagnostic_setting" "webapp_logs_monitor" {

name = "${var.resource_name_prefix}-webapp-mon"
target_resource_id = azurerm_linux_web_app.webapp.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.webapp_logs.id
Expand All @@ -231,7 +236,7 @@ resource "azurerm_monitor_diagnostic_setting" "webapp_logs_monitor" {
resource "azurerm_monitor_diagnostic_setting" "webapp_slot_logs_monitor" {

count = var.environment != "development" ? 1 : 0

name = "${var.resource_name_prefix}-webapp-${var.webapp_slot_name}-mon"
target_resource_id = azurerm_linux_web_app_slot.webapp_slot.0.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.webapp_logs.id
Expand Down Expand Up @@ -412,7 +417,7 @@ resource "azurerm_key_vault_access_policy" "webapp_kv_app_service" {
resource "azurerm_key_vault_access_policy" "webapp_kv_app_service_slot" {

count = var.environment != "development" ? 1 : 0

key_vault_id = var.kv_id
tenant_id = data.azurerm_client_config.az_config.tenant_id
object_id = azurerm_linux_web_app_slot.webapp_slot.0.identity.0.principal_id
Expand Down

0 comments on commit 40fa5cb

Please sign in to comment.