flux-iac/tofu-controller

tf-runner Docker uses Hashicorp Terraform binaries?

cunningr opened this issue · 2 comments

I am not sure if this is really the right place however I am unable to join the Slack channel. Browsing the code here: https://github.com/flux-iac/tofu-controller/blob/main/runner.Dockerfile this kind of suggests that the runner for tofu-controller is still using Terraform binaries?

@cunningr On my setup, I am literally renaming tofu to terraform so i can use OpenTofu at the end. This works already for months and is kind of a workaround since there's no controller option for it yet.

Dockerfile:

ARG BASE_IMAGE
FROM $BASE_IMAGE

ARG TARGETARCH
ARG TF_VERSION

USER root

ADD https://github.com/opentofu/opentofu/releases/download/v${TF_VERSION}/tofu_${TF_VERSION}_linux_${TARGETARCH}.zip /tofu_${TF_VERSION}_linux_${TARGETARCH}.zip
RUN unzip -q /tofu_${TF_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin && \
    mv /usr/local/bin/tofu /usr/local/bin/terraform && \
    chmod +x /usr/local/bin/terraform && \
    rm /tofu_${TF_VERSION}_linux_${TARGETARCH}.zip

USER 65532:65532 

script.sh:

export TF_CONTROLLER_VERSION=v0.16.0-rc.3
export TF_VERSION=1.8.2
export REGISTRY_URL="example.org"
export BASE_IMAGE=ghcr.io/flux-iac/tf-runner:${TF_CONTROLLER_VERSION}-base
export TARGETARCH=arm64
export REMOTE_REPO=${REGISTRY_URL}/tf-runner:$TF_VERSION-tofu
docker buildx build \
    --build-arg BASE_IMAGE=${BASE_IMAGE} \
    --build-arg TARGETARCH=${TARGETARCH} \
    --build-arg TF_VERSION=${TF_VERSION} \
    --platform linux/$TARGETARCH \
    --tag $REMOTE_REPO \
    --push .

We are still running the hashicorp binary ( Last non-BSL licensed version ) for now, but moving the the tofu binary is part of the future plans for this controller. I can't give an eta on it currently, but building a custom runner image until then is defininently an option.