-
Notifications
You must be signed in to change notification settings - Fork 172
Migrate Tofu Controller to OpenTofu #1675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexandermarston
merged 16 commits into
flux-iac:main
from
alexandermarston:implement-opentofu
Jan 15, 2026
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4c49bfd
update GitHub workflows to use OpenTofu binaries
alexandermarston 186c593
update comment
alexandermarston a10a452
update dockerfiles
alexandermarston 4064661
update binary used
alexandermarston 5e4648f
update to only extract tofu bin
alexandermarston ce2e24b
update test cases
alexandermarston e4c2f63
update e2e step
alexandermarston c540a2e
update proxy hosts
alexandermarston cb88ed9
update doc
alexandermarston 0e9b75a
Merge branch 'main' into implement-opentofu
alexandermarston 99fb7ae
fallback to terraform binary if tofu not available
alexandermarston 71e64d1
update makefile to download correct protoc bin dep on arch (and update)
alexandermarston b857584
update LookPath to take a list of binaries to lookup
alexandermarston 1ac1be4
switch bin priority
alexandermarston 0b30c42
switch to tofu version 1.6.2 as per recommended migration steps
alexandermarston e4866f0
back to 1.11.3
alexandermarston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ SHELL = /usr/bin/env bash -o pipefail | |
| # Allows for defining additional Docker buildx arguments, e.g. '--push'. | ||
| BUILD_ARGS ?= | ||
|
|
||
| # Set architecture for the binaries we build as well as the terraform binary that get bundled in the images | ||
| # Set architecture for the binaries we build as well as the tofu binary that get bundled in the images | ||
| TARGETARCH ?= amd64 | ||
|
|
||
| .PHONY: all | ||
|
|
@@ -114,7 +114,7 @@ test-internal: manifests generate download-crd-deps fmt vet envtest api-docs ## | |
|
|
||
| .PHONY: gen-grpc | ||
| gen-grpc: protoc protoc-gen-go protoc-gen-go-grpc | ||
| env PATH=$(shell pwd)/bin:$$PATH $(PROJECT_DIR)/bin/protoc --go_out=. --go_opt=Mrunner/runner.proto=runner/ --go-grpc_out=. --go-grpc_opt=Mrunner/runner.proto=runner/ runner/runner.proto | ||
| env PATH="$(shell pwd)/bin:$$PATH" $(PROJECT_DIR)/bin/protoc --go_out=. --go_opt=Mrunner/runner.proto=runner/ --go-grpc_out=. --go-grpc_opt=Mrunner/runner.proto=runner/ runner/runner.proto | ||
|
|
||
| ##@ Build | ||
|
|
||
|
|
@@ -225,14 +225,25 @@ kustomize: ## Download kustomize locally if necessary. | |
| $(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected]) | ||
|
|
||
| PROTOC = $(PROJECT_DIR)/protoc | ||
| PROTOC_V ?= 31.1 | ||
| PROTOC_V ?= 33.4 | ||
| PROTOC_URL := https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_V}/protoc-${PROTOC_V} | ||
| .PHONY: protoc | ||
| protoc: ## Download protoc locally if necessary. | ||
| # download and unzip protoc | ||
| mkdir -p $(PROJECT_DIR) | ||
| curl -qLO https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOC_V)/protoc-$(PROTOC_V)-linux-x86_64.zip | ||
| unzip -q -o protoc-$(PROTOC_V)-linux-x86_64.zip bin/protoc -d $(PROJECT_DIR) | ||
| rm protoc-$(PROTOC_V)-linux-x86_64.zip | ||
| if [ "$(shell uname)" == "Darwin" ]; then \ | ||
| curl -qLO ${PROTOC_URL}-osx-x86_64.zip ;\ | ||
| unzip -q -o protoc-${PROTOC_V}-osx-x86_64.zip bin/protoc -d $(PROJECT_DIR) ;\ | ||
| rm protoc-${PROTOC_V}-osx-x86_64.zip ;\ | ||
| elif [ "$(shell uname -m)" == "aarch64" ]; then \ | ||
| curl -qLO ${PROTOC_URL}-linux-aarch_64.zip ;\ | ||
| unzip -q -o protoc-${PROTOC_V}-linux-aarch_64.zip bin/protoc -d $(PROJECT_DIR) ;\ | ||
| rm protoc-${PROTOC_V}-linux-aarch_64.zip ;\ | ||
| else \ | ||
| curl -qLO ${PROTOC_URL}-linux-x86_64.zip ;\ | ||
| unzip -q -o protoc-${PROTOC_V}-linux-x86_64.zip bin/protoc -d $(PROJECT_DIR) ;\ | ||
| rm protoc-${PROTOC_V}-linux-x86_64.zip ;\ | ||
| fi ;\ | ||
|
|
||
| # Find or download controller-gen | ||
| PROTOC_GEN_GO = $(GOBIN)/protoc-gen-go | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,13 @@ | ||
| ARG BASE_IMAGE | ||
| ARG TOFU_VERSION=1.11.3 | ||
|
|
||
| FROM mcr.microsoft.com/azure-cli:2.50.0 AS azcli | ||
| FROM ghcr.io/opentofu/opentofu:${TOFU_VERSION}-minimal AS tofu | ||
|
|
||
| FROM $BASE_IMAGE | ||
|
|
||
| ARG TARGETARCH | ||
| ARG TF_VERSION=1.3.9 | ||
|
|
||
| # Switch to root to have permissions for operations | ||
| USER root | ||
|
|
||
| ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip | ||
| RUN unzip -q /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \ | ||
| rm /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip && \ | ||
| chmod +x /usr/local/bin/terraform | ||
|
|
||
| # Copy az cli | ||
| COPY --from=azcli /usr/local/bin/az /usr/local/bin/az | ||
| COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu | ||
|
|
||
| # Switch back to the non-root user after operations | ||
| USER 65532:65532 | ||
|
|
||
| ENV GNUPGHOME=/tmp | ||
| USER 65532:65532 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,11 @@ | ||
| ARG BASE_IMAGE | ||
| FROM $BASE_IMAGE | ||
| ARG TOFU_VERSION=1.11.3 | ||
|
|
||
| ARG TARGETARCH | ||
| ARG TF_VERSION=1.5.7 | ||
| FROM ghcr.io/opentofu/opentofu:${TOFU_VERSION}-minimal AS tofu | ||
|
|
||
| # Switch to root to have permissions for operations | ||
| USER root | ||
| FROM $BASE_IMAGE | ||
|
|
||
| ADD https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip | ||
| RUN unzip -q /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip -d /usr/local/bin/ && \ | ||
| rm /terraform_${TF_VERSION}_linux_${TARGETARCH}.zip && \ | ||
| chmod +x /usr/local/bin/terraform | ||
| COPY --from=tofu /usr/local/bin/tofu /usr/local/bin/tofu | ||
|
|
||
| # Switch back to the non-root user after operations | ||
| USER 65532:65532 | ||
| USER 65532:65532 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.