skip to Main Content

I am trying to deploy a linux web app using Terraform.

resource "azurerm_linux_web_app" "web_app" {
  name                = "pi"
  resource_group_name = azurerm_resource_group.resource_group.name
  location            = azurerm_service_plan.service_plan.location
  service_plan_id     = azurerm_service_plan.service_plan.id

  site_config {
  }

  app_settings {
    MYSETTING = "some value"
  }
}

I am using provider version 3.89.0 (latest at time of writing)

  required_version = ">=1.6.0"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.89.0"
    }
  }

I get the following error when I run my terraform script in my Devops piepline;

Error: Unsupported block type on main.tf line 125, in resource
"azurerm_linux_web_app" "web_app":
125: app_settings { Blocks of
type "app_settings" are not expected here.

Did you mean to define
argument "app_settings"? If so, use the equals sign to assign it a
value.

Unless I’m misreading it, the documentation states that there is such a block. The error is pretty clear and I need to pass in some app_settings values. Does anyone know why I might be having these issues and how I might resolve them?

Thanks.

2

Answers


  1. Chosen as BEST ANSWER

    app_settings is not a block, its a property. I was declaring it incorrectly. I need to include an equals sign between the property name and the first curly brace.

      app_settings = {
        MYSETTING = "some value"
      }
    

  2. appSettings is a property of site_config

    site_config {
       app_settings {
          MYSETTING = "some value"
       }
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search