为azurerm_app_service配置源代码控制(SCM)

时间:2019-06-27 17:56:43

标签: terraform

我目前已通过Terraform在Azure中配置了Web应用程序服务。一种选择是site_config> scm_type(https://www.terraform.io/docs/providers/azurerm/r/app_service.html#scm_type)。

为此新创建的应用程序指定VSO存储库URL和分支的推荐方法是什么?

我已经成功创建了SCM类型的应用程序服务,默认值为“无”。第一次按下即可成功使用VSO,但在事实完成后尝试在门户中配置设置无效。

variable "tenant" {}
variable "subscription" {}
variable "client_id" {}
variable "client_secret" {}

## Set provider and service principal 
provider "azurerm" {
  subscription_id = "${var.subscription}"
  client_id       = "${var.client_id}"
  client_secret   = "${var.client_secret}"
  tenant_id       = "${var.tenant}"
}

resource "azurerm_resource_group" "rg1" {  
 name = "RG-AppServices-tf"
 location = "eastus2"
 }

 resource "azurerm_app_service_plan" "plan1" {
  name                = "AppServicePlan-tf"
  location            = "${azurerm_resource_group.rg1.location}"
  kind                = "app"
  resource_group_name = "${azurerm_resource_group.rg1.name}"
  sku {
    tier = "Basic"
    size = "B1"
  }
}

resource "azurerm_app_service" "app1" {
  name                = "dashboard-tf"
  location            = "${azurerm_resource_group.rg1.location}"
  resource_group_name = "${azurerm_resource_group.rg1.name}"
  app_service_plan_id = "${azurerm_app_service_plan.plan1.id}"

  site_config {
    dotnet_framework_version = "v4.0"
    scm_type = "VSO"
 }
}  

我想设置源代码控制信息以完全自动化应用程序部署。在Azure门户中配置部署中心并尝试导入到Terraform也不起作用。

感谢您的帮助!

0 个答案:

没有答案