terraform-provider-shell icon indicating copy to clipboard operation
terraform-provider-shell copied to clipboard

Windows, Double Quotes, Interpreter and Curl

Open acalbazana opened this issue 4 years ago • 0 comments

Hello,

Thanks for the provider. I'd like to see if there is a way around the escaping of double-quotes. When I run a curl command under windows (cmd interpreter), the interpreter escapes double-quotes during script evaluation and confuses curl. I suspect that this isn't the provider's doing, but I'm looking for guidance if anyone has experienced the same and got around it.

Example .bat file contains:

curl --header "Authorization:Bearer %TOKEN%"

However, the following wants to execute after evaluation:

curl --header "Authorization:Bearer %TOKEN% " ...

which causes curl to become confused on how to view the command (at least on windows).

I have a workaround where I put the full header (double quotes and all) in the environment/secured-environment block and then use it in my script. Example:

environment = { TOKEN = ""Authorization: Bearer ..."" }

Then in script:

curl --header %TOKEN%

which expands the entire header argument properly, without escaping double-quotes when its finally evaluated by the command interpreter.

Anyway... Looking for ideas.

Thanks!

Alejandro

acalbazana avatar Jun 24 '21 05:06 acalbazana