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]: security_group_names attribute incorrect on aws_elasticache_replication_group import #32835

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

Comments

@bclodius
Copy link
Contributor

bclodius commented Aug 2, 2023

Terraform Core Version

1.3.7

AWS Provider Version

5.5.0

Affected Resource(s)

When importing an aws_elasticache_replication_group resource the attribute security_group_names is imported as null.

"security_group_names": null,

During subsequent terraform plan commands a recreation of the resource is requested as the plan wants the value to be [].

"security_group_names": [],

Current workaround is to manually modify the state and push the state fille with terraform state push.

Expected Behavior

Terraform should not recreate a aws_elasticache_replication_group resource to bring security_group_names from null to [].

Actual Behavior

Terraform attempts to recreate the aws_elasticache_replication_group resource.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Will provide a minimal POC shortly

Steps to Reproduce

Will provide a minimal POC shortly

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

@bclodius bclodius added the bug Addresses a defect in current functionality. label Aug 2, 2023
@github-actions
Copy link

github-actions bot commented Aug 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 the needs-triage Waiting for first response or review from a maintainer. label Aug 2, 2023
@justinretzolk justinretzolk 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 Aug 3, 2023
@lado936
Copy link

lado936 commented Sep 14, 2023

Had same issue today, imported aws_elasticache_replication_group in terraform and if security_group_names is not set specifically to [], on plan it shows that whole cluster must be replaced because of security_group_names change, setting it to null has no affect, just by brute forcing i set it to [] and plan now shows no changes

@mayconritzmann
Copy link

I'm in the same situation here

Terraform Core Version
1.3.7

AWS Provider Version
5.0

@siourdas-vasilis
Copy link

siourdas-vasilis commented Nov 1, 2023

Happened to me also when I imported an Redis cluster to aws_elasticache_replication_group.

It gave me :
security_group_names = [..] # forces replacement

although the security_group_ids did not change.

Solved it with a lifecycle_rule ignore on security_group_names. 🤷

@Tycale
Copy link

Tycale commented Dec 14, 2023

Thanks a lot for your report, helped me a lot in order to understand my issue!

Happened to me also when I imported an Redis cluster to aws_elasticache_replication_group.

It gave me : security_group_names = [..] # forces replacement

although the security_group_ids did not change.

Solved it with a lifecycle_rule ignore on security_group_names. 🤷

Same here, solved it by defining security_group_ids to [].

@KieranP
Copy link

KieranP commented Mar 12, 2024

Was able to fix it with this:

lifecycle {
  ignore_changes = [
    security_group_names,
  ]
}

@brizaldi
Copy link

brizaldi commented Mar 19, 2024

Still happening on aws provider version 5.41.0.
Currently the workaround is to set:

security_group_names = []

@i-ate-a-vm
Copy link

Can confirm I just hit something very similar, with an existing replication group trying to destroy and re-create itself because it wanted to add a blank security_group_names value. Also working around this with a lifecycle block, but the behavior is very strange and definitely shouldn't lead to the deletion of your Elasticache cluster imo.

@dverzolla
Copy link

Same at my side, terraform plan -generate-config-out returned security_group_names = null that led to destroy/create.
Work around with security_group_names = [].

@tiabc
Copy link

tiabc commented Jul 3, 2024

Same on my side. The workaround has worked for me

@evgeny-bushuev-incountry

confirm this bug, provider version is 5.59.0, bug is still here

@OscarPoels
Copy link

Got the same bug in 5.68.0, have some resources not imported that work well with security_group_names not defined but one resource imported that want recreation where I needed to do a special case for it with security_group_names = [], kind of painful when you want DRY and clean code ...

Copy link

github-actions bot commented Oct 4, 2024

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.

1 similar comment
Copy link

github-actions bot commented Oct 4, 2024

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.

Copy link

This functionality has been released in v5.72.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!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticache Issues and PRs that pertain to the elasticache service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.