Skip to content

Commit

Permalink
fix: use dynamic arch for opentofu binary downloads (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
pat-s authored Dec 2, 2024
1 parent 01bed30 commit 15b2b4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Containerfile.multiarch
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ENV TOFU_VERSION="${TOFU_VERSION:-v1.8.6}"

RUN apk --update add --virtual .build-deps libarchive-tools && \
apk add --no-cache curl git openssh-client && \
curl -SsfL "https://github.com/opentofu/opentofu/releases/download/${TOFU_VERSION}/tofu_${TOFU_VERSION##v}_linux_amd64.zip" | \
curl -SsfL "https://github.com/opentofu/opentofu/releases/download/${TOFU_VERSION}/tofu_${TOFU_VERSION##v}_linux_${TARGETARCH}.zip" | \
bsdtar -xf - -C /usr/local/bin tofu && \
chmod 755 /usr/local/bin/tofu && \
apk del .build-deps && \
Expand Down
4 changes: 3 additions & 1 deletion plugin/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/Masterminds/semver/v3"
Expand All @@ -24,9 +25,10 @@ func installPackage(ctx context.Context, client *http.Client, version string, ma
}

packageURL := fmt.Sprintf(
"https://github.com/opentofu/opentofu/releases/download/v%s/tofu_%s_linux_amd64.zip",
"https://github.com/opentofu/opentofu/releases/download/v%s/tofu_%s_linux_%s.zip",
semverVersion.String(),
semverVersion.String(),
runtime.GOARCH,
)

tmpdir, err := os.MkdirTemp("/tmp", "tofu_dl_")
Expand Down

0 comments on commit 15b2b4b

Please sign in to comment.