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
3ce2b643
Unverified
Commit
3ce2b643
authored
7 months ago
by
Timo Furrer
Browse files
Options
Downloads
Patches
Plain Diff
Rename `TF_PLAN_JSON` to `GITLAB_TOFU_PLAN_JSON`
Changelog: changed
parent
fe5fea97
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/gitlab-tofu.sh
+6
-5
6 additions, 5 deletions
src/gitlab-tofu.sh
templates/apply.yml
+1
-1
1 addition, 1 deletion
templates/apply.yml
with
7 additions
and
6 deletions
src/gitlab-tofu.sh
+
6
−
5
View file @
3ce2b643
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
# GITLAB_TOFU_APPLY_NO_PLAN: if set to true, the apply command does not use a plan cache file.
# GITLAB_TOFU_APPLY_NO_PLAN: if set to true, the apply command does not use a plan cache file.
# GITLAB_TOFU_PLAN_NAME: the name of the plan cache and json files. Defaults to `plan`.
# GITLAB_TOFU_PLAN_NAME: the name of the plan cache and json files. Defaults to `plan`.
# GITLAB_TOFU_PLAN_CACHE: if set is the full path of the plan cache file. Defaults to `<root>/$GITLAB_TOFU_PLAN_NAME.cache`
# GITLAB_TOFU_PLAN_CACHE: if set is the full path of the plan cache file. Defaults to `<root>/$GITLAB_TOFU_PLAN_NAME.cache`
# GITLAB_TOFU_PLAN_JSON: if set is the full path of the plan json file. Defaults to `<root>/$GITLAB_TOFU_PLAN_NAME.json`
#
#
# Respected OpenTofu Environment Variables:
# Respected OpenTofu Environment Variables:
# > these are variables that are
# > these are variables that are
...
@@ -134,9 +135,9 @@ if [ -z "${GITLAB_TOFU_PLAN_CACHE}" ]; then
...
@@ -134,9 +135,9 @@ if [ -z "${GITLAB_TOFU_PLAN_CACHE}" ]; then
GITLAB_TOFU_PLAN_CACHE
=
"
${
default_tf_plan_cache
:-${
GITLAB_TOFU_PLAN_NAME
}
.cache
}
"
GITLAB_TOFU_PLAN_CACHE
=
"
${
default_tf_plan_cache
:-${
GITLAB_TOFU_PLAN_NAME
}
.cache
}
"
fi
fi
# If
TF
_PLAN_JSON is not set then use either the plan.json file within TF_ROOT if set, or plan.json in CWD
# If
GITLAB_TOFU
_PLAN_JSON is not set then use either the plan.json file within TF_ROOT if set, or plan.json in CWD
if
[
-z
"
${
TF
_PLAN_JSON
}
"
]
;
then
if
[
-z
"
${
GITLAB_TOFU
_PLAN_JSON
}
"
]
;
then
TF
_PLAN_JSON
=
"
${
default_tf_plan_json
:-${
GITLAB_TOFU_PLAN_NAME
}
.json
}
"
GITLAB_TOFU
_PLAN_JSON
=
"
${
default_tf_plan_json
:-${
GITLAB_TOFU_PLAN_NAME
}
.json
}
"
fi
fi
# Set variables for the HTTP backend to default to TF_* values
# Set variables for the HTTP backend to default to TF_* values
...
@@ -265,7 +266,7 @@ if [ $sourced -eq 0 ]; then
...
@@ -265,7 +266,7 @@ if [ $sourced -eq 0 ]; then
if
[
"
${
GITLAB_TOFU_PLAN_WITH_JSON
}
"
=
'true'
]
;
then
if
[
"
${
GITLAB_TOFU_PLAN_WITH_JSON
}
"
=
'true'
]
;
then
if
[
"
$ret
"
-eq
0
]
||
[
"
$ret
"
-eq
2
]
;
then
if
[
"
$ret
"
-eq
0
]
||
[
"
$ret
"
-eq
2
]
;
then
if
!
tofu
"
${
TF_CHDIR_OPT
}
"
show
-json
"
${
GITLAB_TOFU_PLAN_CACHE
}
"
| jq
-r
"
${
JQ_PLAN
}
"
>
"
${
TF
_PLAN_JSON
}
"
;
then
if
!
tofu
"
${
TF_CHDIR_OPT
}
"
show
-json
"
${
GITLAB_TOFU_PLAN_CACHE
}
"
| jq
-r
"
${
JQ_PLAN
}
"
>
"
${
GITLAB_TOFU
_PLAN_JSON
}
"
;
then
exit
$?
exit
$?
fi
fi
...
@@ -277,7 +278,7 @@ if [ $sourced -eq 0 ]; then
...
@@ -277,7 +278,7 @@ if [ $sourced -eq 0 ]; then
exit
"
$ret
"
exit
"
$ret
"
;;
;;
"plan-json"
)
"plan-json"
)
tofu
"
${
TF_CHDIR_OPT
}
"
show
-json
"
${
GITLAB_TOFU_PLAN_CACHE
}
"
| jq
-r
"
${
JQ_PLAN
}
"
>
"
${
TF
_PLAN_JSON
}
"
tofu
"
${
TF_CHDIR_OPT
}
"
show
-json
"
${
GITLAB_TOFU_PLAN_CACHE
}
"
| jq
-r
"
${
JQ_PLAN
}
"
>
"
${
GITLAB_TOFU
_PLAN_JSON
}
"
;;
;;
"validate"
)
"validate"
)
$TF_IMPLICIT_INIT
&&
terraform_init
-backend
=
false
$TF_IMPLICIT_INIT
&&
terraform_init
-backend
=
false
...
...
This diff is collapsed.
Click to expand it.
templates/apply.yml
+
1
−
1
View file @
3ce2b643
...
@@ -75,7 +75,7 @@ spec:
...
@@ -75,7 +75,7 @@ spec:
description
:
'
Whether
a
plan
file
should
be
used.'
description
:
'
Whether
a
plan
file
should
be
used.'
plan_name
:
plan_name
:
default
:
'
plan'
default
:
'
plan'
description
:
'
The
name
of
the
plan
file
to
use.
Will
be
used
for
TF_PLAN_CACHE
and
TF_PLAN_JSON
.'
description
:
'
The
name
of
the
plan
file
to
use.
Will
be
used
for
plan
cache
and
json
files
.'
var_file
:
var_file
:
default
:
'
'
default
:
'
'
type
:
string
type
:
string
...
...
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