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_docdb_cluster availability_zones attribute is different than what was set #37210

Open
rgl opened this issue May 1, 2024 · 5 comments
Labels
bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. service/docdb Issues and PRs that pertain to the docdb service.

Comments

@rgl
Copy link

rgl commented May 1, 2024

Terraform Core Version

1.8.2

AWS Provider Version

5.47.0

Affected Resource(s)

aws_docdb_cluster and aws_rds_cluster

Expected Behavior

Expected the aws_docdb_cluster and aws_rds_cluster resources to return the configured availability_zones

Actual Behavior

aws_docdb_cluster.availability_zones returns more zones than what was configured at creation time.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Please note that module.vpc.azs has two azs, eu-west-1a and eu-west-1a.

# see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/docdb_cluster
resource "aws_docdb_cluster" "example" {
  cluster_identifier           = var.cluster_name
  availability_zones           = module.vpc.azs
  db_subnet_group_name         = module.vpc.database_subnet_group_name
  vpc_security_group_ids       = [aws_security_group.example_docdb.id]
  port                         = local.example_docdb_port
  engine                       = "docdb"
  engine_version               = "5.0.0"
  master_username              = "master"
  master_password              = "Ex0mple!" # TODO move to a secret.
  preferred_maintenance_window = "mon:00:00-mon:03:00"
  preferred_backup_window      = "04:00-06:00"
  backup_retention_period      = 1 # [days]. min 1.
  skip_final_snapshot          = true
  apply_immediately            = true
  lifecycle {
    ignore_changes = [
      # TODO why is this changing from 2 to 3 azs after initial creation?
      availability_zones,
    ]
  }
}

Steps to Reproduce

  1. Deploy a aws_docdb_cluster into two availability zones using terraform apply.
  2. Run terraform apply again.
  3. Notice that terraform apply wants to recreate the aws_docdb_cluster because it thinks a third zone eu-west-1c is being removed. Also notice that we've initially created the aws_docdb_cluster with two azs, not three! So it seems there's a bug somewhere.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

This is related to #19451.

Would you like to implement a fix?

None

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

github-actions bot commented May 1, 2024

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 1, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 1, 2024
@justinretzolk
Copy link
Member

Hey @rgl 👋 Thank you for taking the time to raise this! Are you able to supply debug logs (redacted as needed) so that we have that information to reference? Without a working reproduction example, we'll need that in order to deduce what's happening.

@justinretzolk justinretzolk added the waiting-response Maintainers are waiting on response from community or contributor. label May 3, 2024
@rgl
Copy link
Author

rgl commented May 3, 2024

Ah, sorry, I forgot to include the repo. The full repo is at https://github.com/rgl/terraform-aws-documentdb-example. The relevant parts, I think, are:

I'm sorry, but I will not even try to redact the terraform logs, that file is too complex/unknown for doing that. If there is anything particular that you want to see, let me known. Thou, that repo should be enough to reproduce the problem.

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label May 3, 2024
@ltavira-bch
Copy link

I get the same issue. Until now, the only solution i got was to add the new az manually to the code . This makes almost impossible to develop an automation for different workspaces.

@rgl
Copy link
Author

rgl commented Jun 22, 2024

Oh, this also happens with the aws_rds_cluster resource... :-(

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. needs-triage Waiting for first response or review from a maintainer. service/docdb Issues and PRs that pertain to the docdb service.
Projects
None yet
Development

No branches or pull requests

3 participants