【问题标题】:How can i deploy an function-app in azure from a remote git using terraform?如何使用 terraform 从远程 git 在 azure 中部署功能应用程序?
【发布时间】:2019-06-07 13:47:27
【问题描述】:

在运行我的 terraform 部署时,我想从远程 git 服务器中提取一个函数应用程序。 在同一个 terraform 模板中,我毫无问题地从私有注册表部署了一个 docker 映像。我只是找不到如何从远程 git 服务器部署函数应用程序。

【问题讨论】:

    标签: git azure deployment terraform azure-function-app


    【解决方案1】:

    实际上,Terraform 中 Azure 函数没有设置 GitHub 存储库的属性。您可以在Azure Function 中查看所有属性支持。

    但您可以在 Terraform 中使用 Azure CLI 和配置程序“local-exec”。查看Terraform module for Azure FunctionApp 中的步骤并使用Azure CLI 命令az functionapp deployment source config 而不是代码中的CLI 命令。那么配置器“local-exec”将如下所示:

    provisioner "local-exec" {
        command = "${var.git_enabled ? join("", list("az functionapp deployment source config --ids ", azurerm_function_app.funcapp.id), " --repo-url github_URI", " --branch master --manual-integration") : "true"}"
      }
    

    【讨论】:

    • 感谢您的回答。你建议的字符串我没有成功。但是您对文档的提示已经有所帮助。我需要添加“配置”。 "az functionapp deployment source configure --ids " ... 与 git 服务器的连接似乎有效,但没有设置 http-trigger。所以有些事情似乎仍然是错误的,但朝着正确的方向前进
    • 所以我想现在的问题是,我的应用程序是在 Java 中的,而我的部署没有考虑到这一点。如果您在解决方案中添加缺少的“配置”,我接受它已解决。
    • @WalterGill 您可以按照Function in Java 中的步骤设置您自己的触发器。
    • @WalterGill 您确定您的应用程序在本地运行良好吗?
    • @CharelsXu 从 vs-code 部署后,我的函数甚至在 Azure 中运行良好。我很确定我的函数应用程序的 terraform 模板在某处是错误的。
    猜你喜欢
    • 2022-06-15
    • 2021-11-14
    • 2021-06-12
    • 2020-10-16
    • 2019-10-20
    • 2016-09-14
    • 2023-03-05
    • 2019-10-20
    • 2019-10-28
    相关资源
    最近更新 更多