Below is the code to create the snapshot
resource “random_string” “random” {
length = 16
special = false
#keepers = {
engine_version = “${var.engine_version}”
db_snapshot_identifier = “${var.db_identifier_snap}”
#}
lifecycle {
ignore_changes = all
}
}
module “snapshot” {
source = “…/…/…/terraform-modules/rds-common/db_snapshot”
db_instance_identifier = var.identifier
db_snapshot_identifier = “{var.db_identifier_snap}upgrade{random_string.random.result}”
create = true
depends_on = [module.ora1-example]
}
resource “aws_db_snapshot_copy” “example” {
source_db_snapshot_identifier = “{module.snapshot.db_snapshot_arn}"
target_db_snapshot_identifier = "{var.db_identifier_snap}upgrade${random_string.random.result}-copy”
depends_on = [module.ora1-example]
}
module.snapshot.aws_db_snapshot.this[0]: Refreshing state… [id=manualsnapupgradetkeruzbrxeznmfuv]
╷
│ Error: Incorrect attribute value type
│
│ on main.tf line 34, in resource “aws_db_snapshot_copy” “example”:
│ 34: source_db_snapshot_identifier = “${module.snapshot.db_snapshot_arn}”
│ ├────────────────
│ │ module.snapshot.db_snapshot_arn is tuple with 1 element
│
│ Inappropriate value for attribute “source_db_snapshot_identifier”: string required.