-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Add pre-apply hook and a pre-plan hook for custom scripts to be ran prior to terraform commands #32930
Comments
Hello @hajali-amine, Ideally, these hooks It's something like the single responsibility principle. Terraform is responsible for running your infrastructure resource configurations. I think , if both the things are merged together, then we could end up in scenarios where an error in hook One workaround, that can be achieved is by using a I guess this is probably not the answer you were looking for 😞 , hopefully, someone from the team can enlighten further. Thanks |
Hello @sushant-kapoor17,
But yes, if this is not possible, a |
Terragrunt has this feature - https://terragrunt.gruntwork.io/docs/features/hooks/ |
Hey folks, actually it may help with When I want to use values of data source for |
Terraform Version
Use Cases
A simple example is to only allow people to apply changes when their local branch is not behind the remote branch.
Having something like this will help.
When I run
terraform plan
, it will runif [[ -n $(git pull --dry-run 2>&1 > /dev/null) ]] ; then exit 1 ; fi
.If the status code is 0, it will start the plan. If it's different than 0 terraform will stop everything!
This is a small use case.
Attempted Solutions
Couldn't find a way to surpass this.
Proposal
I think of it as something like this!
it can also be a block if there are more options!
References
No response
The text was updated successfully, but these errors were encountered: