我正在使用 VScode 编辑器运行 Terraform,该编辑器使用 PowerShell 作为默认 shell,当我尝试验证它或通过 VScode、外部 PowerShell 或 CMD 运行 terraform init/plan/apply 时,会出现相同的错误。
\n\n在我添加虚拟机创建代码之前,代码运行没有任何问题。我已经将 Variables.tf、terraform.tfvars 和下面的主要 Terraform 代码组合在一起。
\n\nterraform.tfvars
\n\nweb_server_location = "West US 2"\nresource_prefix = "web-server"\nweb_server_address_space = "1.0.0.0/22"\nweb_server_address_prefix = "1.0.1.0/24"\nEnvironment = "Test"\nRun Code Online (Sandbox Code Playgroud)\n\n变量.tf
\n\nvariable "web_server_location" {\n type = string\n}\n\nvariable "resource_prefix" {\n type = string\n}\n\nvariable "web_server_address_space" {\n type = string\n}\n\n#variable for network range\n\nvariable "web_server_address_prefix" {\n type = string\n}\n\n#variable for Environment\nvariable "Environment" {\n type = string\n}\nRun Code Online (Sandbox Code Playgroud)\n\nterraform_example.tf
\n\n# Configure the Azure Provider\nprovider "azurerm" …Run Code Online (Sandbox Code Playgroud)