Use this data source to get information about a DB Cluster Snapshot for use when provisioning DB clusters.
data "aws_db_cluster_snapshot" "development_final_snapshot" {
db_cluster_identifier = "development_cluster"
most_recent = true
}
# Use the last snapshot of the dev database before it was destroyed to create
# a new dev database.
resource "aws_rds_cluster" "aurora" {
cluster_identifier = "development_cluster"
snapshot_identifier = data.aws_db_cluster_snapshot.development_final_snapshot.id
db_subnet_group_name = "my_db_subnet_group"
lifecycle {
ignore_changes = [snapshot_identifier]
}
}
resource "aws_rds_cluster_instance" "aurora" {
cluster_identifier = aws_rds_cluster.aurora.id
instance_class = "db.t2.small"
db_subnet_group_name = "my_db_subnet_group"
}
This data source supports the following arguments:
most_recent
- (Optional) If more than one result is returned, use the most recent Snapshot.db_cluster_identifier
- (Optional) Returns the list of snapshots created by the specific db_clusterdb_cluster_snapshot_identifier
- (Optional) Returns information on a specific snapshot_id.snapshot_type
- (Optional) Type of snapshots to be returned. If you don't specify a SnapshotType
value, then both automated and manual DB cluster snapshots are returned. Shared and public DB Cluster Snapshots are not
included in the returned results by default. Possible values are, automated
, manual
, shared
, public
and awsbackup
.include_shared
- (Optional) Set this value to true to include shared manual DB Cluster Snapshots from other
AWS accounts that this AWS account has been given permission to copy or restore, otherwise set this value to false.
The default is false
.include_public
- (Optional) Set this value to true to include manual DB Cluster Snapshots that are public and can be
copied or restored by any AWS account, otherwise set this value to false. The default is false
.tags
- (Optional) Mapping of tags, each pair of which must exactly match
a pair on the desired DB cluster snapshot.This data source exports the following attributes in addition to the arguments above:
allocated_storage
- Allocated storage size in gigabytes (GB).availability_zones
- List of EC2 Availability Zones that instances in the DB cluster snapshot can be restored in.db_cluster_identifier
- Specifies the DB cluster identifier of the DB cluster that this DB cluster snapshot was created from.db_cluster_snapshot_arn
- The ARN for the DB Cluster Snapshot.engine_version
- Version of the database engine for this DB cluster snapshot.engine
- Name of the database engine.id
- Snapshot ID.kms_key_id
- If storage_encrypted is true, the AWS KMS key identifier for the encrypted DB cluster snapshot.license_model
- License model information for the restored DB cluster.port
- Port that the DB cluster was listening on at the time of the snapshot.snapshot_create_time
- Time when the snapshot was taken, in Universal Coordinated Time (UTC).source_db_cluster_snapshot_identifier
- DB Cluster Snapshot ARN that the DB Cluster Snapshot was copied from. It only has value in case of cross customer or cross region copy.status
- Status of this DB Cluster Snapshot.storage_encrypted
- Whether the DB cluster snapshot is encrypted.vpc_id
- VPC ID associated with the DB cluster snapshot.tags
- Map of tags for the resource.