# 

# exoscale_database_uri (Data Source)

Fetch Exoscale [Database](https://community.exoscale.com/documentation/dbaas/) URI data.

Corresponding resource: [exoscale_database]({{< ref "../resources/database.md" >}}).

!> **WARNING:** This datasource stores sensitive information in your Terraform state. Please be sure to correctly understand implications and how to mitigate potential risks before using it.

## Example Usage

```terraform
resource "exoscale_database" "my_database" {
  zone = "ch-gva-2"
  name = "my-database"

  type = "pg"
  plan = "startup-4"

  maintenance_dow  = "sunday"
  maintenance_time = "23:00:00"

  termination_protection = true

  pg = {
    version = "13"

    backup_schedule = "04:00"

    ip_filter = [
      "1.2.3.4/32",
      "5.6.7.8/32",
    ]

    pg_settings = jsonencode({
      timezone : "Europe/Zurich"
    })
  }
}

data "exoscale_database_uri" "my_database" {
  name = "my-database"
  type = "pg"
  zone = "ch-gva-2"
}

output "my_database_uri" {
  value = data.exoscale_database_uri.my_database.uri
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name of database service to match.
- `type` (String) The type of the database service (`kafka`, `mysql`, `opensearch`, `pg`, `valkey`, `grafana`).
- `zone` (String) The Exoscale Zone name.

### Optional

- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `db_name` (String) Default database name
- `host` (String) Database service hostname
- `id` (String) The ID of this resource.
- `password` (String, Sensitive) Admin user password
- `port` (Number) Database service port
- `schema` (String) Database service connection schema
- `uri` (String, Sensitive) Database service connection URI.
- `username` (String) Admin user username

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.

