Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show terraform plan output in with --diff option #54866

wants to merge 4 commits into
base: devel


None yet
3 participants
Copy link

dragosboca commented Apr 4, 2019


Currently there is no easy way to display the plan generated by terraform. This PR will display the plan when --diff option is used. This kind of makes sense because the terraform plan will show what changes are about to be applied to the infrastructure. Also it is critical in many situations to review the plan before applying it (this can be achieved with a combination of --check and --diff options)

  • Feature Pull Request



Dragos Boca added some commits Apr 4, 2019


This comment has been minimized.

Copy link

ansibot commented Apr 4, 2019

Dragos Boca added some commits Apr 4, 2019

Dragos Boca
Dragos Boca
@@ -389,7 +390,11 @@ def main():
if state == 'absent' and workspace != 'default' and purge_workspace is True:
remove_workspace(command[0], project_path, workspace)

module.exit_json(changed=changed, state=state, workspace=workspace, outputs=outputs, stdout=out, stderr=err, command=' '.join(command))
if module.check_mode:
changed = needs_application

This comment has been minimized.

Copy link

resmo Apr 10, 2019


can you explain, why these 2 lines?

This comment has been minimized.

Copy link

dragosboca Apr 11, 2019


Looks like ansible won't display the diff output unless the module report changes so if the plan is not clean (0 resources added, deleted or changed) we set changed to true (actually directly to needs_application that is set by build_plan based on the return code of terraform plan but with the same effect). This is used with --diff in conjunction with --check (edit wording)

Copy link

resmo left a comment


@ansibot ansibot removed the needs_triage label Apr 10, 2019

@ansibot ansibot added the stale_ci label Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.