Codefresh Example
Closed this issue · 3 comments
Howdy,
I use codefresh and thought I would post an example here and if you think it's useful, I can open a PR
The below makes the assumption that you have already done a terraform init etc, and are logged in to your cloud provider of choice.
I have had to use the output to json as the tfplan
file was not being picked up, and also allows you to use the output.json
in other places as we only create it once.
version: "1.0"
stages:
- "plan"
- "summarize"
TerraformPlan:
image: hashicorp/terraform:1.3.8
title: Terraform Plan
stage: plan
working_directory: "${{clone}}/"
commands:
- terraform plan -out=tfplan
- terraform show -json tfplan > output.json
tfSummarize:
image: europe-west2-docker.pkg.dev/<>/devops/tf-summarize:latest
title: Show Changes
stage: summarize
working_directory: "${{clone}}"
commands:
- tf-summarize output.json
Let me know if you want a PR opened for this, as I think showing how it can be used in CI would be awesome.
Hi @userbradley Thanks for using this tool and the suggestion on the Codefresh CI example.
There is already an example using github actions here. For other CI, it should be very similar to this. Do you agree with me ?
If it is very similar, I think one example should be good enough.
I would agree, how ever we had to a little trick on the json output otherwise in CI it would not work.
I think it would still be worthwhile adding it. I am happy to support users who use codefresh in troubleshooting
Sure then, please help in creating a PR with sample file and we can link to readme example section.