我正在尝试使用资源azurerm_virtual_machine的custom_data字段,但是却陷入了这个错误。知道我错过了什么或是错误的用法吗?
dialog
〜> terraform apply -var-file = azure.tfvars
错误:azurerm_virtual_machine.csrVM ::无效或未知密钥:custom_data
〜> terraform -v Terraform v0.11.3 + provider.azurerm v1.1.1
答案 0 :(得分:1)
我从未使用过terraform,但是查看resource definition您需要创建一个os_profile节点并在其中放置custom_data。
os_profile支持以下内容:
computer_name - (Required) Specifies the name of the virtual machine.
admin_username - (Required) Specifies the name of the administrator account.
admin_password - (Required for Windows, Optional for Linux) Specifies the password of the administrator account.
custom_data - (Optional) Specifies custom data to supply to the machine. On linux-based systems, this can be used as a cloud-init script. On other systems, this will be copied as a file on disk. Internally, Terraform will base64 encode this value before sending it to the API. The maximum length of the binary array is 65535 bytes.