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
a6bf725e
Commit
a6bf725e
authored
4 years ago
by
Nicholas Klick
Browse files
Options
Downloads
Patches
Plain Diff
WIP
parent
2d821a55
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-11
1 addition, 11 deletions
.gitlab-ci.yml
Dockerfile
+0
-14
0 additions, 14 deletions
Dockerfile
src/bin/gitlab-terraform.sh
+0
-3
0 additions, 3 deletions
src/bin/gitlab-terraform.sh
with
1 addition
and
28 deletions
.gitlab-ci.yml
+
1
−
11
View file @
a6bf725e
...
...
@@ -4,7 +4,6 @@ variables:
BUILD_IMAGE_NAME
:
"
$CI_REGISTRY_IMAGE/branches/$CI_COMMIT_REF_SLUG-$TERRAFORM_VERSION:$CI_COMMIT_SHA"
RELEASE_IMAGE_NAME
:
"
$CI_REGISTRY_IMAGE/releases/$TERRAFORM_VERSION"
TF_ADDRESS
:
"
$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$CI_PIPELINE_IID-$STATE_NAME"
TFPLANTOOL_VERSION
:
"
v0.1.1"
.versions
:
parallel
:
...
...
@@ -17,14 +16,6 @@ variables:
TERRAFORM_BINARY_VERSION
:
"
0.14.11"
TERRAFORM_VERSION
:
"
0.14"
STATE_NAME
:
terraform014
-
BASE_IMAGE
:
"
alpine:3.13.1"
TERRAFORM_BINARY_VERSION
:
"
0.13.7"
TERRAFORM_VERSION
:
"
0.13"
STATE_NAME
:
terraform013
-
BASE_IMAGE
:
"
alpine:3.13.1"
TERRAFORM_BINARY_VERSION
:
"
0.12.31"
TERRAFORM_VERSION
:
"
0.12"
STATE_NAME
:
terraform012
stages
:
-
lint
...
...
@@ -66,7 +57,7 @@ build:
-
.versions
stage
:
build
script
:
-
docker image build --tag "$BUILD_IMAGE_NAME" --build-arg BASE_IMAGE=$BASE_IMAGE
--build-arg TERRAFORM_BINARY_VERSION=$TERRAFORM_BINARY_VERSION --build-arg TFPLANTOOL_VERSION=$TFPLANTOOL_VERSION
.
-
docker image build --tag "$BUILD_IMAGE_NAME" --build-arg BASE_IMAGE=$BASE_IMAGE .
-
docker image push "$BUILD_IMAGE_NAME"
.test
:
...
...
@@ -105,7 +96,6 @@ test-plan:
script
:
-
gitlab-terraform plan
-
if [[ ! -f "plan.cache" ]]; then echo "expected to find a plan.cache file"; exit 1; fi
-
tfplantool -f plan.cache backend get -k username
-
gitlab-terraform plan-json
-
if [[ ! -f "plan.json" ]]; then echo "expected to find a plan.json file"; exit 1; fi
-
mv plan.cache $TERRAFORM_VERSION-plan.cache
...
...
This diff is collapsed.
Click to expand it.
Dockerfile
+
0
−
14
View file @
a6bf725e
ARG
BASE_IMAGE
FROM
golang:1.16
AS
tfplantool
ARG
TFPLANTOOL_VERSION
ARG
TERRAFORM_BINARY_VERSION
WORKDIR
/tfplantool
RUN
git clone
--branch
$TFPLANTOOL_VERSION
--depth
1 https://gitlab.com/mattkasa/tfplantool.git .
RUN
sed
-i
-e
"/github
\.
com
\/
hashicorp
\/
terraform/s/ v.*
\$
/ v
$TERRAFORM_BINARY_VERSION
/"
go.mod
RUN
go get
-d
-v
./...
RUN
CGO_ENABLED
=
0
GOOS
=
linux go build
-tags
terraform_
${
TERRAFORM_BINARY_VERSION
}
-a
-installsuffix
cgo
-o
tfplantool .
FROM
$BASE_IMAGE
ARG
TERRAFORM_BINARY_VERSION
...
...
@@ -28,8 +16,6 @@ RUN ( curl -sLo terraform.zip "https://releases.hashicorp.com/terraform/${TERRAF
WORKDIR
/
COPY
--from=tfplantool /tfplantool/tfplantool /usr/bin/tfplantool
COPY
src/bin/gitlab-terraform.sh /usr/bin/gitlab-terraform
RUN
chmod
+x /usr/bin/gitlab-terraform
...
...
This diff is collapsed.
Click to expand it.
src/bin/gitlab-terraform.sh
+
0
−
3
View file @
a6bf725e
...
...
@@ -51,9 +51,6 @@ export TF_HTTP_RETRY_WAIT_MIN="${TF_HTTP_RETRY_WAIT_MIN:-5}"
export
TF_IN_AUTOMATION
=
true
apply
()
{
if
!
terraform_is_at_least 0.13.2
;
then
tfplantool
-f
"
${
plan_cache
}
"
backend
set
-k
password
-v
"
${
TF_PASSWORD
}
"
fi
terraform
"
${
@
}
"
-input
=
false
"
${
plan_cache
}
"
}
...
...
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