Skip to content
Snippets Groups Projects
Select Git revision
  • main default
  • publish-policy-bundle
  • go-refactoring
  • detect-drift
  • drift-fetch
  • full-pipeline-mr-plan-post
  • opa-policy-enforcement
  • fix-mr-fetch-plan-show
  • mr-comment-support
  • remove-deprecated-variables
  • release-with-correct-version-input-default
  • bump-release-cli
  • id-tokens-support
  • manual-apply-by-default
  • auto-setup-backend
  • destroy-with-delete-state
  • var-file
  • only-sign-on-gitlabcom
  • image-digest
  • debian-slim
  • 2.6.1
  • 2.6.0
  • 2.6.0-rc1
  • 2.5.0
  • 2.5.0-rc5
  • 2.5.0-rc2
  • 2.5.0-rc1
  • 2.4.0
  • 2.3.0
  • 2.2.0
  • 2.1.1
  • 2.1.0
  • 2.0.0
  • 2.0.0-rc1
  • 1.1.0
  • 1.0.1
  • 1.0.0
  • 0.58.0
  • 0.57.0
  • 0.56.0
40 results

opentofu

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Timo Furrer authored
    Remove unneccessary variables in backports
    
    See merge request components/opentofu!6
    04340dc1
    History

    OpenTofu CI/CD Component

    🚨 🚧 NOTE 🚧 🚨

    This component is work in progress, where inputs, template names and the entire interface in general may change at any time until version 1.0.0 is reached. From where on this CI/CD component will be versioned using semver 2.0. The progress of implementing such a version can be tracked in https://gitlab.com/groups/gitlab-org/-/epics/12401.

    The src/gitlab-tofu.sh script is still merely a copy from gitlab-terraform. Therefore, lots of things in this script and in the templates are still Terraform-related and haven't been changed to their OpenTofu equivalents.

    This project is home to the OpenTofu CI/CD component and it's related assets, like the gitlab-tofu wrapper script and OCI images containing that script together with an OpenTofu version.

    Read more:

    Note: Please make sure to use a released version of this CI/CD component. You find all releases on the Releases Overview Page.

    Usage

    include:
      - component: gitlab.com/components/opentofu/full-pipeline@<VERSION>
        inputs:
          # The version must currently be specified explicitly as an input,
          # to find the correctly associated images. # This can be removed
          # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
          version: <VERSION>
          opentofu_version: <OPENTOFU_VERSION>
    
    stages: [validate, test, build, deploy, cleanup]

    A concrete example may look like this:

    # Using `latest`
    include:
      - component: gitlab.com/components/opentofu/full-pipeline@~latest
        inputs:
          # The version must currently be specified explicitly as an input,
          # to find the correctly associated images. # This can be removed
          # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
          version: latest
          opentofu_version: 1.6.0
    
    stages: [validate, test, build, deploy, cleanup]
    
    ---
    
    # ... or using `0.0.0-alpha1`:
    include:
      - component: gitlab.com/components/opentofu/full-pipeline@0.0.0-alpha1
        inputs:
          # The version must currently be specified explicitly as an input,
          # to find the correctly associated images. # This can be removed
          # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
          version: 0.0.0-alpha1
          opentofu_version: 1.6.0
    
    stages: [validate, test, build, deploy, cleanup]

    Instead of including the full-pipeline, it's also possible to include individual jobs and compose your own pipeline, for example, to just run the fmt job you can do:

    include:
      - component: gitlab.com/components/opentofu/fmt@latest
        inputs:
          # The version must currently be specified explicitly as an input,
          # to find the correctly associated images. # This can be removed
          # once https://gitlab.com/gitlab-org/gitlab/-/issues/438275 is solved.
          version: latest
          opentofu_version: 1.6.0
          root_dir: tofu/

    Have a look at the full-pipeline for how it's constructed.

    The following job components exist:

    Have a look at the individual template spec to learn about the available inputs.

    Inputs

    Name Default Description
    stage_validate validate Defines the validate stage. This stage includes the fmt and validate jobs.
    stage_build build Defines the build stage. This stage includes the plan job.
    stage_deploy deploy Defines the deploy stage. This stage includes the apply job.
    stage_cleanup cleanup Defines the cleanup stage. This stage includes the destroy and delete-state jobs.
    version latest Version of this component. Has to be the same as the one in the component include entry.
    opentofu_version 1.6.0 OpenTofu version that should be used. Must be one of 1.6.0, 1.6.0-rc1.
    root_dir ${CI_PROJECT_DIR} Root directory for the OpenTofu project.
    state_name default Remote OpenTofu state name.
    auto_apply false Whether the apply job is manual or automatically run.
    auto_destroy false Whether the destroy job is manual or automatically run.
    create_destroy_job false Wheather the destroy job should be created or not.
    create_delete_state_job false Wheather the delete-state job should be created or not.

    Available OpenTofu Versions

    The following OpenTofu versions are available with this component via the opentofu_version input:

    Releases & Versioning

    This project currently releases tagged commits. An overview of releases can be found on the Releases page.

    Each release is accessible in the CI/CD Catalog.

    Component Versions

    The component release versions follow Semantic Versioning 2.0.0.

    Image Versions

    This project releases multiple OCI image variants that can be used with the component. The intention is that the images used in a component have the same version and or not mixed. Due to the limitations described in https://gitlab.com/gitlab-org/gitlab/-/issues/438275 it's currently required to provide the component version in the component include field and as the version input. Check out the Usage section for examples.

    Each component release deploys the following images:

    • registry.gitlab.com/components/opentofu/gitlab-opentofu:<VERSION>-opentofu<OPENTOFU_VERSION>
    • registry.gitlab.com/components/opentofu/gitlab-opentofu:<VERSION>-opentofu
      • Includes the latest stable OpenTofu version at the time of releasing the component
    • registry.gitlab.com/components/opentofu/gitlab-opentofu:<VERSION>
      • Includes the latest stable OpenTofu version at the time of releasing the component

    In the above examples <VERSION> references the component version and <OPENTOFU_VERSION> an OpenTofu release, from here.

    Note: unfortunately, these image versions are not SemVer compatible, because - indicates a prerelease (which they are not in this case). However, we cannot use the alternative + which would indicate build metadata as we'd like. See https://github.com/distribution/distribution/issues/1201

    Contributing

    See the CONTRIBUTING.md guide.