Api call using TFE enterprise and TFE 0.13

I have a working curl command which I am trying to convert to a local exec command.
My curl statement looks like this -

curl --insecure -X POST ‘https://url/GetNextHostName’ --header ‘Content-Type: application/json’ --header ‘Authorization: Basic somekey’ -d ‘{“key1”: “value1”}’

The interesting thing here is we are posting some values to get the hostname from our CMDB, that’s how our CMDB API is built.

I tried running this command on our linux machine where terraform enterprise is hosted and this curl command returns the hostname as the output

continuing …

I wanted to do this using a local-exec, my initial thoughts were

  1. get this same command to work inside a null provider, local exec , command property. I have an assumption that once we execute the command property, the curl result with the hostname will be stored in null_resource.get-hostname.command property. I do not know if this will work. Can the command property hold results from command execution and can it be sent out as an output variable

  2. Also I face an issue when we try to have “” within the command property

My code looks like below

resource “null_resource” “get-hostname” {

provisioner "local-exec" {
    command = "curl --insecure -X POST 'https://url/GetNextHostName' --header 'Content-Type: application/json' --header 'Authorization: Basic blah' -d '{"key1": "value1"}'"


when I execute this terraform says it expects a newline the end of the argument.

Any ideas on how to circumvent my problem would be helpful