From 2f910ddfc94a10b5d6d53d153e47fad4a0463eb7 Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Tue, 6 Feb 2024 11:58:28 +0100
Subject: [PATCH] Support input for the image name

---
 .gitlab/README.md.template        | 20 ++++++++++++++++++++
 Makefile                          |  1 +
 README.md                         | 22 ++++++++++++++++++++++
 templates/apply.yml               |  7 ++++++-
 templates/destroy.yml             |  7 ++++++-
 templates/fmt.yml                 |  7 ++++++-
 templates/full-pipeline.yml       | 10 ++++++++++
 templates/job-templates.yml       | 10 ++++++++++
 templates/plan.yml                |  7 ++++++-
 templates/validate-plan-apply.yml |  9 +++++++++
 templates/validate-plan.yml       |  8 ++++++++
 templates/validate.yml            |  7 ++++++-
 12 files changed, 110 insertions(+), 5 deletions(-)

diff --git a/.gitlab/README.md.template b/.gitlab/README.md.template
index 5306016..e119f75 100644
--- a/.gitlab/README.md.template
+++ b/.gitlab/README.md.template
@@ -238,6 +238,9 @@ include:
 
 This example assumes your GitLab instance is hosted on `gitlab.example.com` and this component
 project is mirrored in the `components/opentofu` project.
+If the component is being mirrored to another path then `components/opentofu`, then you also
+need to change that path in the `include:component` and additionally provide the correct
+`image_registry_base` input.
 
 ## Migrating from the Terraform CI/CD templates
 
@@ -267,6 +270,23 @@ whereas the Terraform CI/CD templates used [`variables`](https://docs.gitlab.com
 We recommend that you use the `inputs` with the OpenTofu component where available and required.
 However, if needed you may overwrite the jobs and set the `variables` you like.
 
+## Can I use this component with Terraform?
+
+Probably. Although, we don't officially support it or maintain any compatibility layer where necessary.
+
+The OpenTofu CI/CD component job mainly interface with the [`gitlab-tofu`](src/gitlab-tofu.sh) script
+that is distributed with the `gitlab-opentofu` container image used as the base image for the jobs.
+This base image also contains the `tofu` binary.
+
+If you'd want to use Terraform instead you may provide your own container image
+that contains at least a script called `gitlab-tofu` so that it's compatible with the component jobs.
+Everything else in the job can be custom, like replacing `tofu` with `terraform`.
+
+You may provide the `image_registry_base` input to any of the component includes, pointing to the
+container registry URI hosting the container image. The container image name can be configured in
+the `image_name` input. The image has be versioned so that it is compatible
+with [the image versioning of this project](#image-versions).
+
 ## Contributing
 
 See the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
diff --git a/Makefile b/Makefile
index 62a8d4f..5620bef 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,7 @@ backports:
 	
 	@# Common inputs
 	@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.image_registry_base \]\]/$$GITLAB_OPENTOFU_IMAGE_REGISTRY_BASE/'
+	@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.image_name \]\]/gitlab-opentofu/'
 	@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.version \]\]/$$GITLAB_OPENTOFU_VERSION/'
 	@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.opentofu_version \]\]/$$OPENTOFU_VERSION/'
 	@sed -i $(BACKPORTS_BASE_FILE) -e 's/$$\[\[ inputs.root_dir \]\]/$$TF_ROOT/'
diff --git a/README.md b/README.md
index 7fdec3e..50bb932 100644
--- a/README.md
+++ b/README.md
@@ -180,6 +180,8 @@ Have a look at the individual template spec to learn about the available inputs.
 | `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.1` | OpenTofu version that should be used. Must be one of `1.6.1`, `1.6.0`, `1.6.0-rc1`. |
