我正在使用Terraform在Azure上配置资源。它抱怨密码不符合密码策略。我虽然var文件可能给出了一些错误,但是即使我在命令行上通过密码也给出了错误。
在 terraform.tfvars 中,如下所示:
password="Hash#Dollar$135"
在命令行上用于 terrain plan 命令,如下所示:
terraform plan -var 'password=Hash#Dollar$135' -out main.plan
以下错误消息:
azurerm_virtual_machine.tf-vm-cluster-app[4]: 1 error(s) occurred:
azurerm_virtual_machine.tf-vm-cluster-app.4: compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The supplied password must be between 8-123 characters long and must satisfy at least 3 of password complexity requirements from the following: \r\n1) Contains an uppercase character\r\n2) Contains a lowercase character\r\n3) Contains a numeric digit\r\n4) Contains a special character\r\n5) Control characters are not allowed" Target="adminPassword"
即使在调试模式下,它也不会告诉我哪个字符错误或应使用哪个字符。一个示例会更好。
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: {
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: "error": {
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: "code": "InvalidParameter",
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: "message": "The supplied password must be between 8-123 characters long and must satisfy at least 3 of password complexity requirements from the following: \r\n1) Contains an uppercase character\r\n2) Contains a lowercase character\r\n3) Contains a numeric digit\r\n4) Contains a special character\r\n5) Control characters are not allowed",
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: "target": "adminPassword"
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: }
2019-02-22T11:45:11.077+1100 [DEBUG] plugin.terraform-provider-azurerm_v1.22.1_x4: }
我的第二个问题是,有什么办法可以看到密码值设置为什么值?
我执行了 terraform show ,但看不到它要设置为什么值。
答案 0 :(得分:0)
删除此问题。我忘了在main.tf文件中的变量中使用$。愚蠢的错误。