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_elasticache_replication_group is delaying terraform plan for 30 seconds, presumably waiting for the group to become available even though the group is already available #30402

Closed
stefansundin opened this issue Apr 2, 2023 · 9 comments · Fixed by #30403
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.
Milestone

Comments

@stefansundin
Copy link
Contributor

Terraform Core Version

1.3.9

AWS Provider Version

4.61.0

Affected Resource(s)

aws_elasticache_replication_group

Expected Behavior

The resource shouldn't needlessly slow down terraform plan or terraform apply. If a replication group is created and available then it shouldn't need to wait.

Actual Behavior

If you have a aws_elasticache_replication_group created, the provider will wait for 30 seconds before it is done refreshing the state for the resource. According to the logs, it is waiting for the group state to become available. But it will wait for 30 seconds even if the group is already available. It is a very annoying delay every time you want to simply plan a change.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_elasticache_replication_group" "redis" {
  replication_group_id       = "tftest-redis"
  description                = "Managed by Terraform"
  node_type                  = "cache.t3.micro"
  subnet_group_name          = "test"
  engine_version             = "6.2"
  port                       = 6379
  num_cache_clusters         = 1
  multi_az_enabled           = false
  automatic_failover_enabled = false
  apply_immediately          = true
}

Steps to Reproduce

First create the replication group:

$ terraform apply

Then, without making any changes, just plan and wait for ~35 seconds:

$ time terraform plan

[...]

real	0m35.135s
user	0m1.437s
sys	0m0.362s

Debug Output

Here's some output from TF_LOG=1 terraform plan:

2023-04-02T14:31:04.489-0700 [DEBUG] provider.terraform-provider-aws: [DEBUG] ElastiCache Replication Group (tftest-redis) Configuration Endpoint is nil
2023-04-02T14:31:04.489-0700 [DEBUG] provider.terraform-provider-aws: [DEBUG] ElastiCache Replication Group (tftest-redis) Primary Endpoint is not nil
2023-04-02T14:31:04.489-0700 [DEBUG] provider.terraform-provider-aws: [DEBUG] Waiting for ElastiCache Replication Group (tftest-redis) to become available
2023-04-02T14:31:04.489-0700 [DEBUG] provider.terraform-provider-aws: [DEBUG] Waiting for state to become: [available]
2023-04-02T14:31:05.324-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:05.324-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:10.325-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:10.325-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:15.326-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:15.326-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:20.327-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:20.327-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:25.328-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:25.328-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:30.329-0700 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/aws\"] (close)" is waiting for "aws_elasticache_replication_group.redis (expand)"
2023-04-02T14:31:30.330-0700 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/aws\"] (close)"
2023-04-02T14:31:34.491-0700 [DEBUG] provider.terraform-provider-aws: HTTP Request Sent: @module=aws aws.operation=DescribeReplicationGroups

Pay attention to the timestamps.

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

@stefansundin stefansundin added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Apr 2, 2023
@github-actions
Copy link

github-actions bot commented Apr 2, 2023

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 service/elasticache Issues and PRs that pertain to the elasticache service. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 2, 2023
stefansundin added a commit to stefansundin/terraform-provider-aws that referenced this issue Apr 3, 2023
…. This waited 30 seconds even if the status was already available. Fixes hashicorp#30402.
@jkoermer-eqxm
Copy link

Thank you for helping me understand why this is taking so long! I'm also seeing some long delays in my plans/applies with replication groups.

@stefansundin
Copy link
Contributor Author

@jkoermer-eqxm Now we just have to wait 12+ months for HashiCorp to review my fix. 😭

@jkoermer-eqxm
Copy link

jkoermer-eqxm commented Apr 12, 2023

@stefansundin I spent all day today playing with the differences between terraform and the aws cli for encryption_in_transit. I was going to create a new issue for the requirement to recreate the cluster when enabling encryption in transit, but I see in your PR that you are resolving that issue as well. Is there another issue already for that? Or is it still worth creating one? I've added my upvote for your PR!

@stefansundin
Copy link
Contributor Author

@jkoermer-eqxm I haven't seen an issue for that specifically but feel free to create one if you think that it might be useful. 👍

@mmarinaccio
Copy link

Just ran into this myself. Thanks for flagging. Hopefully we get a fix soon. Sucks having to needlessly add another 30s to our CI/CD workflows in order to manage this resource with Terraform.

@Leen15
Copy link

Leen15 commented Feb 5, 2024

Is there any update on this?

Thanks

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.47.0 milestone Apr 19, 2024
Copy link

This functionality has been released in v5.47.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment