简体   繁体   中英

How can i deploy an function-app in azure from a remote git using terraform?

When running my terraform deployment, i want to pull a function app from a remote git server. In the same terraform template i deploy a docker image from a private registry with no problem. I just can't find how to deploy the function app from a remote git server.

Actually, there is no property for Azure function to set the GitHub repository in Terraform. You can see all properties support in Azure Function .

But you can take the use of Azure CLI and provisioner "local-exec" in Terraform. Take a look at the steps in Terraform module for Azure FunctionApp and use the Azure CLI command az functionapp deployment source config instead of the CLI command inside the code. Then the provisioner "local-exec" will look like below:

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

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