terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~>2.0" } azuread = { source = "hashicorp/azuread" } } } provider "azurerm" { features {} } 创建名为 main.tf 的文件并插入下列代码: Terraform 复制 resource "azurerm_virtual_network" "vnet" { ...
azurerm_virtual_network.my_terraform_network.name }output"subnet_name_1"{ description ="The name of the created subnet 1."value = azurerm_subnet.my_terraform_subnet_1.name }output"subnet_name_2"{ description ="The name of the created subnet 2."value = azurerm_subnet.my_terraform_subnet...
azurerm_virtual_network.onprem-vnet.name address_prefixes = ["192.168.1.128/25"] }resource"azurerm_public_ip""onprem-pip"{ name ="${local.prefix-onprem}-pip"location = azurerm_resource_group.onprem-vnet-rg.location resource_group_name = azurerm_resource_group.onprem-vnet-rg.name ...
使用azurerm_network_interface_security_group_association在网络安全组和网络接口之间创建关联。 使用random_id为唯一存储帐户名称生成随机值。 使用azurerm_storage_account 创建用于启动诊断的存储帐户。 使用azurerm_linux_virtual_machine创建 Linux VM 创建AzAPI 资源azapi_resource。
provider "azurerm" { features {} } provider "random" { } 3、创建名为 main.tf 的文件并插入下列代码: resource "azurerm_resource_group" "qs101" { name = "rg-qs101-eh-rules" location = "westus2" } resource "azurerm_virtual_network" "qs101" { ...
name="NickSubnet"resource_group_name="${azurerm_resource_group.nicktfrg.name}"virtual_network_name="${azurerm_virtual_network.nicktfnetwork.name}"address_prefix="10.0.2.0/24"} 创建公共 IP 地址 如果要通过网络访问 Azure 云端的虚机,需要创建公共的 IP 地址并分配给虚机。下面的配置创建名为 nickPub...
通过azure-cli创建虚拟机 安装azure-cli 我的电脑是MacOS,安装如下: $ brew update-reset $ brew install azure-cli $ which az /usr/local/bin/az $ az version { "azure-cli": "2.44.1", "azure-cli-core": "2.44.1", "azure-cli-telemetry": "1.0.8", ...
azurerm_linux_virtual_machine.demo[2] azurerm_network_interface.demo[0] azurerm_network_interface.demo[1] azurerm_network_interface.demo[2] azurerm_public_ip.demo[0] azurerm_public_ip.demo[1] azurerm_public_ip.demo[2] 通过命令terraform show可以查看资源的详细信息,比如公网的 IP 地址等等。
resource "azurerm_subnet" "infra_subnet" { name = var.subnet_name_DB virtual_network_name = azurerm_virtual_network.vnet.name resource_group_name = azurerm_resource_group.rg.name address_prefix = var.subnet_prefix_DB } 1. 2. 3. ...
azurerm_virtual_network_gateway_connection Terraform Configuration Files resource"azurerm_virtual_network_gateway_connection""connection"{name="cxn-xyz"location=var.locationresource_group_name=var.resource_group_nametype="ExpressRoute"express_route_circuit_id=express_route_circuit_idvirtual_network_gateway_...