Axel Andersen
Axel Andersen

Reputation: 1128

Terraform use_msi on azurerm_function_app

I'm trying to run a terraform plan with an azurerm_function_app. I have this provider:

provider "azuread" {
  use_msi = true
}

and this in my azurerm_function_app block:

  identity = {
    type = "SystemAssigned"
  }

Unfortunately my plan keeps saying:

Error: Unsupported argument

  on main.tf line 62, in resource "azurerm_app_service_plan" "example":
  62:     identity = {

An argument named "identity" is not expected here.

I have added a SystemAssigned identity in the portal, but my terraform plan does not pick it up.

How can I add a MSI to azurerm_app_service_plan?

Upvotes: 1

Views: 435

Answers (1)

Matthew Schuchard
Matthew Schuchard

Reputation: 28774

Within the azurerm_function_app resource, the identity is documented as a block and not an argument. While an argument would require the syntax of a = immediately following it (and could possibly contain a map type with {} syntax), a block requires the syntax of {} following it. The block would contain whatever arguments are relevant.

Therefore, we can update your resource accordingly to fit the syntax requirements:

resource "azurerm_function_app" "my_function" {
  ...
  identity {
    type = "SystemAssigned"
  }
  ...
}

and fix the error.

Upvotes: 1

Related Questions