如何使用 Terraform Azure CAF 部署 Windows VM?
How to deploy a Windows VM with Terraform Azure CAF?
我想使用 Terraform 使用 Azure 云采用框架 (CAF) 部署 Windows VM。 In the example of configuration.tfvars,所有配置都是 done.But 我找不到正确的 terraform 代码来部署这个 tfvars 配置。
windows vm 模块是here.
到目前为止,我已经编写了以下代码:
module "caf_virtual_machine" {
source = "aztfmod/caf/azurerm//modules/compute/virtual_machine"
version = "5.0.0"
# belows are the 7 required variables
base_tags = var.tags
client_config =
global_settings = var.global_settings
location = var.location
resource_group_name = var.resource_group_name
settings =
vnets = var.vnets
}
因此 vnets, global_settings, resource_group_name
变量已经存在于 configuration.tfvars 中。我已将 tags
和 location
变量添加到 configuration.tfvars.
但是我应该在 settings
和 client_config
变量中输入什么?
虚拟机是私有模块。您应该通过调用基础 CAF 模块来使用它。
terraform 注册表的自述文件解释了如何利用核心 CAF 模块 - https://registry.terraform.io/modules/aztfmod/caf/azurerm/latest/submodules/virtual_machine
您有一个展示如何部署虚拟机的配置文件示例库
https://github.com/aztfmod/terraform-azurerm-caf/tree/master/examples/compute/virtual_machine
module "caf" {
source = "aztfmod/caf/azurerm"
version = "5.0.0"
global_settings = var.global_settings
tags = var.tags
resource_groups = var.resource_groups
storage_accounts = var.storage_accounts
keyvaults = var.keyvaults
managed_identities = var.managed_identities
role_mapping = var.role_mapping
diagnostics = {
# Get the diagnostics settings of services to create
diagnostic_log_analytics = var.diagnostic_log_analytics
diagnostic_storage_accounts = var.diagnostic_storage_accounts
}
compute = {
virtual_machines = var.virtual_machines
}
networking = {
vnets = var.vnets
network_security_group_definition = var.network_security_group_definition
public_ip_addresses = var.public_ip_addresses
}
security = {
dynamic_keyvault_secrets = var.dynamic_keyvault_secrets
}
}
注意 - 建议利用源存储库中提供的 VScode devcontainer 来执行 terraform 部署。 devcontainer 包括部署 Azure 解决方案所需的工具。
我想使用 Terraform 使用 Azure 云采用框架 (CAF) 部署 Windows VM。 In the example of configuration.tfvars,所有配置都是 done.But 我找不到正确的 terraform 代码来部署这个 tfvars 配置。
windows vm 模块是here.
到目前为止,我已经编写了以下代码:
module "caf_virtual_machine" {
source = "aztfmod/caf/azurerm//modules/compute/virtual_machine"
version = "5.0.0"
# belows are the 7 required variables
base_tags = var.tags
client_config =
global_settings = var.global_settings
location = var.location
resource_group_name = var.resource_group_name
settings =
vnets = var.vnets
}
因此 vnets, global_settings, resource_group_name
变量已经存在于 configuration.tfvars 中。我已将 tags
和 location
变量添加到 configuration.tfvars.
但是我应该在 settings
和 client_config
变量中输入什么?
虚拟机是私有模块。您应该通过调用基础 CAF 模块来使用它。
terraform 注册表的自述文件解释了如何利用核心 CAF 模块 - https://registry.terraform.io/modules/aztfmod/caf/azurerm/latest/submodules/virtual_machine
您有一个展示如何部署虚拟机的配置文件示例库
https://github.com/aztfmod/terraform-azurerm-caf/tree/master/examples/compute/virtual_machine
module "caf" {
source = "aztfmod/caf/azurerm"
version = "5.0.0"
global_settings = var.global_settings
tags = var.tags
resource_groups = var.resource_groups
storage_accounts = var.storage_accounts
keyvaults = var.keyvaults
managed_identities = var.managed_identities
role_mapping = var.role_mapping
diagnostics = {
# Get the diagnostics settings of services to create
diagnostic_log_analytics = var.diagnostic_log_analytics
diagnostic_storage_accounts = var.diagnostic_storage_accounts
}
compute = {
virtual_machines = var.virtual_machines
}
networking = {
vnets = var.vnets
network_security_group_definition = var.network_security_group_definition
public_ip_addresses = var.public_ip_addresses
}
security = {
dynamic_keyvault_secrets = var.dynamic_keyvault_secrets
}
}
注意 - 建议利用源存储库中提供的 VScode devcontainer 来执行 terraform 部署。 devcontainer 包括部署 Azure 解决方案所需的工具。