Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
fix: checkov security error
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienJabs committed Nov 19, 2024
1 parent aa340fa commit 75c672a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
28 changes: 22 additions & 6 deletions modules/mysql/sql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,29 @@ resource "random_id" "this" {
byte_length = 4
}

resource "google_storage_bucket" "logging_bucket" {
name = "bucket-access-logs"
location = "europe-west3"
project = var.project_id
force_destroy = true
}

resource "google_storage_bucket" "script" {
count = var.init_custom_sql_script != "" ? 1 : 0
name = "sql-script-${random_id.this[0].hex}"
location = "europe-west3"
force_destroy = true
project = var.project_id
public_access_prevention = "enforced"
count = var.init_custom_sql_script != "" ? 1 : 0
name = "sql-script-${random_id.this[0].hex}"
location = "europe-west3"
force_destroy = true
project = var.project_id
public_access_prevention = "enforced"
uniform_bucket_level_access = true
versioning {
enabled = true
}

logging {
log_bucket = google_storage_bucket.logging_bucket.name
log_object_prefix = "access_logs/"
}
}

resource "google_storage_bucket_object" "sql_script" {
Expand Down
28 changes: 22 additions & 6 deletions modules/postgresql/sql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,29 @@ resource "random_id" "this" {
byte_length = 4
}

resource "google_storage_bucket" "logging_bucket" {
name = "bucket-access-logs"
location = "europe-west3"
project = var.project_id
force_destroy = true
}

resource "google_storage_bucket" "script" {
count = var.init_custom_sql_script != "" ? 1 : 0
name = "sql-script-${random_id.this[0].hex}"
location = "europe-west3"
force_destroy = true
project = var.project_id
public_access_prevention = "enforced"
count = var.init_custom_sql_script != "" ? 1 : 0
name = "sql-script-${random_id.this[0].hex}"
location = "europe-west3"
force_destroy = true
project = var.project_id
public_access_prevention = "enforced"
uniform_bucket_level_access = true
versioning {
enabled = true
}

logging {
log_bucket = google_storage_bucket.logging_bucket.name
log_object_prefix = "access_logs/"
}
}

resource "google_storage_bucket_object" "sql_script" {
Expand Down

0 comments on commit 75c672a

Please sign in to comment.