【问题标题】:Terraform Backend in azure with managed disks带有托管磁盘的 Azure Terraform 后端
【发布时间】:2018-08-13 04:03:17
【问题描述】:

我们正在从 Azure 中的非托管磁盘迁移到托管磁盘。目前我们的backend.tf定义如下

terraform {
  backend "azure" {
    storage_account_name = "foo"
    container_name = "foo-container"
    key = "foo.tfstate"
  }
}

使用托管磁盘,您无需引用存储帐户,因为它由 Azure 管理。这对 backend.tf 意味着什么。我们只是删除存储帐户和容器吗?我们是否需要添加一些标志来将后端存储标识为托管? Google 搜索没有提供所需的答案,因此请点击此处。

谢谢

【问题讨论】:

    标签: azure azure-storage azure-virtual-machine terraform azure-managed-disk


    【解决方案1】:

    对于托管磁盘,您无需引用存储帐户,因为它 由 Azure 管理。这对 backend.tf 意味着什么。

    这意味着你不能使用backend "azure",Azure 托管磁盘不支持这个。

    请参考此official document。将状态作为给定键存储在Microsoft Azure Storage 上的给定blob 容器中。

    使用 terraform 创建托管磁盘您可以查看此link

    resource "azurerm_managed_disk" "test" {
      name = "acctestmd"
      location = "West US 2"
      resource_group_name = "${azurerm_resource_group.test.name}"
      storage_account_type = "Standard_LRS"
      create_option = "Empty"
      disk_size_gb = "1"
    
      tags {
        environment = "staging"
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-03
      • 2017-11-14
      • 2019-02-02
      • 2021-01-16
      • 2019-03-14
      • 2021-02-24
      • 2019-07-12
      • 2019-09-05
      相关资源
      最近更新 更多