Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenTofu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
components
OpenTofu
Commits
6a0caec1
Commit
6a0caec1
authored
2 weeks ago
by
Markus Kuesters
Committed by
Timo Furrer
2 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix passing `-var-file` to commands that don't support it prior to OpenTofu 1.8.0
Changelog: fixed
parent
02975cf2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Dockerfile.alpine
+1
-0
1 addition, 0 deletions
Dockerfile.alpine
Dockerfile.debian
+1
-0
1 addition, 0 deletions
Dockerfile.debian
src/gitlab-tofu.sh
+15
-0
15 additions, 0 deletions
src/gitlab-tofu.sh
tests/unit/gitlab-tofu.bats
+13
-0
13 additions, 0 deletions
tests/unit/gitlab-tofu.bats
with
30 additions
and
0 deletions
Dockerfile.alpine
+
1
−
0
View file @
6a0caec1
...
...
@@ -25,6 +25,7 @@ RUN apk add --no-cache \
# see https://opentofu.org/docs/intro/install/standalone
# We may want to switch to installing manually from GitHub and verifying signature
ARG OPENTOFU_VERSION
ENV OPENTOFU_VERSION=${OPENTOFU_VERSION}
RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \
chmod +x install-opentofu.sh && \
./install-opentofu.sh --install-method standalone --opentofu-version "${OPENTOFU_VERSION}" && \
...
...
This diff is collapsed.
Click to expand it.
Dockerfile.debian
+
1
−
0
View file @
6a0caec1
...
...
@@ -40,6 +40,7 @@ RUN wget https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads
# see https://opentofu.org/docs/intro/install/standalone
# We may want to switch to installing manually from GitHub and verifying signature
ARG OPENTOFU_VERSION
ENV OPENTOFU_VERSION=${OPENTOFU_VERSION}
RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \
chmod +x install-opentofu.sh && \
./install-opentofu.sh --install-method standalone --opentofu-version "${OPENTOFU_VERSION}" && \
...
...
This diff is collapsed.
Click to expand it.
src/gitlab-tofu.sh
+
15
−
0
View file @
6a0caec1
...
...
@@ -231,6 +231,11 @@ fi
# Helper functions
# ================
# is_tofu_at_least checks if OPENTOFU_VERSION is at least the one provided
is_tofu_at_least
()
{
test
"
$(
printf
"%s
\n
$1
"
"
$OPENTOFU_VERSION
"
|
sort
-V
|
head
-1
)
"
=
"
$1
"
}
# define_http_backend defines the HTTP backend in a file called __gitlab-opentofu-backend.tf if no backend can be found.
# The backend configuration is attempted to be found with a simple grep.
define_http_backend
()
{
...
...
@@ -430,6 +435,11 @@ if [ $sourced -eq 0 ]; then
;;
"validate"
)
$should_do_implicit_init
&&
tofu_init
-backend
=
false
if
!
is_tofu_at_least
"1.8.0"
;
then
var_file_args
=
""
fi
# shellcheck disable=SC2086
tofu
"
${
tf_chdir_opt
}
"
"
${
@
}
"
${
var_file_args
}
;;
...
...
@@ -440,6 +450,11 @@ if [ $sourced -eq 0 ]; then
;;
"graph"
)
$should_do_implicit_init
&&
tofu_init
if
!
is_tofu_at_least
"1.8.0"
;
then
var_file_args
=
""
fi
# shellcheck disable=SC2086
tofu
"
${
tf_chdir_opt
}
"
"
${
@
}
"
${
var_file_args
}
;;
...
...
This diff is collapsed.
Click to expand it.
tests/unit/gitlab-tofu.bats
+
13
−
0
View file @
6a0caec1
...
...
@@ -230,3 +230,16 @@ EOF
$SHELL test.sh
}
@test "is_tofu_at_least helper function" {
load $(which gitlab-tofu)
OPENTOFU_VERSION="1.9.1" run is_tofu_at_least "1.8.0"
assert_success
OPENTOFU_VERSION="1.8.0" run is_tofu_at_least "1.8.0"
assert_success
OPENTOFU_VERSION="1.6.3" run is_tofu_at_least "1.8.0"
assert_failure
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment