Skip to content

restore_to_point_in_time does not allow cross-account cloning #16465

Description

@klang

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.18.0

Affected Resource(s)

  • aws_rds_cluster

Terraform Configuration Files

resource "aws_rds_cluster" "rds" {
  cluster_identifier = "${terraform.workspace}-${var.project}"
  vpc_security_group_ids = var.rds_security_groups
  db_subnet_group_name = aws_db_subnet_group.rds.name
  db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.rds.name
  skip_final_snapshot = true
  restore_to_point_in_time {
    source_cluster_identifier  = var.source_cluster_identifier
    restore_type               = "copy-on-write"
    use_latest_restorable_time = true

  }
}

Debug Output

2020/11/27 16:50:29 [ERROR] eval: *terraform.EvalDiff, err: only lowercase alphanumeric characters and hyphens allowed in "restore_to_point_in_time.0.source_cluster_identifier"
2020/11/27 16:50:29 [ERROR] eval: *terraform.EvalSequence, err: only lowercase alphanumeric characters and hyphens allowed in "restore_to_point_in_time.0.source_cluster_identifier"

Panic Output

No panic, just the error messages below.

Expected Behavior

A clone of "prod" or "arn:aws:rds:eu-west-1:ACCOUNT_ID:cluster:prod" shared cross-account should result in a database cluster in a Development account, if ACCOUNT_ID refers to the Production account

Actual Behavior

if var.source_cluster_identifier contains the string "prod"

Error: DBClusterNotFoundFault: The source cluster could not be found or cannot be accessed: prod
	status code: 404, request id: 6523b38a-6522-42b7-ab9f-4dad5ba93e70

if var.source_cluster_identifier contains the string "arn:aws:rds:eu-west-1:ACCOUNT_ID:cluster:prod"

Error: only lowercase alphanumeric characters and hyphens allowed in "restore_to_point_in_time.0.source_cluster_identifier"

  on ../modules/rds-aurora/main.tf line 53, in resource "aws_rds_cluster" "rds":
  53:     source_cluster_identifier  = var.source_cluster_identifier

Where the value of var.source_cluster_identifier is found like this

aws rds describe-db-clusters --include-shared | jq '.DBClusters[].DBClusterArn'
"arn:aws:rds:eu-west-1:ACCOUNT_ID:cluster:prod"

and the "prod" cluster is shared form.

Steps to Reproduce

  1. terraform apply if var.source_cluster_identifier contains the string "prod"

  2. terraform plan if var.source_cluster_identifier contains the string "arn:aws:rds:eu-west-1:ACCOUNT_ID:cluster:prod"

Important Factoids

According to the documentation from AWS it should be possible to establish a cross-account-clone.

The aws-cli refers to this operation as aws rds restore-db-cluster-to-point-in-time help which specifies that --source-db-cluster-identifier has to be an arn, in the cross-account situation.

References

Metadata

Metadata

Assignees

Labels

bugAddresses a defect in current functionality.service/rdsIssues and PRs that pertain to the rds service.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions