Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/module_utils/terraform_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def show(self, state_or_plan_file_path: str) -> Optional[TerraformShow]:
return TerraformShow.from_json(result)

def validate(self, version: LooseVersion, variables_args: List[str]) -> None:
command = ["validate"]
command = ["validate", "-no-color"]
if version < LooseVersion("0.15.0"):
command += variables_args
self._run(*command, check_rc=True)
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def main() -> None:
for f in variables_files:
variables_args.extend(["-var-file", f])

preflight_validation(terraform, terraform_binary, project_path, checked_version, variables_args)

# only use an existing plan file if we're not in the deprecated "planned" mode
if plan_file and state != "planned":
if not any([os.path.isfile(project_path + "/" + plan_file), os.path.isfile(plan_file)]):
Expand Down Expand Up @@ -586,8 +588,6 @@ def main() -> None:
out = plan_stdout
err = plan_stderr

preflight_validation(terraform, terraform_binary, project_path, checked_version, variables_args)

try:
planned_state = terraform.show(plan_file_to_apply)
if planned_state is not None:
Expand Down