Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ See [https://github.com/dodevops/kc](the kc website) for details.
* 🟦 krew
* 🐚 Kubectlnodeshell
* 🐳 Kubernetes
* 📦 Opentofu
* 📦 Packages
* 📦 Packer
* 👟 Run
Expand Down Expand Up @@ -83,6 +84,7 @@ See [https://github.com/dodevops/kc](the kc website) for details.
* [krew](#krew)
* [Kubectlnodeshell](#kubectlnodeshell)
* [Kubernetes](#kubernetes)
* [Opentofu](#opentofu)
* [Packages](#packages)
* [Packer](#packer)
* [Run](#run)
Expand Down Expand Up @@ -578,6 +580,24 @@ Installs and configures [kubernetes](https://kubernetes.io/docs/reference/kubect
* Environment GCLOUD_K8S_CLUSTERS: A comma separated list of zone[@project]:cluster-name
* Environment K8S_USE_GCLOUD_AUTH: Whether to use the new GKE_GCLOUD_AUTH plugin [true]

### <a id="opentofu"></a> Opentofu

Installs and configures [Opentofu](https://opentofu.org/)

#### Configuration

* USE_opentofu: Enable this feature (or use the FEATURES variable instead)
* OPENTOFU_VERSION (required): Version to install (or use the FEATURES variable instead)
* DEBUG_opentofu: Debug this feature
* Add a volume mount to the `volumes:` section of docker compose like this:
(...)
volumes:
- "<path-to-opentofu>:/opentofu"
* If you used the browser based login in gcloud, you'll probably need to authenticate using the application-default
login using the gcloud cli by running

gcloud auth application-default login

### <a id="packages"></a> Packages

Installs additional packages into the container
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -euo pipefail
#
# If no flavour is specified, all flavours will be built

mv Dockerfile Dockerfile.sav
mv Dockerfile Dockerfile.sav &>/dev/null || true

TAG=latest
if [ -n "$1" ]
Expand Down
15 changes: 15 additions & 0 deletions feature/opentofu/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
icon: "📦"
title: "Opentofu"
description: "Installs and configures [Opentofu](https://opentofu.org/)"
configuration:
- |
Add a volume mount to the `volumes:` section of docker compose like this:
(...)
volumes:
- "<path-to-opentofu>:/opentofu"
- |
If you used the browser based login in gcloud, you'll probably need to authenticate using the application-default
login using the gcloud cli by running

gcloud auth application-default login
requiresVersion: true
1 change: 1 addition & 0 deletions feature/opentofu/goss.unsetversion/.will-fail
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The opentofu feature requires a version set using OPENTOFU_VERSION.
2 changes: 2 additions & 0 deletions feature/opentofu/goss/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
OPENTOFU_VERSION=1.10.5
DEBUG_opentofu=true
6 changes: 6 additions & 0 deletions feature/opentofu/goss/goss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
command:
terraform:
exec: "/home/cloudcontrol/bin/tofu --version"
exit-status: 0
stdout:
- "OpenTofu v1.10.5"
19 changes: 19 additions & 0 deletions feature/opentofu/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
. /feature-installer-utils.sh

if [ -z "${OPENTOFU_VERSION}" ]
then
echo "The opentofu feature requires a version set using OPENTOFU_VERSION. See https://github.com/opentofu/opentofu/releases for valid versions"
exit 1
fi

OPENTOFU_VERSION=$(checkAndCleanVersion "${OPENTOFU_VERSION}")

TEMPDIR=$(mktemp -d)
cd "${TEMPDIR}" || exit

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
execHandle "Unpacking opentofu" unzip opentofu.zip
execHandle "Installing opentofu" mv tofu /home/cloudcontrol/bin/tofu

cd - &>/dev/null || exit
rm -rf "${TEMPDIR}"
2 changes: 1 addition & 1 deletion flavour/aws/Dockerfile.flavour
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM amazon/aws-cli:latest

RUN yum install -y sudo shadow-utils unzip tar net-tools curl && \
RUN yum install -y sudo shadow-utils unzip tar net-tools && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/yum *" > /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/curl *" >> /etc/sudoers.d/cloudcontrol && \
echo "cloudcontrol ALL=(root)NOPASSWD:/usr/bin/mv *" >> /etc/sudoers.d/cloudcontrol && \
Expand Down
Loading