Skip to content

Commit

Permalink
Add -pattern not to gcp=sql-datavase-require-ssl to allow new fix int…
Browse files Browse the repository at this point in the history
…roduced in version 6.0 (#3532)
  • Loading branch information
0xDC0DE authored Dec 13, 2024
1 parent 576e1bd commit 0f5a85c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
16 changes: 14 additions & 2 deletions terraform/gcp/security/gcp-sql-database-require-ssl.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# fail
# ruleid: gcp-sql-database-require-ssl
resource "google_sql_database_instance" "fail" {
database_version = "MYSQL_8_0"
Expand All @@ -18,4 +17,17 @@ resource "google_sql_database_instance" "success" {
ipv4_enabled = true
require_ssl = true
}
}
}

# ok: gcp-sql-database-require-ssl
resource "google_sql_database_instance" "main" {
name = "some-example-name"
database_version = "POSTGRES_15"
region = "europe-west3"
settings {
tier = "db-f1-micro"
ip_configuration {
ssl_mode = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"
}
}
}
10 changes: 10 additions & 0 deletions terraform/gcp/security/gcp-sql-database-require-ssl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ rules:
}
...
}
- pattern-not-inside: |
resource "google_sql_database_instance" "..." {
...
ip_configuration {
...
ssl_mode = ...
...
}
...
}
message: >-
Ensure all Cloud SQL database instance requires all incoming connections to use SSL
metadata:
Expand Down

0 comments on commit 0f5a85c

Please sign in to comment.