Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: DocumentDB Cluster FinalSnapshotIdentifier is required when a final snapshot is required #37582

Open
bcdady opened this issue May 17, 2024 · 1 comment
Labels
bug Addresses a defect in current functionality. service/docdb Issues and PRs that pertain to the docdb service.

Comments

@bcdady
Copy link

bcdady commented May 17, 2024

Terraform Core Version

1.6.5, 1.7.5, 1.8.3

AWS Provider Version

5.49.0

Affected Resource(s)

  • aws_docdb_cluster

Expected Behavior

  • When skip_final_snapshot = true, Terraform will destroy the specified docdb cluster without attempting to take a final snapshot
  • When final_snapshot_identifier is specified, Terraform will create the snapshot, and then destroy the specified docdb cluster

Actual Behavior

  • When skip_final_snapshot = true, AND/OR final_snapshot_identifier is specified, the following error is displayed after running terraform apply:

Relevant Error/Panic Output Snippet

aws_docdb_cluster.this: Destroying... [id=docdb-cluster-dev]

│ Error: DocumentDB Cluster FinalSnapshotIdentifier is required when a final snapshot is required

Terraform Configuration Files

resource "aws_docdb_cluster" "this" {
  cluster_identifier        = "docdb-cluster-${var.env}"
  engine_version            = var.engine_version
  master_username           = local.master_username
  master_password           = random_password.admin_password.result
  backup_retention_period   = var.env == "prod" ? 20 : 10
  db_subnet_group_name      = "private-vpc-subnets"
  skip_final_snapshot       = true
  final_snapshot_identifier = "docdb-cluster-${var.env}-final-snapshot"
  vpc_security_group_ids    = [aws_security_group.allow_mongo.id]
}

Steps to Reproduce

Provision a docdb cluster, with 1 instance, and then change an argument that will cause Terraform to need to destroy and replace the docdb cluster.

Debug Output

aws_docdb_cluster.this: Destroying... [id=docdb-cluster-dev]
2024-05-17T13:25:42.862-0600 [INFO]  Starting apply for aws_docdb_cluster.this
2024-05-17T13:25:42.862-0600 [DEBUG] aws_docdb_cluster.this: applying the planned Delete change
2024-05-17T13:25:42.863-0600 [ERROR] provider.terraform-provider-aws_v5.49.0_x5: Response contains error diagnostic: @module=sdk.proto diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail="" diagnostic_summary="DocumentDB Cluster FinalSnapshotIdentifier is required when a final snapshot is required" tf_proto_version=5.4 tf_req_id=04229dd6-5214-c27c-3007-a6517914fdf7 tf_resource_type=aws_docdb_cluster timestamp=2024-05-17T13:25:42.863-0600
2024-05-17T13:25:42.864-0600 [DEBUG] State storage *remote.State declined to persist a state snapshot
2024-05-17T13:25:42.864-0600 [ERROR] vertex "aws_docdb_cluster.this (destroy)" error: DocumentDB Cluster FinalSnapshotIdentifier is required when a final snapshot is required
2024-05-17T13:25:42.864-0600 [DEBUG] states/remote: state read serial is: 19; serial is: 19
2024-05-17T13:25:42.864-0600 [DEBUG] states/remote: state read lineage is: ae2912eb-32d4-c14c-5363-768da7281170; lineage is: ae2912eb-32d4-c14c-5363-768da7281170
...
╷
│ Error: DocumentDB Cluster FinalSnapshotIdentifier is required when a final snapshot is required
│

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@bcdady bcdady added the bug Addresses a defect in current functionality. label May 17, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/docdb Issues and PRs that pertain to the docdb service. label May 17, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 17, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/docdb Issues and PRs that pertain to the docdb service.
Projects
None yet
Development

No branches or pull requests

2 participants