Skip to content

Conversation

@duckpuppy
Copy link
Contributor

Fixes issue #347: Create TerraformOutputOnlyPlugin to provide the option of producing the current Terraform state outputs, skipping terraform plan and terraform apply

@duckpuppy
Copy link
Contributor Author

Forgot to mark this as a draft. Haven't committed tests yet.

@codecov-io
Copy link

codecov-io commented Feb 24, 2021

Codecov Report

Merging #348 (f49686e) into master (21188a3) will increase coverage by 0.12%.
The diff coverage is 84.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #348      +/-   ##
==========================================
+ Coverage   80.04%   80.17%   +0.12%     
==========================================
  Files          44       46       +2     
  Lines        1208     1256      +48     
  Branches      283      292       +9     
==========================================
+ Hits          967     1007      +40     
- Misses         95      101       +6     
- Partials      146      148       +2     
Impacted Files Coverage Δ
src/TerraformOutputOnlyPlugin.groovy 81.81% <81.81%> (ø)
src/TerraformOutputCommand.groovy 84.61% <84.61%> (ø)
src/PassPlanFilePlugin.groovy 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21188a3...f49686e. Read the comment docs.

@duckpuppy
Copy link
Contributor Author

OK, this is not WIP anymore.

stage.decorate(PLAN, stashPlan(stage.getEnvironment()))
stage.decorate(APPLY, unstashPlan(stage.getEnvironment()))
stage.decorate(PLAN_COMMAND, stashPlan(stage.getEnvironment()))
stage.decorate(APPLY_COMMAND, unstashPlan(stage.getEnvironment()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify why the stash/unstash needed to be narrowed in this way? How is it related to outputting?

Copy link
Contributor Author

@duckpuppy duckpuppy Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything regarding a plan file is dependent only on the execution of the plan and apply commands. In my case, I wanted to skip the PLAN_COMMAND itself while still executing the PLAN stage (I need the INIT). With the above plugin bound to the entire PLAN phase, it's still going to execute even in the absence of the plan command executing and try to stash a non-existent plan file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Thanks for the clarification.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking to Issue #152, since it touches on the concern about decorating being overly specific.

Copy link
Collaborator

@kmanning kmanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall.

@kmanning kmanning added this to the v5.16 milestone Feb 26, 2021
@kmanning
Copy link
Collaborator

kmanning commented Mar 1, 2021

Updates look good, thanks! :shipit:

@duckpuppy duckpuppy force-pushed the add_terraform_outputs branch from 3392f65 to 8922c68 Compare March 1, 2021 16:32
@duckpuppy duckpuppy merged commit a7a02dd into manheim:master Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TerraformOutputOnlyPlugin: Add new plugin to limit the pipeline to terraform output only.

3 participants