Skip to content

Commit 014f215

Browse files
author
Dennis Plöger
committed
feat: New feature: OpenTofu
1 parent e3ecf84 commit 014f215

6 files changed

Lines changed: 75 additions & 0 deletions

File tree

.vscode/launch.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Run Tests",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"cwd": "/Users/dennisploger/Documents/code/dodevops/cloudcontrol",
13+
"program": "cmd/tests/test-features.go",
14+
"args": [
15+
"-f",
16+
"simple",
17+
"-i",
18+
"ghcr.io/dodevops/cloudcontrol-simple:local",
19+
"-t",
20+
"/Users/dennisploger/work/testbed",
21+
"-p",
22+
"linux/arm64",
23+
"-l",
24+
"debug",
25+
"-g",
26+
"/Users/dennisploger/Downloads/goss-linux-arm64",
27+
"-n",
28+
"opentofu"
29+
]
30+
}
31+
]
32+
}

feature/opentofu/feature.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
icon: "📦"
2+
title: "Opentofu"
3+
description: "Installs and configures [Opentofu](https://opentofu.org/)"
4+
configuration:
5+
- |
6+
Add a volume mount to the `volumes:` section of docker compose like this:
7+
(...)
8+
volumes:
9+
- "<path-to-opentofu>:/opentofu"
10+
- |
11+
If you used the browser based login in gcloud, you'll probably need to authenticate using the application-default
12+
login using the gcloud cli by running
13+
14+
gcloud auth application-default login
15+
requiresVersion: true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The opentofu feature requires a version set using OPENTOFU_VERSION

feature/opentofu/goss/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OPENTOFU_VERSION=1.10.5
2+
DEBUG_opentofu=true

feature/opentofu/goss/goss.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
command:
2+
terraform:
3+
exec: "/home/cloudcontrol/bin/tofu --version"
4+
exit-status: 0
5+
stdout:
6+
- "OpenTofu v1.10.5"

feature/opentofu/install.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
. /feature-installer-utils.sh
2+
3+
if [ -z "${OPENTOFU_VERSION}" ]
4+
then
5+
echo "The terraform feature requires a version set using OPENTOFU_VERSION. See https://github.com/opentofu/opentofu/releases for valid versions"
6+
exit 1
7+
fi
8+
9+
OPENTOFU_VERSION=$(checkAndCleanVersion "${OPENTOFU_VERSION}")
10+
11+
TEMPDIR=$(mktemp -d)
12+
cd "${TEMPDIR}" || exit
13+
14+
execHandle "Downloading opentofu" curl -f -s -L "https://github.com/opentofu/opentofu/releases/download/v${OPENTOFU_VERSION}/tofu_${OPENTOFU_VERSION}_linux_$(getPlatform).zip" --output opentofu.zip
15+
execHandle "Unpacking opentofu" unzip opentofu.zip
16+
execHandle "Installing opentofu" mv tofu /home/cloudcontrol/bin/tofu
17+
18+
cd - &>/dev/null || exit
19+
rm -rf "${TEMPDIR}"

0 commit comments

Comments
 (0)