terraform-github-actions
terraform-github-actions copied to clipboard
Consider support for Forgejo
Suggestion
Background
Currently the apply and plan actions work really well in frogejo but the issue comment python code is github specific which fails (as expected)
Would it be possible to detect if it's being run in forgejo and have seperate logic to push a comment to forgejo?
This is not critical just a nice to have as the actions themselves still work there's just no user feedback.
If anyone is interested in how I'm doing it at the moment:
plan.yaml
- name: terraform plan
uses: https://github.com/dflook/terraform-plan@v1
with:
path: terraform
add_github_comment: false
Note add_github_comment: false this is so it doesn't fail when it tries to add a comment to the PR. The plan is still available in the action history.
apply.yaml
- name: terraform apply
uses: https://github.com/dflook/terraform-apply@v1
with:
path: terraform
auto_approve: true
Note auto_approve: true this is because the plan action doesn't pass through the plan output so you have to run it again. I wouldn't run this is production though as you can't 100% guarantee what you see in the plan action is what you get in the apply (it's 99% though).
I wonder if a flag like add_forgejo_comment would be help to seperate the logic between github/forgejo api?
With the plan not passing through between plan and apply actions I've not had enough time to dig into how it's working.
This is enough to make me confident enough to move all my TF from Github to my own ForgeJo instance.