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

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

Closed
duckpuppy opened this issue Feb 24, 2021 · 0 comments · Fixed by #348
Closed
Labels
enhancement New feature or request
Milestone

Comments

@duckpuppy
Copy link
Contributor

As a user, I would like a way to instruct the pipeline to simply show the outputs existing in the current state without running a new plan or apply.

This new plugin provides the ability to perform the above by providing a set of job parameters that control this behavior.


TerraformOutputOnlyPlugin

Enable this plugin to change pipeline functionality. This plugin will skip the plan and apply stages and add three new job parameters.

  • SHOW_OUTPUTS_ONLY: This configures the job to skip execution of the plan and apply terraform commands. The job will perform the INIT stage and immediately perform terraform output. Unless this option is checked, the following options will have no effect.
  • JSON_FORMAT_OUTPUTS: This will instruct the plugin to display the output in JSON format.
  • REDIRECT_OUTPUTS_TO_FILE: Text entered into this option will be used to redirect the result of terraform output to a file in the current workspace. The filename should be relative to the workspace, and directories will NOT be created so they should exist beforehand.
// Jenkinsfile
@Library(['terraform-pipeline@v3.10']) _

Jenkinsfile.init(this, env)

// This enables the "output only" functionality
// Note that the functionality will NOT be applied unless the `SHOW_OUTPUTS_ONLY` option is `true`.
TerraformOutputOnlyPlugin.init()

def validate = new TerraformValidateStage()

def destroyQa = new TerraformEnvironmentStage('qa')
def destroyUat = new TerraformEnvironmentStage('uat')
def destroyProd = new TerraformEnvironmentStage('prod')

validate.then(destroyQa)
        .then(destroyUat)
        .then(destroyProd)
        .build()
@kmanning kmanning added this to the v5.16 milestone Feb 26, 2021
@kmanning kmanning added the enhancement New feature or request label Feb 26, 2021
@kmanning kmanning linked a pull request Mar 1, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants