Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
run: |
pip install pre-commit
go install github.com/hashicorp/terraform-config-inspect@latest
make deps
- name: Initialize terraform modules
if: ${{ matrix.directory != '.' }}
run: |
Expand Down Expand Up @@ -112,9 +113,7 @@ jobs:
- name: Install pre-commit dependencies
run: |
pip install pre-commit
go install github.com/terraform-docs/[email protected]
go install github.com/hashicorp/terraform-config-inspect@latest
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
make deps
- name: Execute pre-commit
# Run all pre-commit checks on max version supported
if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ repos:
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- id: terrascan
- repo: local
hooks:
- id: terraform_init
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ deps:
unzip tflint.zip && \
rm tflint.zip && \
mv tflint "`go env GOPATH`/bin"
curl -L "`curl -s https://api.github.com/repos/tenable/terrascan/releases/latest | grep -o -E "https://.+?_Linux_x86_64.tar.gz"`" -o terrascan.tar.gz && \
tar -xf terrascan.tar.gz terrascan && \
rm terrascan.tar.gz && \
install terrascan "`go env GOPATH`/bin" && \
rm terrascan

clean:
find -name ".terraform" -type d | xargs rm -rf
Expand Down
4 changes: 4 additions & 0 deletions examples/single-project-k8s/credentials.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ resource "google_project_iam_member" "event_receiver" {
}

resource "google_project_iam_member" "token_creator" {
# Why: Image scanning is run from inside a container. As it needs to get the image from the registry it needs a token to get it from the registry.
# How to avoid security issues: As in the next implementation scanning will be run from within cloudrun which has needed permissions and won't need a token.
# Warning: Organization users musn't be able to impersonate as the created service account.
#ts:skip=AC_GCP_0006
project = data.google_client_config.current.project
member = "serviceAccount:${google_service_account.connector_sa.email}"
role = "roles/iam.serviceAccountTokenCreator"
Expand Down
4 changes: 4 additions & 0 deletions modules/infrastructure/cloud_build_permission/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Required to execute cloud build runs with this same service account
resource "google_project_iam_member" "service_account_user_itself" {
# Why: Image scanning is run from inside a container. As it needs to get the image from the registry it needs a token to get it from the registry.
# How to avoid security issues: As in the next implementation scanning will be run from within cloudrun which has needed permissions and won't need a token.
# Warning: Organization users musn't be able to impersonate as the created service account.
#ts:skip=AC_GCP_0006
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking, but just to enhance understandably, would change order of the comments

ex.:

# AC_GCP_006
# Warning: Organization users musn't be able to impersonate as the created service account.
# Why: Image scanning is run from inside a container. As it needs to get the image from the registry it needs a token to get it from the registry.
# How to avoid security issues: As in the next implementation scanning will be run from within cloudrun which has needed permissions and won't need a token.
#ts:skip=AC_GCP_0006

project = var.project_id
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${var.cloud_connector_sa_email}"
Expand Down
4 changes: 4 additions & 0 deletions modules/services/cloud-connector/pubsub_permissions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ resource "google_project_iam_member" "event_receiver" {
}

resource "google_project_iam_member" "token_creator" {
# Why: Image scanning is run from inside a container. As it needs to get the image from the registry it needs a token to get it from the registry.
# How to avoid security issues: As in the next implementation scanning will be run from within cloudrun which has needed permissions and won't need a token.
# Warning: Organization users musn't be able to impersonate as the created service account.
#ts:skip=AC_GCP_0006
project = var.project_id
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-pubsub.iam.gserviceaccount.com"
role = "roles/iam.serviceAccountTokenCreator"
Expand Down