JaydenMaalouf / azure-pipelines-terraform-output

MIT License
4 stars 2 forks source link

Azure Pipelines - Terraform Output

A small plugin that brings a Terraform Plan window into the pipeline and release results
The plugin is available on the Visual Studio Marketplace here

Usage

Simply call the Terraform Output task with the appropriate inputs

- task: TerraformOutput@1
  inputs:
    outputFilePath: example.tfplan
    artifactName: Staging

If you have multiple output files, you can use glob pattern matching to pickup all outputs

- task: TerraformOutput@1
  inputs:
    useGlobPattern: true

Inputs

The following inputs are available to override

Input Type Default Description
useGlobPattern boolean false Whether to use a search pattern to find output files
outputFilePattern string **/*.tfplan File pattern used to find output files (only visible if useGlobPattern is true)
searchDirectory string $(System.DefaultWorkingDirectory) Directory the file search should start (only visible if useGlobPattern is true)
inferArtifactName boolean false Infer artifact name from outputFilePath filename (only visible if useGlobPattern is false)
outputFilePath filePath $(System.DefaultWorkingDirectory)/output.tfplan File path of the outfile file (only visible if useGlobPattern is false)
artifactName string Artifact name used in the dropdown (only visible if useGlobPattern and inferArtifactName are false)

Results

A new tab will be available in the results view

Pipelines Releases
image image

Select your output file

In the Terraform Plan tab, your associated Terraform Output artifacts will appear in the dropdown box
The dropdown box is unique to each build, so it won't show previous build artifacts
image

Once you have selected your state file, it will show your plan output image