11---
22# This reusable workflow deploys a multi-node test cluster on a cloud using
3- # Terraform , then deploys OpenStack via Kayobe. Tempest is then used to test
3+ # OpenTofu , then deploys OpenStack via Kayobe. Tempest is then used to test
44# the cloud.
55
66name : Multinode
@@ -32,7 +32,7 @@ name: Multinode
3232 type : string
3333 default : ' 9'
3434 ssh_username :
35- description : User for terraform to access the Multinode hosts
35+ description : User to access the Multinode hosts
3636 type : string
3737 default : cloud-user
3838 neutron_plugin :
@@ -134,7 +134,7 @@ jobs:
134134 - name : Install Package
135135 uses : ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 # v1.1.0
136136 with :
137- apt : git unzip nodejs python3-pip python3-venv rsync openssh-client
137+ apt : curl git unzip nodejs python3-pip python3-venv rsync openssh-client
138138
139139 # If testing upgrade, checkout previous release, otherwise checkout current branch
140140 - name : Checkout ${{ (inputs.upgrade != 'none') && 'previous release' || 'current' }} config
@@ -176,6 +176,16 @@ jobs:
176176 with :
177177 terraform_wrapper : false
178178
179+ - name : Install OpenTofu
180+ run : |
181+ TOFU_VERSION=1.11.8
182+ cd /tmp
183+ curl -sSfLO https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_linux_amd64.tar.gz
184+ curl -sSfLO https://github.com/opentofu/opentofu/releases/download/v${TOFU_VERSION}/tofu_${TOFU_VERSION}_SHA256SUMS
185+ sha256sum -c --ignore-missing tofu_${TOFU_VERSION}_SHA256SUMS
186+ cd /usr/bin && sudo tar xvf /tmp/tofu_${TOFU_VERSION}_linux_amd64.tar.gz tofu
187+ rm /tmp/tofu_${TOFU_VERSION}_*
188+
179189 - name : Setup Ansible
180190 run : |
181191 python3 -m venv venv &&
@@ -278,13 +288,13 @@ jobs:
278288 MULTINODE_FIP_POOL : ${{ vars.multinode_fip_pool }}
279289 SSH_USERNAME : " ${{ inputs.ssh_username }}"
280290
281- - name : Initialise terraform
282- run : terraform init
291+ - name : Initialise OpenTofu
292+ run : tofu init
283293 working-directory : ${{ github.workspace }}/terraform-kayobe-multinode
284294
285- - name : Validate terraform
295+ - name : Validate OpenTofu
286296 id : tf_validate
287- run : terraform validate
297+ run : tofu validate
288298 working-directory : ${{ github.workspace }}/terraform-kayobe-multinode
289299
290300 - name : Configure Ansible
@@ -315,18 +325,18 @@ jobs:
315325 OS_DISTRIBUTION : ${{ inputs.os_distribution }}
316326 OS_RELEASE : ${{ inputs.os_release }}
317327
318- - name : Terraform Plan
319- run : terraform plan -input=false
328+ - name : Tofu Plan
329+ run : tofu plan -input=false
320330 working-directory : ${{ github.workspace }}/terraform-kayobe-multinode
321331 env :
322332 OS_CLOUD : ${{ vars.OS_CLOUD }}
323333 OS_APPLICATION_CREDENTIAL_ID : ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
324334 OS_APPLICATION_CREDENTIAL_SECRET : ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
325335
326- - name : Terraform Apply
336+ - name : Tofu Apply
327337 run : |
328338 for attempt in $(seq 3); do
329- if terraform apply -auto-approve -input=false; then
339+ if tofu apply -auto-approve -input=false; then
330340 echo "Created infrastructure on attempt $attempt"
331341 exit 0
332342 fi
@@ -502,7 +512,7 @@ jobs:
502512 - name : Destroy
503513 run : |
504514 for attempt in $(seq 5); do
505- if terraform destroy -auto-approve -input=false -lock-timeout=200s; then
515+ if tofu destroy -auto-approve -input=false -lock-timeout=200s; then
506516 echo "Destroyed infrastructure on attempt $attempt"
507517 exit 0
508518 fi
@@ -511,7 +521,7 @@ jobs:
511521 done
512522 echo "Failed to destroy infrastructure after $attempt attempts"
513523 echo "Forcefully destroying infrastructure"
514- terraform destroy -auto-approve -input=false -lock=false
524+ tofu destroy -auto-approve -input=false -lock=false
515525 exit 1
516526 working-directory : ${{ github.workspace }}/terraform-kayobe-multinode
517527 env :
0 commit comments