이 제품은 선택한 Datadog 사이트에서 지원되지 않습니다. ().
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

Id: terraform-gcp-sql-db-instance-backup-disabled

Provider: GCP

Platform: Terraform

Severity: Medium

Category: Backup

Learn More

Description

This check verifies whether automated backups are enabled for all Google Cloud SQL database instances by ensuring the backup_configuration block has the enabled = true attribute. If automated backups are disabled or the backup_configuration block is missing, databases are at risk of unrecoverable data loss in the event of accidental deletion, corruption, or other failures. When automated backups are disabled, the configuration appears as follows:

settings {
    backup_configuration {
        enabled = false
    }
}

To mitigate this risk, ensure backups are enabled using the following configuration:

settings {
    backup_configuration {
        enabled = true
    }
}

This ensures that point-in-time recovery is possible and critical business data can be restored when needed.

Compliant Code Examples

resource "google_sql_database_instance" "negative1" {
    name             = "master-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"
 
    settings {
        backup_configuration{
            enabled = true
        }
    }
}

Non-Compliant Code Examples

resource "google_sql_database_instance" "positive1" {
    name             = "master-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"

    settings {
        tier = "db-f1-micro"
    }
}

resource "google_sql_database_instance" "positive2" {
    name             = "master-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"

    settings {
        tier = "db-f1-micro"
        backup_configuration{
            binary_log_enabled = true
        }
    }
}

resource "google_sql_database_instance" "positive3" {
    name             = "master-instance"
    database_version = "POSTGRES_11"
    region           = "us-central1"

    settings {
        backup_configuration{
            enabled = false
        }
    }
}