@cryptotaxi247 / infra / commits / 247d6d3d

introduce a tf.sh wrapper that also cleans lock files

Since we manage terraform plugins with nix, we don't need these lock files to pin modules.

Jörg Thalheim committed Aug 18, 2024 at 07:41 UTC 247d6d3d33c4b3cedaa53b2b9009377196b2a3d5
2 files changed +15 -13
terraform-iam/README.md
+8 -13
@@ -2,7 +2,7 @@
2
3 This module is for superadmins in the team.
4
5 -This tofu root module manages:
5 +This terraform root module manages:
6 * IAM roles
7
8 ## Setup
@@ -15,26 +15,21 @@ Run `aws sso login` to acquire a temporary token.
15
16 ## Usage
17
18 -The first time the following command has to be run to initialize the state
19 -file and plugins:
20 -
21 -```sh
22 -tofu init
23 -```
18 +We use opentofu, which is a fork of https://www.terraform.io/ maintained by the Linux foundation.
19
20 Then run the following command to diff the changes and then apply if approved:
21
22 ```sh
28 -tofu apply
23 +./tf.sh apply
24 ```
25
31 -## Tofu workflow
26 +## Terraform workflow
27
33 -Write the Tofu code and test the changes using `tofu validate`.
28 +Write the Tofu code and test the changes using `./tf.sh validate`.
29
35 -Before committing run `tofu fmt`.
30 +Before committing run `nix fmt`.
31
32 Once the code is ready to be deployed, create a new PR with the attached
38 -output of `tofu plan`.
33 +output of `./tf.sh plan`.
34
40 -Once the PR is merged, run `tofu apply` to apply the changes.
35 +Once the PR is merged, run `./tf.sh apply` to apply the changes.
terraform-iam/tf.sh new
+7
@@ -0,0 +1,7 @@
1 +#!/usr/bin/env bash
2 +set -euo pipefail
3 +
4 +cd "$(dirname "$0")"
5 +rm -f .terraform.lock.hcl
6 +tofu init
7 +tofu "$@"