在Terraform SQL Server虚拟机设置中使用新磁盘类型时,存储出错

6ju8rftf  于 2023-02-03  发布在  SQL Server
关注(0)|答案(2)|浏览(188)

我尝试使用Terraform添加SQL Server "数据"/"日志"磁盘。为虚拟机创建了3个数据磁盘,LUN 0、1、2均设置为标准SSD,Terraform

中有128G空间
下面的代码片段是我当前尝试运行的代码。

resource "azurerm_mssql_virtual_machine" "sqlconfig" {

  virtual_machine_id               = azurerm_windows_virtual_machine.vm[var.HOSTNAME_MICROSOFTSQL].id
  sql_license_type                 = "PAYG"
  sql_connectivity_port            = *redacted 
  sql_connectivity_type            = *redacted 
  sql_connectivity_update_password = *redacted 
  sql_connectivity_update_username = *redacted 

  sql_instance {

    collation = "SQL_Latin1_General_CP1_CI_AS"

  }

  storage_configuration {

    disk_type = "NEW" 
    storage_workload_type = "OLTP"
  
    data_settings {

      default_file_path = "F:\\Data"
      luns = [0]

    }

    log_settings {

      default_file_path = "G:\\Log"
      luns = [1]

    }

    temp_db_settings {

      default_file_path = "G:\\tempDb"
      luns = [1]
      data_file_count = 8
      data_file_size_mb = 8
      data_file_growth_in_mb = 64
      log_file_size_mb = 8
      log_file_growth_mb = 64

    }

  }

但是,当从azure devops管道部署时,我收到以下错误

polling after CreateOrUpdate: Code="Ext_StorageConfigurationSettingsError" Message="Error: 'Number of disks found do not match the expected count for creating Storage Pool, found :0 target: 1. Detail: Disk with LUN number 0 cannot be pooled. Reason : Insufficient Capacity'"

此错误意味着什么?

8xiog9wr

8xiog9wr1#

数据卷似乎仅与PremiumSSD和UltraDisk兼容。日志也是如此。请尝试更改磁盘类型。
若要进行验证,请尝试通过Azure Portal创建你的VM,配置存储时,你应该只能选择Ultra或PXX磁盘。
希望有帮助。

nle07wnf

nle07wnf2#

在Terraform中,在azurerm_mssql_virtual_machine上运行该部分之前创建数据磁盘并将其连接到VM时,在azurerm_mssql_virtual_machine中设置磁盘/附件和存储配置之间似乎会遇到某种争用情况。在azurerm_mssql_virtual_machine下添加以下代码块后,此问题就得到了解决:

depends_on = [
          azurerm_virtual_machine_data_disk_attachment.[disk_attachment_name]
    ]

相关问题