Skip to content

Commit

Permalink
Move to OpenTofu (#349)
Browse files Browse the repository at this point in the history
Bug: T351249
  • Loading branch information
vivian-rook authored Nov 15, 2023
1 parent d4d1f69 commit 7bd8f9e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ ansible/files/csi-secret-cinderplugin.yaml.eqiad1.crypt filter=git-crypt diff=gi
ansible/files/csi-secret-cinderplugin.yaml.codfw1dev.crypt filter=git-crypt diff=git-crypt
paws/codfw-secrets.yaml filter=git-crypt diff=git-crypt
paws/files/minesweeper/secrets/** filter=git-crypt diff=git-crypt
terraform/secrets.tf filter=git-crypt diff=git-crypt
tofu/secrets.tf filter=git-crypt diff=git-crypt
25 changes: 10 additions & 15 deletions .github/workflows/terraform-fmt.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

name: "terraform fmt"
name: "tofu fmt"

'on':
pull_request:
Expand All @@ -11,23 +11,18 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: install terraform
- name: install tofu
run: |
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install -y terraform
- name: terraform fmt
curl -s https://packagecloud.io/install/repositories/opentofu/tofu/script.deb.sh?any=true -o /tmp/tofu-repository-setup.sh
sudo bash /tmp/tofu-repository-setup.sh
sudo apt install tofu
- name: tofu fmt
run: |
shopt -s extglob
cd terraform
if ! terraform fmt -check -diff !(secrets).tf ; then
echo "please update your terraform code to match the above.";
echo 'or run `terraform fmt` to have terraform reformat it.';
cd tofu
if ! tofu fmt -check -diff !(secrets).tf ; then
echo "please update your tofu code to match the above.";
echo 'or run `tofu fmt` to have tofu reformat it.';
exit 1;
fi
10 changes: 5 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ if ! command -v helm ; then
exit 1
fi

if ! command -v terraform ; then
echo "please install terraform"
if ! command -v tofu ; then
echo "please install tofu"
exit 1
fi

Expand All @@ -36,9 +36,9 @@ source .venv/deploy/bin/activate
pip install ansible==8.1.0 kubernetes==26.1.0


cd terraform
terraform init
terraform apply -var datacenter=${datacenter} # -auto-approve
cd tofu
tofu init
tofu apply -var datacenter=${datacenter} # -auto-approve
export KUBECONFIG=$(pwd)/kube.config

cd ../ansible
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7bd8f9e

Please sign in to comment.