有关使用Terraform部署到Azure的问题

时间:2019-05-28 15:26:22

标签: azure terraform terraform-provider-azure

是否有办法将Azure映像的URN传递给storage_image_reference,而不是分别使用Publisher,Offer和SKU?

例如。通过

OpenLogic:CentOS:7.5:latest

代替

storage_image_reference {
  publisher = "OpenLogic"
  offer     = "CentOS"
  sku       = "7.5"
  version   = "latest"
}

1 个答案:

答案 0 :(得分:1)

假设地形0.11

variable "urn" {
  type = "list"
}

urn = split(":", "OpenLogic:CentOS:7.5:latest")

...

storage_image_reference {
  publisher = "${urn[0]}"
  offer     = "${urn[1]}"
  sku       = "${urn[2]}"
  version   = "${urn[3]}"
}