From 4e513879b5d9b6ac1dc8dc4ce8b600b8aebbc53a Mon Sep 17 00:00:00 2001
From: Timo Furrer <tfurrer@gitlab.com>
Date: Fri, 2 Feb 2024 10:14:56 +0100
Subject: [PATCH] Postpone removal Terraform templates to 18.0

This change set postpones the removal of the deprecated Terraform CI/CD
templates from milestone 17.0 to 18.0.
---
 ...6-9-deprecate-terraform-cicd-templates.yml |  7 +-
 doc/update/deprecations.md                    | 71 ++++++++++---------
 .../ci/templates/Terraform/Base.gitlab-ci.yml |  4 +-
 .../Terraform/Base.latest.gitlab-ci.yml       |  4 +-
 .../Terraform/base_gitlab_ci_yaml_spec.rb     |  2 +-
 .../base_latest_gitlab_ci_yaml_spec.rb        |  2 +-
 .../terraform_gitlab_ci_yaml_spec.rb          |  4 +-
 .../terraform_latest_gitlab_ci_yaml_spec.rb   |  6 +-
 8 files changed, 53 insertions(+), 47 deletions(-)

diff --git a/data/deprecations/16-9-deprecate-terraform-cicd-templates.yml b/data/deprecations/16-9-deprecate-terraform-cicd-templates.yml
index ad62f309d3a77..bd58a24b099d9 100644
--- a/data/deprecations/16-9-deprecate-terraform-cicd-templates.yml
+++ b/data/deprecations/16-9-deprecate-terraform-cicd-templates.yml
@@ -1,6 +1,6 @@
 - title: "Deprecate Terraform CI/CD templates"
   # The milestones for the deprecation announcement, and the removal.
-  removal_milestone: "17.0"
+  removal_milestone: "18.0"
   announcement_milestone: "16.9"
   # Change breaking_change to false if needed.
   breaking_change: true
@@ -10,7 +10,7 @@
   stage: deploy
   issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/438010
   body: |  # (required) Don't change this line.
-    The Terraform CI/CD templates are deprecated and will be removed in GitLab 17.0.
+    The Terraform CI/CD templates are deprecated and will be removed in GitLab 18.0.
     This affects the following templates:
 
     - `Terraform.gitlab-ci.yml`
@@ -20,6 +20,9 @@
 
     In GitLab 16.9, a new job is added to the templates to inform users of the deprecation.
 
