mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2025-12-14 05:45:06 +03:00
Replace terraform with opentf (#12291)
Terraform is no longer open source software and has been removed and replaced with OpenTofu. Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ variables:
|
||||
ANSIBLE_VERBOSITY: 2
|
||||
RECOVER_CONTROL_PLANE_TEST: "false"
|
||||
RECOVER_CONTROL_PLANE_TEST_GROUPS: "etcd[2:]:kube_control_plane[1:]"
|
||||
TF_VERSION: 1.3.7
|
||||
OPENTOFU_VERSION: v1.9.1
|
||||
PIPELINE_IMAGE: "$CI_REGISTRY_IMAGE/pipeline:${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}"
|
||||
|
||||
before_script:
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
before_script:
|
||||
- ./tests/scripts/rebase.sh
|
||||
- mkdir -p cluster-dump $ANSIBLE_INVENTORY
|
||||
- ./tests/scripts/terraform_install.sh
|
||||
- ./tests/scripts/opentofu_install.sh
|
||||
- cp contrib/terraform/$PROVIDER/sample-inventory/cluster.tfvars .
|
||||
- ln -rs -t $ANSIBLE_INVENTORY contrib/terraform/$PROVIDER/hosts
|
||||
- terraform -chdir="contrib/terraform/$PROVIDER" init
|
||||
- tofu -chdir="contrib/terraform/$PROVIDER" init
|
||||
|
||||
terraform_validate:
|
||||
extends: .terraform_install
|
||||
tags: [ffci]
|
||||
only: ['master', /^pr-.*$/]
|
||||
script:
|
||||
- terraform -chdir="contrib/terraform/$PROVIDER" validate
|
||||
- terraform -chdir="contrib/terraform/$PROVIDER" fmt -check -diff
|
||||
- tofu -chdir="contrib/terraform/$PROVIDER" validate
|
||||
- tofu -chdir="contrib/terraform/$PROVIDER" fmt -check -diff
|
||||
stage: test
|
||||
needs:
|
||||
- pipeline-image
|
||||
@@ -58,11 +58,11 @@ terraform_validate:
|
||||
- mkdir -p contrib/terraform/$PROVIDER/group_vars
|
||||
# Random subnet to avoid routing conflicts
|
||||
- export TF_VAR_subnet_cidr="10.$(( $RANDOM % 256 )).$(( $RANDOM % 256 )).0/24"
|
||||
- terraform -chdir="contrib/terraform/$PROVIDER" apply -auto-approve -parallelism=1
|
||||
- tofu -chdir="contrib/terraform/$PROVIDER" apply -auto-approve -parallelism=1
|
||||
- tests/scripts/testcases_run.sh
|
||||
after_script:
|
||||
# Cleanup regardless of exit code
|
||||
- terraform -chdir="contrib/terraform/$PROVIDER" destroy -auto-approve
|
||||
- tofu -chdir="contrib/terraform/$PROVIDER" destroy -auto-approve
|
||||
|
||||
# Elastx is generously donating resources for Kubespray on Openstack CI
|
||||
# Contacts: @gix @bl0m1
|
||||
|
||||
8
tests/scripts/opentofu_install.sh
Executable file
8
tests/scripts/opentofu_install.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
|
||||
chmod +x install-opentofu.sh
|
||||
./install-opentofu.sh --install-method standalone
|
||||
rm -f install-opentofu.sh
|
||||
tofu --version
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
apt-get install -y unzip
|
||||
curl https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip > /tmp/terraform.zip
|
||||
unzip /tmp/terraform.zip && mv ./terraform /usr/local/bin/ && terraform --version
|
||||
Reference in New Issue
Block a user