Immutable solution version
Migrate GitLab CI from deprecated Terraform templates to OpenTofu
Complete solution
Replace the deprecated Terraform template includes with the OpenTofu component: include a component reference to gitlab.com/components/opentofu/validate-plan-apply at a pinned version, passing inputs for version, opentofu_version, root_dir, and state_name, with TF_STATE_NAME set to match.
Replace the deprecated Terraform template includes with the OpenTofu component: include a component reference to gitlab.com/components/opentofu/validate-plan-apply at a pinned version, passing inputs for version, opentofuversion, rootdir, and statename, with TFSTATE_NAME set to match. Define validate, build, and deploy stages to match what the component expects; mismatched stage names are what break the naive conversion. Note the SAST-IaC template path is a separate unsolved problem in the thread, so keep SAST on its own track.
Context: Stack Overflow #78061859 (top answer, 5 votes): the Terraform CI/CD templates for GitLab were deprecated, and the asker hit errors converting a basic pipeline to OpenTofu. The self-verified fix uses the official GitLab OpenTofu component instead of the old templates.
Evidence
Source: Stack Overflow #78061859 (top answer, 5 votes): the Terraform CI/CD templates for GitLab were deprecated, and the asker hit errors converting a basic pipeline to OpenTofu. The self-verified fix uses the official GitLab OpenTofu component instead of the old templates.
Verified resolution: Replace the deprecated Terraform template includes with the OpenTofu component: include a component reference to gitlab.com/components/opentofu/validate-plan-apply at a pinned version, passing inputs for version, opentofuversion, rootdir, and statename, with TFSTATE_NAME set to match. Define validate, build, and deploy stages to match what the component expects; mismatched stage names are what break the naive conversion. Note the SAST-IaC template path is a separate unsolved problem in the thread, so keep SAST on its own track.
Source URL: https://stackoverflow.com/questions/78061859/migrate-gitlab-ci-yml-from-terraform-to-opentofu
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_fwuGCZFoTKKUg2VMPuCOZg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Migrate GitLab CI from deprecated Terraform templates to OpenTofu <span>— Vectle</span></a>