Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
86d06839
Commit
86d06839
authored
Jan 04, 2022
by
Viktor Nagy (GitLab)
Committed by
Marcel Amirault
Jan 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add IAC SAST testing to the pipeline
parent
3be159c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
doc/user/infrastructure/iac/index.md
doc/user/infrastructure/iac/index.md
+18
-8
lib/gitlab/ci/templates/Terraform.latest.gitlab-ci.yml
lib/gitlab/ci/templates/Terraform.latest.gitlab-ci.yml
+2
-0
No files found.
doc/user/infrastructure/iac/index.md
View file @
86d06839
...
...
@@ -15,12 +15,14 @@ GitLab, and support Terraform best practices.
## Quick Start
> SAST test was [introduced](https://gitlab.com/groups/gitlab-org/-/epics/6655) in GitLab 14.6.
Use the following
`.gitlab-ci.yml`
to set up a basic Terraform project integration
for GitLab versions 14.0 and later:
```
yaml
include
:
-
template
:
Terraform.gitlab-ci.yml
-
template
:
Terraform.
latest.
gitlab-ci.yml
variables
:
# If not using GitLab's HTTP backend, remove this line and specify TF_HTTP_* variables
...
...
@@ -30,15 +32,23 @@ variables:
# TF_ROOT: terraform/production
```
This template includes
some opinionated decisions, which
you can override:
This template includes
the following parameters that
you can override:
-
Including the latest
[
GitLab Terraform I
mage
](
https://gitlab.com/gitlab-org/terraform-images
)
.
-
Us
ing the
[
GitLab
managed Terraform State
](
#gitlab-managed-terraform-state
)
as
-
Uses the latest
[
GitLab Terraform i
mage
](
https://gitlab.com/gitlab-org/terraform-images
)
.
-
Us
es the
[
GitLab-
managed Terraform State
](
#gitlab-managed-terraform-state
)
as
the Terraform state storage backend.
-
Creating
[
four pipeline stages
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
)
:
`init`
,
`validate`
,
`build`
, and
`deploy`
. These stages
[
run the Terraform commands
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
)
`init`
,
`validate`
,
`plan`
,
`plan-json`
, and
`apply`
. The
`apply`
command only runs on the default branch.
-
Creates
[
four pipeline stages
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.latest.gitlab-ci.yml
)
:
`test`
,
`validate`
,
`build`
, and
`deploy`
. These stages
[
run the Terraform commands
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
)
`test`
,
`validate`
,
`plan`
,
`plan-json`
, and
`apply`
. The
`apply`
command only runs on the default branch.
-
Runs the
[
Terraform SAST scanner
](
../../application_security/iac_scanning/index.md#configure-iac-scanning-manually
)
,
that you can disable by creating a
`SAST_DISABLED`
environment variable and setting it to
`1`
.
The latest template described above might contain breaking changes between major GitLab releases. For users requiring more stable setups, we
recommend using the stable templates:
-
[
A ready to use version
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
)
-
[
A base template for customized setups
](
https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform/Base.gitlab-ci.yml
)
This video from January 2021 walks you through all the GitLab Terraform integration features:
...
...
lib/gitlab/ci/templates/Terraform.latest.gitlab-ci.yml
View file @
86d06839
...
...
@@ -5,9 +5,11 @@
include
:
-
template
:
Terraform/Base.latest.gitlab-ci.yml
# https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
-
template
:
Jobs/SAST-IaC.latest.gitlab-ci.yml
stages
:
-
validate
-
test
-
build
-
deploy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment