Terraform: Discrepency between local-exec and remote-exec

Created on 2 Dec 2018  路  3Comments  路  Source: hashicorp/terraform

Current Terraform Version

Terraform v0.11.10

Issue

Currently, if you wish to execute multiple commands locally, you have two options.

  1. Use the awful multiline syntax in local-exec's command variable:
command = <<EOT
    command_one --flag ;
    command_two --flag
EOT
  1. Use multiple local-exec provisioners.

Why is this so different from remote-exec's implementation, when the two provisioners should share a large amount of functionality (this included)?

Remote-exec's version:

inline = [
    "command_one --flag",
    "command_two --flag"
]

Also... inline? Is that truly the best name for this field?

Proposal

Change local-exec's command variable to accept an array of commands to execute.
Change remote-exec's inline variable name to make more sense. commands, perhaps?

provisionelocal-exec

Most helpful comment

I agree with @commonbreed. I'd +1 to having local-exec take an array of commands to run as input

All 3 comments

it would be nice if remote exec allowed at least the same multiline format like you say -

command = <<EOT
    command_one --flag ;
    command_two --flag
EOT

it would be nice if remote exec allowed at least the same multiline format like you say -

command = <<EOT
    command_one --flag ;
    command_two --flag
EOT

I think that would definitely be a step in the wrong direction. remote-exec's implementation of accepting an array of commands would be preferred, and the multi-line syntax is despicable.

I agree with @commonbreed. I'd +1 to having local-exec take an array of commands to run as input

Was this page helpful?
0 / 5 - 0 ratings