> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# terraform-database-publicly-accessible

> A Terraform database is reachable from the public internet.

## What it flags

A database that a `.tf` file exposes to the internet with literal values:

* `aws_db_instance`, `aws_rds_cluster_instance`, `aws_redshift_cluster` or `aws_dms_replication_instance` with `publicly_accessible = true`. AWS then gives the instance a public DNS name and address; only its security group stands between it and the internet.
* `google_sql_database_instance` with an `authorized_networks` entry whose `value` is `0.0.0.0/0` or `::/0`.
* An Azure database firewall rule (`azurerm_postgresql_firewall_rule`, `azurerm_mysql_firewall_rule`, `azurerm_mssql_firewall_rule` and the flexible-server variants) from `0.0.0.0` to `255.255.255.255`.

Not flagged: `publicly_accessible = false` or a value from a variable, and the Azure `0.0.0.0`–`0.0.0.0` rule, which only admits Azure services.

```hcl theme={null}
resource "aws_db_instance" "main" {
  publicly_accessible  = false
  db_subnet_group_name = aws_db_subnet_group.private.name
}
```

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "terraform-database-publicly-accessible": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.