簡體   English   中英

AzureRM 自動化 DSC 配置

[英]AzureRM Automation DSC Configuration

我正在嘗試配置 Azure DSC 配置,但我遇到了兩個問題。

  1. 我繼續收到此錯誤消息
  • 錯誤 = '無效字符 'c' 尋找值的開頭' JSON = '配置 cdavdtest {}'* *2。 無論我對資源 azurerm_automation_dsc_configuration 做什么,它都會拋出此命令,該命令引用了我上次失敗的 terraform 計划/應用。 更改配置沒有任何作用,舊錯誤繼續存在。 我感謝任何幫助。 與下面也以粗體顯示的資源相比,請參閱粗體顯示的 cdavdtest。 名稱也沒有更新,即使我將其更新為 dsc_configa,它仍然顯示 dsc_config。

錯誤:對 AzureRM Automation Dsc 配置內容“cdavdtest”發出讀取請求:automation.DscConfigurationClient#GetContent:響應請求失敗:StatusCode = 200 - 原始錯誤:解組時發生錯誤 JSON - 錯誤 = '無效字符 'c' 尋找開始價值'JSON ='配置cdavdtest {}'││與azurerm_automation_dsc_configuration.dsc_config,│在automationaccount.tf第17行,在資源“azurerm_automation_dsc_configuration”“dsc_config”中:│17:資源azurerm_automation_dsc_configuration {

resource azurerm_automation_account automation_account {
    name = "${var.avd.name}-automationaccount"
    location = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name
    sku_name = "Basic"
}

output "end_point" {
    value = azurerm_automation_account.automation_account.dsc_server_endpoint
}

output registration_key {
    value = azurerm_automation_account.automation_account.dsc_primary_access_key
}


resource azurerm_automation_dsc_configuration dsc_configa {
    name = "**test**"
    location = azurerm_resource_group.rg.location
    resource_group_name = azurerm_resource_group.rg.name 
    automation_account_name = azurerm_automation_account.automation_account.name
    description = "Configuration node for Azure Virtual Desktop"
    content_embedded = "Configuration **test** {}"
    log_verbose = true
}


我已經嘗試注釋掉代碼,但仍然出現錯誤。 我試過更新名稱。 我試過使用 <<BODY 並寫出配置,但這仍然存在。

在我的環境中測試得到同樣的錯誤。 該錯誤是由於azurerm_automation_dsc_configuration 自提供程序版本 2.96.0 以來已損壞

我使用的是最新的 terraform 提供商版本,即3.0.1

在此處輸入圖像描述

在此處輸入圖像描述

解決方案:建議您使用version = ">=2.10,<=2.30"之間的提供程序版本

Terraform 代碼

main.tf文件

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">=2.10,<=2.30"
    }
  }
}

provider "azurerm" {
  features{}
  
}


data "azurerm_resource_group" "example" {
  name     = "XXXXXXxXXX"
}

resource "azurerm_automation_account" "example" {
  name                = "account1"
  location            = data.azurerm_resource_group.example.location
  resource_group_name = data.azurerm_resource_group.example.name
  sku_name = "Basic"
}


output "end_point" {
    value = azurerm_automation_account.example.dsc_server_endpoint
}

output "registration_key" {
    value = azurerm_automation_account.example.dsc_primary_access_key
}

resource "azurerm_automation_dsc_configuration" "example" {
  name                    = "test"
  resource_group_name     = data.azurerm_resource_group.example.name
  automation_account_name = azurerm_automation_account.example.name
  location                = data.azurerm_resource_group.example.location
  content_embedded        = "configuration test {}"
  log_verbose = true

  
}

輸出 -

在此處輸入圖像描述


在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM