![](/img/trans.png)
[英]Terraform Azure: How to use multiple version of the AzureRM provider?
[英]How to specify resource provider version in the Terraform using AzureRM provider
我使用 Azure ARM 模板來部署 Azure 資源。 現在我被要求將一些 ARM 模板轉換為 Terraform 文件。
我是 terraform 世界的新手。 我剛剛瀏覽了一些使用 Terraform 的 AzureRM 提供程序創建 Azure 資源的在線示例。 但是,我沒有找到為 Azure 資源提供程序設置 API 版本的方法。
例如,在 ARM 模板中,我們可以為任何資源指定“apiVersion”,但在 Terraform 中沒有選擇 API 版本的選項。
有誰知道如何在 Terraform for Azure 中選擇 API 版本?
在 Terrform 中,我們不會像在 ARM 模板中那樣為每個資源指定api version
。
在 terraform 中,我們僅使用 AzureRM 提供程序版本。 如果您沒有提及特定版本,它將采用最新的 AzureRM 提供程序版本
Azure 提供程序可用於使用 Azure 資源管理器 API 在 Microsoft Azure 中配置基礎結構。
像下面
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.10.0"
}
}
}
provider "azurerm" {
features {}
}
data "azurerm_resource_group" "example" {
name = "v-rasXXXXree"
#location = "West Europe"
}
resource "azurerm_virtual_network" "example-2" {
name = "peternetwork2"
resource_group_name = data.azurerm_resource_group.example.name
address_space = ["10.0.2.0/24"]
location = data.azurerm_resource_group.example.location
}
有關更多信息,請參閱此官方terarform 文檔
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.