+| `image_registry_base` | `$CI_REGISTRY/components/opentofu` | Host URI to the job images. Will be combined with `image_name` to construct the actual image URI. |
+| `image_name` | `gitlab-opentofu` | Image name for the job images. Hosted under `image_registry_base`. |
 | `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. |
@@ -257,6 +259,9 @@ include:
 
 This example assumes your GitLab instance is hosted on `gitlab.example.com` and this component
 project is mirrored in the `components/opentofu` project.
+If the component is being mirrored to another path then `components/opentofu`, then you also
+need to change that path in the `include:component` and additionally provide the correct
+`image_registry_base` input.
 
 ## Migrating from the Terraform CI/CD templates
 
@@ -286,6 +291,23 @@ whereas the Terraform CI/CD templates used [`variables`](https://docs.gitlab.com
 We recommend that you use the `inputs` with the OpenTofu component where available and required.
 However, if needed you may overwrite the jobs and set the `variables` you like.
 
+## Can I use this component with Terraform?
+
+Probably. Although, we don't officially support it or maintain any compatibility layer where necessary.
+
+The OpenTofu CI/CD component job mainly interface with the [`gitlab-tofu`](src/gitlab-tofu.sh) script
+that is distributed with the `gitlab-opentofu` container image used as the base image for the jobs.
+This base image also contains the `tofu` binary.
+
+If you'd want to use Terraform instead you may provide your own container image
+that contains at least a script called `gitlab-tofu` so that it's compatible with the component jobs.
+Everything else in the job can be custom, like replacing `tofu` with `terraform`.
+
+You may provide the `image_registry_base` input to any of the component includes, pointing to the
+container registry URI hosting the container image. The container image name can be configured in
+the `image_name` input. The image has be versioned so that it is compatible
+with [the image versioning of this project](#image-versions).
+
 ## Contributing
 
 See the [CONTRIBUTING.md](CONTRIBUTING.md) guide.
diff --git a/templates/apply.yml b/templates/apply.yml
index ae0de41..9896c11 100644
--- a/templates/apply.yml
+++ b/templates/apply.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -68,6 +73,6 @@ spec:
     TF_ROOT: $[[ inputs.root_dir ]]
     TF_STATE_NAME: $[[ inputs.state_name ]]
   image:
-    name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
+    name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
     - gitlab-tofu apply
diff --git a/templates/destroy.yml b/templates/destroy.yml
index a14695b..95c49a3 100644
--- a/templates/destroy.yml
+++ b/templates/destroy.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -67,6 +72,6 @@ spec:
     TF_ROOT: $[[ inputs.root_dir ]]
     TF_STATE_NAME: $[[ inputs.state_name ]]
   image:
-    name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
+    name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
     - gitlab-tofu destroy
diff --git a/templates/fmt.yml b/templates/fmt.yml
index 3f48faa..01bf85d 100644
--- a/templates/fmt.yml
+++ b/templates/fmt.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -67,6 +72,6 @@ spec:
     __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
     TF_ROOT: $[[ inputs.root_dir ]]
   image:
-    name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
+    name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
     - gitlab-tofu fmt
diff --git a/templates/full-pipeline.yml b/templates/full-pipeline.yml
index 8c9a833..cebc9dc 100644
--- a/templates/full-pipeline.yml
+++ b/templates/full-pipeline.yml
@@ -33,6 +33,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -41,6 +42,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -65,6 +70,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
   - local: '/templates/validate.yml'
     inputs:
@@ -73,6 +79,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/plan.yml'
@@ -82,6 +89,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/apply.yml'
@@ -91,6 +99,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
       auto_apply: $[[ inputs.auto_apply ]]
@@ -101,6 +110,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
       auto_destroy: $[[ inputs.auto_destroy ]]
diff --git a/templates/job-templates.yml b/templates/job-templates.yml
index 5a2b17c..b67f9fb 100644
--- a/templates/job-templates.yml
+++ b/templates/job-templates.yml
@@ -33,6 +33,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -41,6 +42,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     job_name_prefix:
       default: '.opentofu:'
@@ -68,6 +73,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
   - local: '/templates/validate.yml'
     inputs:
@@ -76,6 +82,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/plan.yml'
@@ -85,6 +92,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/apply.yml'
@@ -94,6 +102,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
       auto_apply: $[[ inputs.auto_apply ]]
@@ -104,6 +113,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
       auto_destroy: $[[ inputs.auto_destroy ]]
diff --git a/templates/plan.yml b/templates/plan.yml
index 0e3e413..5f8aea3 100644
--- a/templates/plan.yml
+++ b/templates/plan.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -78,7 +83,7 @@ spec:
     TF_ROOT: $[[ inputs.root_dir ]]
     TF_STATE_NAME: $[[ inputs.state_name ]]
   image:
-    name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
+    name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
     - gitlab-tofu plan
     - gitlab-tofu plan-json
diff --git a/templates/validate-plan-apply.yml b/templates/validate-plan-apply.yml
index 7a2c735..f37014c 100644
--- a/templates/validate-plan-apply.yml
+++ b/templates/validate-plan-apply.yml
@@ -30,6 +30,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -38,6 +39,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -59,6 +64,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
   - local: '/templates/validate.yml'
     inputs:
@@ -67,6 +73,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/plan.yml'
@@ -76,6 +83,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/apply.yml'
@@ -85,6 +93,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
       auto_apply: $[[ inputs.auto_apply ]]
diff --git a/templates/validate-plan.yml b/templates/validate-plan.yml
index 5d9560b..d3274eb 100644
--- a/templates/validate-plan.yml
+++ b/templates/validate-plan.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -53,6 +58,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
   - local: '/templates/validate.yml'
     inputs:
@@ -61,6 +67,7 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
   - local: '/templates/plan.yml'
@@ -70,5 +77,6 @@ include:
       version: $[[ inputs.version ]]
       opentofu_version: $[[ inputs.opentofu_version ]]
       image_registry_base: $[[ inputs.image_registry_base ]]
+      image_name: $[[ inputs.image_name ]]
       root_dir: $[[ inputs.root_dir ]]
       state_name: $[[ inputs.state_name ]]
diff --git a/templates/validate.yml b/templates/validate.yml
index 0dc8e3d..75558a8 100644
--- a/templates/validate.yml
+++ b/templates/validate.yml
@@ -27,6 +27,7 @@ spec:
     # Images
     image_registry_base:
       default: '$CI_REGISTRY/components/opentofu'
+      description: 'Host URI to the job images. Will be combined with `image_name` to construct the actual image URI.'
     # FIXME: not yet possible because of https://gitlab.com/gitlab-org/gitlab/-/issues/438722
     # gitlab_opentofu_image:
     #   # FIXME: This should reference the component tag that is used.
@@ -35,6 +36,10 @@ spec:
     #   default: '$CI_REGISTRY/components/opentofu/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
     #   description: 'Tag of the gitlab-opentofu image.'
 
+    image_name:
+      default: 'gitlab-opentofu'
+      description: 'Image name for the job images. Hosted under `image_registry_base`.'
+
     # Configuration
     root_dir:
       default: ${CI_PROJECT_DIR}
@@ -62,6 +67,6 @@ spec:
     TF_ROOT: $[[ inputs.root_dir ]]
     TF_STATE_NAME: $[[ inputs.state_name ]]
   image:
-    name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
+    name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
   script:
     - gitlab-tofu validate
-- 
GitLab