bridgecrewio / checkov

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
https://www.checkov.io/
Apache License 2.0
7.07k stars 1.11k forks source link

Azure SQL Server - Ensure that your Azure SQL Server supporting time critical applications are attached to a failover group #6116

Open tdefise opened 6 months ago

tdefise commented 6 months ago

Describe the issue It seems that there are no checks in order to ensure that your Azure SQL Server supporting time critical applications are attached to a failover group

Examples

resource "azurerm_resource_group" "example" {
  name     = "database-rg"
  location = "West Europe"
}

resource "azurerm_mssql_server" "primary" {
  name                         = "mssqlserver-primary"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "12.0"
  administrator_login          = "missadministrator"
  administrator_login_password = "thisIsKat11"
}

resource "azurerm_mssql_server" "secondary" {
  name                         = "mssqlserver-secondary"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = "North Europe"
  version                      = "12.0"
  administrator_login          = "missadministrator"
  administrator_login_password = "thisIsKat12"
}

resource "azurerm_mssql_database" "example" {
  name        = "exampledb"
  server_id   = azurerm_mssql_server.primary.id
  sku_name    = "S1"
  collation   = "SQL_Latin1_General_CP1_CI_AS"
  max_size_gb = "200"
}

resource "azurerm_mssql_failover_group" "example" {
  name      = "example"
  server_id = azurerm_mssql_server.primary.id
  databases = [
    azurerm_mssql_database.example.id
  ]

  partner_server {
    id = azurerm_mssql_server.secondary.id
  }

  read_write_endpoint_failover_policy {
    mode          = "Automatic"
    grace_minutes = 80
  }

}

Version (please complete the following information):

Additional context

To achieve higher availability and redundancy across regions, you it is possible to enable disaster recovery capabilities to quickly recover the database from a catastrophic regional failure. Options for disaster recovery with Azure SQL Database are:

The following table compares active geo-replication and failover groups, two disaster recovery options for Azure SQL Database:

image

stale[bot] commented 1 week ago

Thanks for contributing to Checkov! We've automatically marked this issue as stale to keep our issues list tidy, because it has not had any activity for 6 months. It will be closed in 14 days if no further activity occurs. Commenting on this issue will remove the stale tag. If you want to talk through the issue or help us understand the priority and context, feel free to add a comment or join us in the Checkov slack channel at codifiedsecurity.slack.com Thanks!