简体   繁体   中英

Azure Function app source control with terraform

I would like to deploy a Function App that has source control from github with terraform. I use the resource azurerm_function_app that has an argument source_control but I am facing this issue:

Error: Unsupported argument

  on main.tf line 137, in resource "azurerm_function_app" "example":
 137:   source_control = {

An argument named "source_control" is not expected here. Did you mean to
define a block of type "source_control"?

I am using that code:

provider "azurerm" {
  version = "~> 2.54"
  features {}
}

resource "azurerm_app_service_plan" "example" {
      name                = "example"
      location            = azurerm_resource_group.example.location
      resource_group_name = azurerm_resource_group.example.name
      kind                = "FunctionApp"
    
      sku {
        tier = "Standard"
        size = "S1"
      }
    }
    
    resource "azurerm_function_app" "example" {
      name                       = "example_func"
      location                   = azurerm_resource_group.example.location
      resource_group_name        = azurerm_resource_group.example.name
      app_service_plan_id        = azurerm_app_service_plan.example.id
      storage_account_name       = azurerm_storage_account.example.name
      storage_account_access_key = azurerm_storage_account.example.primary_access_key
    
      source_control = {
        repo_url  = "https://github.com/myrepo"
        branch    = "master"
      }
    }

Accordingly to the documentation , source_control is a block which means is defined without the = sign:

source_control {

}

Instead of:

source_control = {

}

With the = sign is an argument, not a block.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM