【发布时间】:2020-12-07 11:46:09
【问题描述】:
背景
我正在尝试使用 Azure 自动化将一些 Azure Windows VM 配置为 DNS 服务器。
我想使用 Terraform 来配置自动化帐户、DSC 配置和 DSC 节点配置,但我卡在 DSC 节点配置上。
我有以下工作,但前提是我通过单击门户手动编译它:
resource "azurerm_automation_dsc_configuration" "configuration" {
name = "DNSConfig"
resource_group_name = "my_rg"
location = "uksouth"
automation_account_name = "my_aa_account"
content_embedded = <<-CONTENT
Configuration DNSConfig
{
Node 'localhost'
{
WindowsFeature DNS
{
Ensure = 'Present'
Name = 'DNS'
}
# plus some more stuff
}
}
CONTENT
}
我想自动化编译,所以我尝试了:
resource "azurerm_automation_dsc_nodeconfiguration" "node" {
automation_account_name = "my_aa_account"
resource_group_name = "my_rg"
name = "DNSConfig.localhost"
content_embedded = "# what goes here?"
}
问题
我没有很强的背景知识,所以不确定我是否正确理解了它。我不知道content_embedded 的nodeconfiguration 应该包含什么。
我应该从dsc_configuration 中删除Node 块并将其移动到dsc_nodeconfiguration 中吗?或者可能是节点块的 contents(即不包括 Node 'localhost' {} 包装器)?
(我不确定“localhost”是否是节点所代表的好名称)。
例如:
resource "azurerm_automation_dsc_nodeconfiguration" "node" {
content_embedded = "Node 'localhost' { WindowsFeature DNS {...} }"
...
}
或
resource "azurerm_automation_dsc_nodeconfiguration" "node" {
content_embedded = "WindowsFeature DNS {...}"`
...
}
还是别的什么?
我觉得我已经尝试了其中的一些选项,但反馈循环很慢,所以我有可能在调试时找到了正确的答案并被另一个错误绊倒了!
有没有人有一个可行的例子,或者可以解释它是如何工作的?
【问题讨论】:
-
自从遇到this Github issue。也许我想做的事情还不可能。