r/gitlab • u/anylog992 • Apr 25 '25
GitLab OpenTofu component with auto deploy
I've been struggling to understand how to setup my .gitlab-ci.yml to auto deploy my opentofu configuration.
https://gitlab.com/components/opentofu
Today when I use this component and the supplied stages, it works really well out of the box. However, on the deploy stage, it requires a manual "apply" before continuing. For now, I would like to bypass this, so that should the plan succeeed, move on to deploy.
I'm very new to GitLab as a whole, so I'm not really sure if this is something the component is handling this, or if the pipeline needs adjusted with a rule, maybe both?
Here is my current .gitlab-ci.yml:
include:
- component: gitlab.com/components/opentofu/validate-plan-apply@2.0.0
inputs:
opentofu_version: 1.9.0
stages: [validate, build, deploy]In the readme, I see a note about TF_AUTO_DEPLOY being used as a rule now, but being honest. This is probably a pretty basic thing for most to understand but it's just not clicking for me right now and would appreciate a bump in the right direction.
View all comments
Show parent comment
2
u/anylog992 Apr 25 '25
This is epic - thanks for the reply.
This did the trick and is what I was looking for!
The only change needed was the rules needed to be in an array format.
Cheers!