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]: aws_db_instance ca_cert_identifier not applied when creating from a snapshot #33572

Open
cg2v opened this issue Sep 21, 2023 · 4 comments
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.

Comments

@cg2v
Copy link

cg2v commented Sep 21, 2023

Terraform Core Version

1.5.7

AWS Provider Version

5.17.0

Affected Resource(s)

aws_rds_instance

Expected Behavior

When creating a database with both snapshot_identifier = "XXX" and ca_cert_identifier = "rds-ca-rsa2048-g1", the database is created with the correct certificate authority

Actual Behavior

The database is created with rds-ca-2019. Subsequent terraform runs do update the certificate authority

Relevant Error/Panic Output Snippet

# module.database.aws_db_instance.rds will be updated in-place
  ~ resource "aws_db_instance" "rds" {
      ~ ca_cert_identifier                    = "rds-ca-2019" -> "rds-ca-rsa2048-g1"
        id                                    = "db-ESVX3EXD54WKK3GE3DE6VDFMZ4"
        tags                                  = {}
        # (53 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Terraform Configuration Files

This is not a functional example. too bad.

resource "aws_db_instance" "rds" {
  identifier           = var.app_label
  engine               = "mysql"
  engine_version       = "8.0"
  instance_class       = "db.t3.micro"
  ca_cert_identifier = "rds-ca-rsa2048-g1"
  vpc_security_group_ids = [aws_security_group.rds.id]
  db_subnet_group_name = aws_db_subnet_group.rds.name
  snapshot_identifier = "${var.app_label}-master-snapshot"
  final_snapshot_identifier = "${var.app_label}-working-snapshot"
  storage_encrypted = true
  manage_master_user_password = true
  apply_immediately = true
}

Steps to Reproduce

run terraform apply twice. Note that the second run is not a noop.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@cg2v cg2v added the bug Addresses a defect in current functionality. label Sep 21, 2023
@github-actions
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/rds Issues and PRs that pertain to the rds service. label Sep 21, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 21, 2023
@vbauchart
Copy link

looks like a duplicate of #33546

@cg2v
Copy link
Author

cg2v commented Sep 29, 2023

The OP in that issue is

  • modifying an existing database, not creating a new one
  • not using apply_immediately=true, which means even in the absence of a bug, would still see something similar

The behavior you describe in your comment I certainly looks the same as what I am seeing, but I am not sure about the original report.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 8, 2023
@tomwidmer
Copy link

I am seeing this behaviour as well under these circumstances:

  1. Using DocumentDB specifically
  2. Creating without a snapshot
  3. trying to create with the old CA rds-ca-2019 - the default changed on January 25th 2024, so the newer one rds-ca-rsa2048-g1 is used by default
  4. apply_immediately=true
  5. Running the build a 2nd time detects the 'drift' (or, rather, the error) and fixes it.

Workaround: set the regional default value to rds-ca-2019 using aws rds modify-certificates. If you already want rds-ca-rsa2048-g1, that's now the default anyway if you haven't changed it yourself. (note 2019 certs expire in August 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/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

4 participants