Don't Validate if we have an execution plan

The plan file should contain all data required to execute the apply
operation. Validation requires interpolation, and the `file()`
interpolation function may fail if the module files are not present.
This is the case currently with how TFE executes plans.
This commit is contained in:
James Bardin 2017-03-27 17:11:26 -04:00
parent 3e8a8c5e23
commit 8027fe9e08
1 changed files with 5 additions and 1 deletions

View File

@ -104,9 +104,13 @@ func (m *Meta) Backend(opts *BackendOpts) (backend.Enhanced, error) {
StateBackupPath: m.backupPath,
ContextOpts: m.contextOpts(),
Input: m.Input(),
Validation: true,
}
// Don't validate if we have a plan. Validation is normally harmless here,
// but validation requires interpolation, and `file()` function calls may
// not have the original files in the current execution context.
cliOpts.Validation = opts.Plan == nil
// If the backend supports CLI initialization, do it.
if cli, ok := b.(backend.CLI); ok {
if err := cli.CLIInit(cliOpts); err != nil {