I am having issues setting up resources with Terraform on my azure account.
There are 2 scenarios.
Common setup for both scenarios:
I am using
Terraform v1.1.7
on windows_386
provider Terraform Registry v2.99.0
terraform {
required_version = ">=0.12"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>2.0"
}
}
}
provider "azurerm" {
features {}
}
data "azurerm_client_config" "current" {}
(an identical version of app service is created for wus)
resource "azurerm_app_service" "web-site-abc-eus" {
name = "web-abc-eus"
location = azurerm_resource_group.rg-abc-eus.location
resource_group_name = azurerm_resource_group.rg-abc-eus.name
app_service_plan_id = azurerm_app_service_plan.serverfarms-sfarm-abc-eus.id
site_config {
dotnet_framework_version = "v4.0"
scm_type = "None"
always_on = true
use_32_bit_worker_process = true
php_version = "5.6"
default_documents = [
"Default.htm",
"Default.html",
"Default.asp",
"index.htm",
"index.html",
"iisstart.htm",
"default.aspx",
"index.php",
"hostingstart.html"
]
}
client_affinity_enabled = true
}
I know these sound like an issue already fixed, but I am still having problems:
https://github.com/hashicorp/terraform-provider-azurerm/issues/3003
scenario 1 uses âstandardâ tier:
resource "azurerm_app_service_plan" "serverfarms-abc-eus" {
name = "sfarm-abc-eus"
location = azurerm_resource_group.rg-abc-eus.location
resource_group_name = azurerm_resource_group.rg-abc-eus.name
kind = "app"
is_xenon = false
maximum_elastic_worker_count = var.maxElasticWorkerCount
sku {
tier = "Standard"
size = "S1"
capacity = 1
}
}
resource "azurerm_app_service_plan" "serverfarms-abc-wus" {
name = "sfarm-abc-wus"
location = azurerm_resource_group.rg-abc-wus.location
resource_group_name = azurerm_resource_group.rg-abc-wus.name
kind = "app"
is_xenon = false
maximum_elastic_worker_count = var.maxElasticWorkerCount
sku {
tier = "Standard"
size = "S1"
capacity = 1
}
}
Errors:
â Error: creating Traffic Manager Profile (Subscription: ââ
â Resource Group Name: ârg-abc-eusâ
â Profile Name: âtrf-abc-globalâ): profiles.ProfilesClient#CreateOrUpdate: Failure sending request: StatusCode=409 â Original Error: autorest/azure: Service returned an error. Status=
â
â with azurerm_traffic_manager_profile.trf-abc,
â on trafficManager.tf line 1, in resource âazurerm_traffic_manager_profileâ âtrf-abcâ:
â 1: resource âazurerm_traffic_manager_profileâ âtrf-abcâ {
â
â”
â·
â Error: The name âweb-abc-eusâ used for the App Service needs to be globally unique and isnât available: Hostname âweb-abc-eusâ already exists. Please select a different name.
â
â with azurerm_app_service.web-site-abc-eus,
â on web.tf line 2, in resource âazurerm_app_serviceâ âweb-site-abc-eusâ:
â 2: resource âazurerm_app_serviceâ âweb-site-abc-eusâ {
â
â”
â·
â Error: The name âweb-abc-wusâ used for the App Service needs to be globally unique and isnât available: Hostname âweb-abc-wusâ already exists. Please select a different name.
â
â with azurerm_app_service.web-site-abc-wus,
â on web.tf line 31, in resource âazurerm_app_serviceâ âweb-site-abc-wusâ:
â 31: resource âazurerm_app_serviceâ âweb-site-abc-wusâ {
scenario 2, uses isolated tier:
from what I read, I got the impression that maybe the service plan has to be âisolatedâ to not have the âalready existâ error. Recieved new error instead.
resource "azurerm_app_service_plan" "serverfarms-abc-eus" {
name = "sfarm-abc-eus"
location = azurerm_resource_group.rg-abc-eus.location
resource_group_name = azurerm_resource_group.rg-abc-eus.name
kind = "app"
is_xenon = false
maximum_elastic_worker_count = var.maxElasticWorkerCount
sku {
tier = "Isolated"
size = "I1"
capacity = 1
}
}
resource "azurerm_app_service_plan" "serverfarms-abc-wus" {
name = "sfarm-abc-wus"
location = azurerm_resource_group.rg-abc-wus.location
resource_group_name = azurerm_resource_group.rg-abc-wus.name
kind = "app"
is_xenon = false
maximum_elastic_worker_count = var.maxElasticWorkerCount
sku {
tier = "Isolated"
size = "I1"
capacity = 1
}
}
Errors:
â Error: creating/updating App Service Plan: (Serverfarm Name âsfarm-abc-eusâ / Resource Group ârg-abc-eusâ): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=0 â Original Error: autorest/azure: Service returned an error. Status=
â
â with azurerm_app_service_plan.serverfarms-sfarm-abc-eus,
â on sfarm.tf line 1, in resource âazurerm_app_service_planâ âserverfarms-sfarm-abc-eusâ:
â 1: resource âazurerm_app_service_planâ âserverfarms-sfarm-abc-eusâ {
â
â”
â·
â Error: creating/updating App Service Plan: (Serverfarm Name âsfarm-abc-wusâ / Resource Group ârg-abc-wusâ): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=0 â Original Error: autorest/azure: Service returned an error. Status=
â
â with azurerm_app_service_plan.serverfarms-sfarm-abc-wus,
â on sfarm.tf line 16, in resource âazurerm_app_service_planâ âserverfarms-sfarm-abc-wusâ:
â 16: resource âazurerm_app_service_planâ âserverfarms-sfarm-abc-wusâ {
â
â”
â·
â Error: creating Traffic Manager Profile (Subscription: ââ
â Resource Group Name: ârg-abc-eusâ
â Profile Name: âtrf-abc-globalâ): profiles.ProfilesClient#CreateOrUpdate: Failure sending request: StatusCode=409 â Original Error: autorest/azure: Service returned an error. Status=
â
â with azurerm_traffic_manager_profile.trf-abc,
â on trafficManager.tf line 1, in resource âazurerm_traffic_manager_profileâ âtrf-abcâ:
â 1: resource âazurerm_traffic_manager_profileâ "trf-abc {