I have a few standard logic apps that all share an app service plan. These logic apps are in different RG’s but in the same subscription. I am able to deploy any of these logic app( Important Note: I have tried with the logic app being both public and private ) When I go to deploy a second time, while changing none of the infrastructure I get an error that my app service plan can no longer be referenced. Does anyone have a solution for this? I can delete and recreate all my infrastructure and that works, but I don’t think that is the point of terraform. I should not have to delete my whole state everytime i need to promote. I’ve tried using both azurerm_app_service_plan and azurerm_service plan, both give me the same error.
Error
Please Note I have removed my subID from the error below
module.basic_intake_logic.module.standard[0].azurerm_logic_app_standard.standard: Modifying... [id=/subscriptions/XXXXXXXXXXXXXXXXXXXXX/resourceGroups/rg-Web-dev-01/providers/Microsoft.Web/sites/la-webteamtest-dev-02]
╷
│ Error: updating App Service (Subscription: "XXXXXXXXXXXXXXXXXXXXX"
│ Resource Group Name: "rg-Webn-dev-01"
│ Site Name: "la-webteamtest-dev-02"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"The serverFarm property has an incorrect value for App Service Plan. Valid values are a plan name as string or of format subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.web/serverfarms/planName where the subscription is the same as the site's subscription.","Target":null,"Details":[{"Message":"The serverFarm property has an incorrect value for App Service Plan. Valid values are a plan name as string or of format subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.web/serverfarms/planName where the subscription is the same as the site's subscription."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"59603","MessageTemplate":"The serverFarm property has an incorrect value for App Service Plan. Valid values are a plan name as string or of format subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.web/serverfarms/planName where the subscription is the same as the site's subscription.","Parameters":[],"Code":"BadRequest","Message":"The serverFarm property has an incorrect value for App Service Plan. Valid values are a plan name as string or of format subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.web/serverfarms/planName where the subscription is the same as the site's subscription."}}],"Innererror":null}
Root module that is being called
resource "azurerm_logic_app_standard" "standard" {
name = "la-${var.service_name}-${var.environment}-${var.iteration}"
resource_group_name = data.azurerm_resource_group.rg.name
location = data.azurerm_resource_group.rg.location
app_service_plan_id = data.azurerm_app_service_plan.existing_service_plan.id
storage_account_name = module.storage.storage_account_name
storage_account_access_key = module.storage.storage_primary_access_key
app_settings = var.app_settings
use_extension_bundle = var.use_extension_bundle
bundle_version = var.bundle_version
public_network_access = var.public_network_access
// virtual_network_subnet_id = var.virtual_network_subnet_id
dynamic "connection_string" {
for_each = var.connection_string != null ? var.connection_string : []
content {
name = connection_string.value.name
type = connection_string.value.type
value = connection_string.value.value
}
}
client_affinity_enabled = var.client_affinity_enabled
client_certificate_mode = var.client_certificate_mode
enabled = var.enabled
https_only = var.https_only
dynamic "identity" {
for_each = var.identities != null ? var.identities : {}
content {
type = identity.value.type
identity_ids = identity.value.identity_ids
}
}
site_config {
always_on = var.site_config.always_on
app_scale_limit = var.site_config.app_scale_limit
dynamic "cors" {
for_each = var.site_config.cors != null ? [var.site_config.cors] : []
content {
allowed_origins = cors.value.allowed_origins
support_credentials = cors.value.support_credentials
}
}
dotnet_framework_version = var.site_config.dotnet_framework_version
elastic_instance_minimum = var.site_config.elastic_instance_minimum
ftps_state = var.site_config.ftps_state
health_check_path = var.site_config.health_check_path
http2_enabled = var.site_config.http2_enabled
dynamic "ip_restriction" {
for_each = var.site_config.ip_restriction != null ? var.site_config.ip_restriction : []
content {
ip_address = ip_restriction.value.ip_address
service_tag = ip_restriction.value.service_tag
virtual_network_subnet_id = ip_restriction.value.virtual_network_subnet_id
name = ip_restriction.value.name
priority = ip_restriction.value.priority
action = ip_restriction.value.action
dynamic "headers" {
for_each = ip_restriction.value.headers != null ? [ip_restriction.value.headers] : []
content {
x_azure_fdid = headers.value.x_azure_fdid
x_fd_health_probe = headers.value.x_fd_health_probe
x_forwarded_for = headers.value.x_forwarded_for
x_forwarded_host = headers.value.x_forwarded_host
}
}
}
}
dynamic "scm_ip_restriction" {
for_each = var.site_config.scm_ip_restriction != null ? var.site_config.scm_ip_restriction : []
content {
ip_address = scm_ip_restriction.value.ip_address
service_tag = scm_ip_restriction.value.service_tag
virtual_network_subnet_id = scm_ip_restriction.value.virtual_network_subnet_id
name = scm_ip_restriction.value.name
priority = scm_ip_restriction.value.priority
action = scm_ip_restriction.value.action
dynamic "headers" {
for_each = scm_ip_restriction.value.headers != null ? [scm_ip_restriction.value.headers] : []
content {
x_azure_fdid = headers.value.x_azure_fdid
x_fd_health_probe = headers.value.x_fd_health_probe
x_forwarded_for = headers.value.x_forwarded_for
x_forwarded_host = headers.value.x_forwarded_host
}
}
}
}
scm_use_main_ip_restriction = var.site_config.scm_use_main_ip_restriction
scm_min_tls_version = var.site_config.scm_min_tls_version
scm_type = var.site_config.scm_type
linux_fx_version = var.site_config.linux_fx_version # Fixed typo from linus_fx_version
min_tls_version = var.site_config.min_tls_version
runtime_scale_monitoring_enabled = var.site_config.runtime_scale_monitoring_enabled
use_32_bit_worker_process = var.site_config.use_32_bit_worker_process
# vnet_route_all_enabled = var.site_config.vnet_route_all_enabled
websockets_enabled = var.site_config.websockets_enabled
}
}