FAQ | This is a LIVE service | Changelog

Skip to content

Terraform-Module: avoid duplicate kics-iac-sast jobs

The terraform-module.yml template in this repo currently includes the kics-iac-sast job via the included Terraform-Module.gitlab-ci.yml AutoDevOps template. This causes duplicate jobs now that we also enforce the kics-iac-sast job via mandatory-jobs.gitlab-ci.yml.

image

Given that the duplicate is in the upstream Auto-DevOps template, I believe our only option is to remove our usage of the Terraform-Module.gitlab-ci.yml template, and instead, add the relevant bits from that template to our own terraform-module.yml template directly.

Off the top of my head, this would look something like:

# terraform-module.yml

include:
  # - template: Terraform-Module.gitlab-ci.yml <-- remove this line
  - template: Terraform/Module-Base.gitlab-ci.yml  # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Module-Base.gitlab-ci.yml <-- add this line
  - local: /auto-devops-stages.yml
  - local: /auto-devops/check-latest-tag-in-changelog.yml
  - local: /terraform-lint.yml
  - local: /fragments/docker-in-docker.yml

# ...

# Add the following job.
deploy:
  extends: .terraform-module:deploy
  rules:
    - if: $CI_COMMIT_TAG

I believe this config would keep the pipeline exactly the same, but would remove the duplicate sast job.