繁体   English   中英

Azure Function 应用源代码控制与 terraform

[英]Azure Function app source control with terraform

我想部署一个 Function 应用程序,它具有来自 github 和 terraform 的源代码控制。 我使用具有参数source_control的资源azurerm_function_app但我面临这个问题:

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"?

我正在使用该代码:

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"
      }
    }

根据文档source_control是一个块,这意味着定义时没有=符号:

source_control {

}

代替:

source_control = {

}

=符号是一个参数,而不是一个块。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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