+    GitLab won't be able to update the `terraform` binary in the job images to any version that
+    is licensed under BSL.
+
     To continue using Terraform, clone the templates and [Terraform image](https://gitlab.com/gitlab-org/terraform-images),
     and maintain them as needed.
 
diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md
index 3f903aa2954f8..746185129cf1f 100644
--- a/doc/update/deprecations.md
+++ b/doc/update/deprecations.md
@@ -69,6 +69,43 @@ next major release, GitLab 18.0. This gem sees very little use and its
 
 <div class="deprecation breaking-change" data-milestone="18.0">
 
+### Deprecate Terraform CI/CD templates
+
+<div class="deprecation-notes">
+- Announced in GitLab <span class="milestone">16.9</span>
+- Removal in GitLab <span class="milestone">18.0</span> ([breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change))
+- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/438010).
+</div>
+
+The Terraform CI/CD templates are deprecated and will be removed in GitLab 18.0.
+This affects the following templates:
+
+- `Terraform.gitlab-ci.yml`
+- `Terraform.latest.gitlab-ci.yml`
+- `Terraform/Base.gitlab-ci.yml`
+- `Terraform/Base.latest.gitlab-ci.yml`
+
+In GitLab 16.9, a new job is added to the templates to inform users of the deprecation.
+
+GitLab won't be able to update the `terraform` binary in the job images to any version that
+is licensed under BSL.
+
+To continue using Terraform, clone the templates and [Terraform image](https://gitlab.com/gitlab-org/terraform-images),
+and maintain them as needed.
+
+As an alternative we recommend using the new OpenTofu CI/CD component on GitLab.com
+or the new OpenTofu CI/CD template on self-managed.
+CI/CD components are not yet available on GitLab self-managed,
+but [Issue #415638](https://gitlab.com/gitlab-org/gitlab/-/issues/415638)
+proposes to add this feature. If CI/CD components become available on self-managed,
+the OpenTofu CI/CD template will be removed.
+
+You can read more about the new OpenTofu CI/CD component [here](https://gitlab.com/components/opentofu).
+
+</div>
+
+<div class="deprecation breaking-change" data-milestone="18.0">
+
 ### GitLab Runner registration token in Runner Operator
 
 <div class="deprecation-notes">
@@ -495,40 +532,6 @@ Maven versions below 3.6.3 have reached their end-of-life. Users are advised to
 
 <div class="deprecation breaking-change" data-milestone="17.0">
 
-### Deprecate Terraform CI/CD templates
-
-<div class="deprecation-notes">
-- Announced in GitLab <span class="milestone">16.9</span>
-- Removal in GitLab <span class="milestone">17.0</span> ([breaking change](https://docs.gitlab.com/ee/update/terminology.html#breaking-change))
-- To discuss this change or learn more, see the [deprecation issue](https://gitlab.com/gitlab-org/gitlab/-/issues/438010).
-</div>
-
-The Terraform CI/CD templates are deprecated and will be removed in GitLab 17.0.
-This affects the following templates:
-
-- `Terraform.gitlab-ci.yml`
-- `Terraform.latest.gitlab-ci.yml`
-- `Terraform/Base.gitlab-ci.yml`
-- `Terraform/Base.latest.gitlab-ci.yml`
-
-In GitLab 16.9, a new job is added to the templates to inform users of the deprecation.
-
-To continue using Terraform, clone the templates and [Terraform image](https://gitlab.com/gitlab-org/terraform-images),
-and maintain them as needed.
-
-As an alternative we recommend using the new OpenTofu CI/CD component on GitLab.com
-or the new OpenTofu CI/CD template on self-managed.
-CI/CD components are not yet available on GitLab self-managed,
-but [Issue #415638](https://gitlab.com/gitlab-org/gitlab/-/issues/415638)
-proposes to add this feature. If CI/CD components become available on self-managed,
-the OpenTofu CI/CD template will be removed.
-
-You can read more about the new OpenTofu CI/CD component [here](https://gitlab.com/components/opentofu).
-
-</div>
-
-<div class="deprecation breaking-change" data-milestone="17.0">
-
 ### Deprecate Windows CMD in GitLab Runner
 
 <div class="deprecation-notes">
diff --git a/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml b/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
index cb0790240cb02..f9543e8b07c10 100644
--- a/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
@@ -20,14 +20,14 @@ cache:
   paths:
     - ${TF_ROOT}/.terraform/
 
-'deprecated-and-will-be-removed-in-17.0':
+'deprecated-and-will-be-removed-in-18.0':
   stage: .pre
   needs: []
   allow_failure: true
   image: alpine:3.19
   script:
     - |
-      echo "You are using the Terraform CI/CD template, which is deprecated and will be removed in GitLab 17.0."
+      echo "You are using the Terraform CI/CD template, which is deprecated and will be removed in GitLab 18.0."
       echo "GitLab provides an alternative OpenTofu CI/CD component for GitLab.com users."
       echo "Self-managed users should use the OpenTofu CI/CD template, which will be removed after "
       echo "CI/CD components are available on GitLab self-managed."
diff --git a/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml b/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
index 7308e699c22fe..65e2382d189dc 100644
--- a/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
+++ b/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
@@ -22,14 +22,14 @@ variables:
   TF_ROOT: ${CI_PROJECT_DIR}  # The relative path to the root directory of the Terraform project
   TF_STATE_NAME: default      # The name of the state file used by the GitLab Managed Terraform state backend
 
-'deprecated-and-will-be-removed-in-17.0':
+'deprecated-and-will-be-removed-in-18.0':
   stage: .pre
   needs: []
   allow_failure: true
   image: alpine:3.19
   script:
     - |
-      echo "You are using the Terraform CI/CD template, which is deprecated and will be removed in GitLab 17.0."
+      echo "You are using the Terraform CI/CD template, which is deprecated and will be removed in GitLab 18.0."
       echo "GitLab provides an alternative OpenTofu CI/CD component for GitLab.com users."
       echo "Self-managed users should use the OpenTofu CI/CD template, which will be removed after "
       echo "CI/CD components are available on GitLab self-managed."
diff --git a/spec/lib/gitlab/ci/templates/Terraform/base_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/Terraform/base_gitlab_ci_yaml_spec.rb
index 9fcae67c71773..e079bc04ca558 100644
--- a/spec/lib/gitlab/ci/templates/Terraform/base_gitlab_ci_yaml_spec.rb
+++ b/spec/lib/gitlab/ci/templates/Terraform/base_gitlab_ci_yaml_spec.rb
@@ -31,7 +31,7 @@
     end
 
     it 'creates deprecation warning job' do
-      expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+      expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
     end
   end
 end
diff --git a/spec/lib/gitlab/ci/templates/Terraform/base_latest_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/Terraform/base_latest_gitlab_ci_yaml_spec.rb
index ab4536e450ed9..6f7badd3efcb0 100644
--- a/spec/lib/gitlab/ci/templates/Terraform/base_latest_gitlab_ci_yaml_spec.rb
+++ b/spec/lib/gitlab/ci/templates/Terraform/base_latest_gitlab_ci_yaml_spec.rb
@@ -31,7 +31,7 @@
     end
 
     it 'creates deprecation warning job' do
-      expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+      expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
     end
   end
 end
diff --git a/spec/lib/gitlab/ci/templates/terraform_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/terraform_gitlab_ci_yaml_spec.rb
index 38a182bcd36b1..b3a6a14947ed4 100644
--- a/spec/lib/gitlab/ci/templates/terraform_gitlab_ci_yaml_spec.rb
+++ b/spec/lib/gitlab/ci/templates/terraform_gitlab_ci_yaml_spec.rb
@@ -28,7 +28,7 @@
 
     context 'on master branch' do
       it 'creates deprecation warning job' do
-        expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+        expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
       end
 
       it 'creates init, validate,build terraform jobs as well as kics-iac-sast job', :aggregate_failures do
@@ -41,7 +41,7 @@
       let(:pipeline_branch) { 'patch-1' }
 
       it 'creates deprecation warning job' do
-        expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+        expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
       end
 
       it 'does not creates a deploy and a test job', :aggregate_failures do
diff --git a/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb b/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb
index 777470def83e5..f84826efc49c3 100644
--- a/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb
+++ b/spec/lib/gitlab/ci/templates/terraform_latest_gitlab_ci_yaml_spec.rb
@@ -28,7 +28,7 @@
 
     context 'on master branch' do
       it 'creates deprecation warning job' do
-        expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+        expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
       end
 
       it 'creates init, validate and build jobs', :aggregate_failures do
@@ -41,7 +41,7 @@
       let(:pipeline_branch) { 'patch-1' }
 
       it 'creates deprecation warning job' do
-        expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+        expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
       end
 
       it 'does not creates a deploy and a test job', :aggregate_failures do
@@ -61,7 +61,7 @@
       let(:branch_build_names) { branch_pipeline.builds.pluck(:name) }
 
       it 'creates deprecation warning job' do
-        expect(build_names).to include('deprecated-and-will-be-removed-in-17.0')
+        expect(build_names).to include('deprecated-and-will-be-removed-in-18.0')
       end
 
       # This is needed so that the terraform artifacts and sast_iac artifacts
-- 
GitLab