From bc98b31a1bfacf39263b12836342bf6bec3217ad Mon Sep 17 00:00:00 2001 From: saifeddine Rajhi Date: Sun, 13 Oct 2024 15:03:06 +0200 Subject: [PATCH] feat: OpenTofu support to helm chart (#430) * feat: OpenTofu support to helm chart --------- Co-authored-by: Gabriel Martinez <19713226+GMartinez-Sisti@users.noreply.github.com> --- charts/atlantis/Chart.yaml | 4 ++-- charts/atlantis/README.md | 1 + charts/atlantis/templates/statefulset.yaml | 4 ++++ charts/atlantis/tests/statefulset_test.yaml | 10 ++++++++++ charts/atlantis/values.schema.json | 9 +++++++++ charts/atlantis/values.yaml | 3 +++ 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/charts/atlantis/Chart.yaml b/charts/atlantis/Chart.yaml index c6f1565e..81316299 100644 --- a/charts/atlantis/Chart.yaml +++ b/charts/atlantis/Chart.yaml @@ -1,9 +1,9 @@ apiVersion: v1 # renovate: datasource=docker depName=ghcr.io/runatlantis/atlantis -appVersion: v0.29.0 +appVersion: v0.30.0 description: A Helm chart for Atlantis https://www.runatlantis.io name: atlantis -version: 5.6.0 +version: 5.7.0 keywords: - terraform home: https://www.runatlantis.io diff --git a/charts/atlantis/README.md b/charts/atlantis/README.md index b33ccd29..36667512 100644 --- a/charts/atlantis/README.md +++ b/charts/atlantis/README.md @@ -90,6 +90,7 @@ extraManifests: | containerSecurityContext | object | `{}` | Check values.yaml for examples. | | customPem | string | `""` | Allows to override the /etc/ssl/certs/ca-certificates.cer with your custom one. You have to create a secret with the specified name. | | dataStorage | string | `""` | DEPRECATED - Disk space available to check out repositories. Example: 5Gi. | +| defaultTFDistribution | string | `"terraform"` | Sets the default terraform distribution to use. Can be set to terraform or opentofu. | | defaultTFVersion | string | `""` | Sets the default terraform version to be used in atlantis server. Check values.yaml for examples. | | disableApply | bool | `false` | Disables running `atlantis apply` regardless of which flags are sent with it. | | disableApplyAll | bool | `false` | Disables running `atlantis apply` without any flags. | diff --git a/charts/atlantis/templates/statefulset.yaml b/charts/atlantis/templates/statefulset.yaml index de8b80b4..342b3b63 100644 --- a/charts/atlantis/templates/statefulset.yaml +++ b/charts/atlantis/templates/statefulset.yaml @@ -307,6 +307,10 @@ spec: - name: ATLANTIS_DEFAULT_TF_VERSION value: {{ .Values.defaultTFVersion }} {{- end }} + {{- if .Values.defaultTFDistribution }} + - name: ATLANTIS_TF_DISTRIBUTION + value: {{ .Values.defaultTFDistribution }} + {{- end }} {{- if .Values.logLevel }} - name: ATLANTIS_LOG_LEVEL value: {{ .Values.logLevel | quote}} diff --git a/charts/atlantis/tests/statefulset_test.yaml b/charts/atlantis/tests/statefulset_test.yaml index f97a2529..c59f215d 100644 --- a/charts/atlantis/tests/statefulset_test.yaml +++ b/charts/atlantis/tests/statefulset_test.yaml @@ -119,6 +119,8 @@ tests: value: - name: PATH value: /plugins:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: ATLANTIS_TF_DISTRIBUTION + value: terraform - name: ATLANTIS_DATA_DIR value: /atlantis-data - name: ATLANTIS_REPO_ALLOWLIST @@ -184,6 +186,8 @@ tests: value: - name: PATH value: /plugins:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: ATLANTIS_TF_DISTRIBUTION + value: terraform - name: ATLANTIS_DATA_DIR value: /atlantis-data - name: ATLANTIS_REPO_ALLOWLIST @@ -993,6 +997,8 @@ tests: value: - name: PATH value: /foo:/bar:/plugins:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: ATLANTIS_TF_DISTRIBUTION + value: terraform - name: ATLANTIS_DATA_DIR value: /atlantis-data - name: ATLANTIS_REPO_ALLOWLIST @@ -1011,6 +1017,8 @@ tests: value: - name: PATH value: /home/atlantis:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: ATLANTIS_TF_DISTRIBUTION + value: terraform - name: ATLANTIS_DATA_DIR value: /atlantis-data - name: ATLANTIS_REPO_ALLOWLIST @@ -1030,6 +1038,8 @@ tests: value: - name: PATH value: /foo:/bar:/home/atlantis:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + - name: ATLANTIS_TF_DISTRIBUTION + value: terraform - name: ATLANTIS_DATA_DIR value: /atlantis-data - name: ATLANTIS_REPO_ALLOWLIST diff --git a/charts/atlantis/values.schema.json b/charts/atlantis/values.schema.json index ce3e7554..6a5caa21 100644 --- a/charts/atlantis/values.schema.json +++ b/charts/atlantis/values.schema.json @@ -309,6 +309,15 @@ "description": "Allow atlantis to hide no-changes plan comments", "default": false }, + "defaultTFDistribution": { + "type": "string", + "description": "Default Atlantis distribution to be used by atlantis server. Either opentofu or terraform", + "default": "terraform", + "enum": [ + "terraform", + "opentofu" + ] + }, "defaultTFVersion": { "type": "string", "description": "Default Terraform version to be used by atlantis server" diff --git a/charts/atlantis/values.yaml b/charts/atlantis/values.yaml index 4e89152b..df2c9308 100644 --- a/charts/atlantis/values.yaml +++ b/charts/atlantis/values.yaml @@ -223,6 +223,9 @@ hidePrevPlanComments: false # -- Enables atlantis to hide no-changes plan comments from the pull request. hideUnchangedPlanComments: false +# -- Sets the default terraform distribution to use. Can be set to terraform or opentofu. +defaultTFDistribution: terraform + # -- Sets the default terraform version to be used in atlantis server. # Check values.yaml for examples. defaultTFVersion: ""