Im writing a terraform script for an app service plan and I have some issues while performing terraform plan
This is how my app service plan looks like:
resource "azurerm_app_service_plan" "app_plan" {
name = var.app_service_plan_name
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
kind = var.app_service_plan_so
reserved = true
sku {
tier = "Basic"
size = "B1"
}
This actually works.
The issue is when I define my sku like this:
sku {
tier = var.app_service_plan_sku_tier.tier_name
size = var.app_service_plan_sku_size.plan_size
}
In my variable.tf file, the sku variables are defined as follow
variable "app_service_plan_sku_tier" {
tier_name = "Basic"
}
variable "app_service_plan_sku_size" {
plan_size = "B1"
}
In this second example, y got this error
I also tried renaming the variable plan_tier to tier. Same with plan size to size.
Can anyone tell me why is this error happening?
Thanks!
You should declare an Input Variable value like this:
variable "app_service_plan_sku_tier" {
type = string
default = "Basic"
}
variable "app_service_plan_sku_size" {
type = string
default = "B1"
}
and refer the SKU like this:
sku {
tier = var.app_service_plan_sku_tier
size = var.app_service_plan_sku_size
}
Reference from https://www.terraform.io/docs/language/values/variables.html#declaring-an-input-variable