Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
nimrod
tf
Compare revisions
0f2f11816b5db723ad20cefb664d2daaf2f857f9 to 0c8701453edc1e08f6770e9c4222c600c747c123
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
nimrod/tf
Select target project
No results found
0c8701453edc1e08f6770e9c4222c600c747c123
Select Git revision
Swap
Target
nimrod/tf
Select target project
nimrod/tf
1 result
0f2f11816b5db723ad20cefb664d2daaf2f857f9
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Address different cases with apply.
· cce6a4d4
nimrod
authored
4 months ago
We can't add -var-file to an apply command if a plan is specified.
cce6a4d4
Some documentation fixes.
· 0c870145
nimrod
authored
4 months ago
0c870145
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+4
-4
4 additions, 4 deletions
README.rst
tf.py
+17
-0
17 additions, 0 deletions
tf.py
with
21 additions
and
4 deletions
README.rst
View file @
0c870145
...
...
@@ -52,10 +52,10 @@ end with :code:`.tfvars`, a :code:`-var-file` argument is added. For example:
:code:`-var-file=prod/a.tfvars` and :code:`-var-file=prod/b.tfvars`.
By default :code:`tf` invokes :code:`terraform`, but if you're using a
different tool (like `OpenTofu <https://opentofu.org/>`_ you can set the
:code:`TF_CLI` environment variable to that tool name. If you wish to know
the
exact command :code:`tf` is running set the :code:`TF_DEBUG` environment
variable to :code:`1` and the command will printed before
the
it's invoked.
different tool (like `OpenTofu <https://opentofu.org/>`_
)
you can set the
:code:`TF_CLI` environment variable to that tool
's
name. If you wish to know
the
exact command :code:`tf` is running set the :code:`TF_DEBUG` environment
variable to :code:`1` and the command will printed before it's invoked.
License
-------
...
...
This diff is collapsed.
Click to expand it.
tf.py
100644 → 100755
View file @
0c870145
...
...
@@ -83,6 +83,23 @@ def wrapper():
print
(
f
"
Can
'
t find
{
TF_CLI
}
.
"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
# We can't add -var-file to an apply command with a plan. So we check all
# of the args after the apply arg and if all of them are switches we assume
# that a plan isn't specified (technically the plan file can also start
# with a "-" and look like a switch, but let's not go there).
if
command
==
"
apply
"
:
apply_index
=
sys
.
argv
.
index
(
"
apply
"
)
if
not
all
(
map
(
lambda
x
:
x
.
startswith
(
"
-
"
),
sys
.
argv
[
apply_index
+
1
:])
):
# No all args are switches, so a plan is specified and we don't add
# the -var-file switch.
try
:
os
.
execvp
(
TF_CLI
,
args
)
# nosec
except
FileNotFoundError
:
print
(
f
"
Can
'
t find
{
TF_CLI
}
.
"
,
file
=
sys
.
stderr
)
sys
.
exit
(
1
)
# We need to add the var files after the Terraform command (if we add it
# before Terraform doesn't accept them) but not at the end (not to modify
# other argument that accept optional values). So we add them right after
...
...
This diff is collapsed.
Click to expand it.