小编Sha*_*jee的帖子

运行 terraform init、terraform plan 或 apply 时出现无效字符错误

我正在使用 VScode 编辑器运行 Terraform,该编辑器使用 PowerShell 作为默认 shell,当我尝试验证它或通过 VScode、外部 PowerShell 或 CMD 运行 terraform init/plan/apply 时,会出现相同的错误。

\n\n

在我添加虚拟机创建代码之前,代码运行没有任何问题。我已经将 Variables.tf、terraform.tfvars 和下面的主要 Terraform 代码组合在一起。

\n\n

terraform.tfvars

\n\n
web_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"\n
Run Code Online (Sandbox Code Playgroud)\n\n

变量.tf

\n\n
variable "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}\n
Run Code Online (Sandbox Code Playgroud)\n\n

terraform_example.tf

\n\n
# Configure the Azure Provider\nprovider "azurerm" …
Run Code Online (Sandbox Code Playgroud)

automation terraform devops terraform-provider-azure

2
推荐指数
2
解决办法
2万
查看次数