Terraform data source for listing RDS Database Instances.
data "aws_db_instances" "example" {
filter {
name = "db-instance-id"
values = ["my-database-id"]
}
}
data "aws_db_instances" "example" {
tags = {
Env = "test"
}
}
The following arguments are optional:
filter
- (Optional) Configuration block(s) used to filter instances with AWS supported attributes, such as engine
, db-cluster-id
or db-instance-id
for example. Detailed below.tags
- (Optional) Map of tags, each pair of which must exactly match a pair on the desired instances.The filter
configuration block supports the following arguments:
name
- (Required) Name of the filter field. Valid values can be found in the RDS DescribeDBClusters API Reference or RDS DescribeDBInstances API Reference.values
- (Required) Set of values that are accepted for the given filter field. Results will be selected if any given value matches.This data source exports the following attributes in addition to the arguments above:
instance_arns
- ARNs of the matched RDS instances.instance_identifiers
- Identifiers of the matched RDS instances.