I am trying to run offset AZ cli commands in Terraform apart of my AKS cluster infrastructure to automate the tedious tasks. One of those being running the az vmsss extention set
command to add certs to each node. To do this, I am using a null resource with a local exec provisioner. This is the AZ cli command I am using.
The part of the command that I would like to leverage and what Terraform does not like is the '{"commandToExecute":...}'
with a curl.
Example of what I would like to do:
resource "null_resource" "test" {
provisioner "local-exec" {
command = "az vmss extension set --vmss-name my-vmss --name customScript --resource-group my-group version 2.0 --publisher Microsoft.Azure.Extensions provision-after-extensions NetworkWatcherAgentLinux VMAccessForLinux settings '{"commandToExecute": "echo testing"}'"
}
}
Result:
Error: Missing newline after argument
on test.tf line 3, in resource "null_resource" "test":
3: command = "az vmss extension set --vmss-name my-vmss --name customScript --resource-group my-group version 2.0 --publisher Microsoft.Azure.Extensions provision-after-extensions NetworkWatcherAgentLinux VMAccessForLinux settings '{"commandToExecute": "echo testing"}'"
An argument definition must end with a newline.
Are there any known workarounds to be able to run more complex commands using the local-exec provisioner?
Terraform version: 0.13
EOT
or-EOT
includes your comments. Take a look at terraform.io/docs/configuration/… – Nancy Xiong