Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Images
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
rc
Terraform Images
Commits
47cd6481
Commit
47cd6481
authored
2 years ago
by
Matjaz Gregoric
Browse files
Options
Downloads
Patches
Plain Diff
chore: move default config file location into a var
parent
9a7af1f5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bin/gitlab-terraform.sh
+5
-3
5 additions, 3 deletions
src/bin/gitlab-terraform.sh
with
5 additions
and
3 deletions
src/bin/gitlab-terraform.sh
+
5
−
3
View file @
47cd6481
...
...
@@ -94,9 +94,11 @@ export TF_VAR_CI_PROJECT_URL="${TF_VAR_CI_PROJECT_URL:-${CI_PROJECT_URL}}"
# Use terraform automation mode (will remove some verbose unneeded messages)
export
TF_IN_AUTOMATION
=
true
DEFAULT_TF_CONFIG_PATH
=
"
$HOME
/.terraformrc"
# Set a Terraform CLI Configuration File
if
[
-z
"
$TF_CLI_CONFIG_FILE
"
]
&&
[
-f
"
$
HOME
/.terraformrc
"
]
;
then
export
TF_CLI_CONFIG_FILE
=
"
$
HOME
/.terraformrc
"
if
[
-z
"
$
{
TF_CLI_CONFIG_FILE
}
"
]
&&
[
-f
"
$
{
DEFAULT_TF_CONFIG_PATH
}
"
]
;
then
export
TF_CLI_CONFIG_FILE
=
"
$
{
DEFAULT_TF_CONFIG_PATH
}
"
fi
...
...
@@ -118,7 +120,7 @@ terraform_authenticate_private_registry() {
else
# If we have a version older than 1.2.0, we use the credentials file.
# This authentication method can be safely deleted when we'll remove support for Terraform 1.0 and 1.1
export
TF_CLI_CONFIG_FILE
=
"
${
TF_CLI_CONFIG_FILE
:-
$
HOME
/.terraformrc
}
"
export
TF_CLI_CONFIG_FILE
=
"
${
TF_CLI_CONFIG_FILE
:-
$
DEFAULT_TF_CONFIG_PATH
}
"
if
[
!
-f
"
${
TF_CLI_CONFIG_FILE
}
"
]
&&
[
"
${
CI_SERVER_PROTOCOL
}
"
=
"https"
]
&&
[
-n
"
${
CI_SERVER_HOST
}
"
]
&&
[
-n
"
${
CI_SERVER_PORT
}
"
]
;
then
cat
<<
EOF
> "
${
TF_CLI_CONFIG_FILE
}
"
credentials "
${
CI_SERVER_HOST
}
:
${
CI_SERVER_PORT
}
" {
...
...
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