We had a stack creating a cloudsearch domain with the name search-domain, and that went well.
Then in another stack with a different statefile a cloudsearch with the same name 'search-domain' was created but failed (because of a wrong index field value)
And when the changes was reveret and applied the terraform removed the cloudsearch domain from aws
Actual Behavior
The second apply on the same resource from another stack should failed, because the cloudsearch domain already existed.
But the terraform plan and apply went through - and when the resource was removed - the first cloudsearch domain was delete, even if it was already created from another stack.
And no import of the resource had been done in stack 2.
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.
Terraform Core Version
1.5.1
AWS Provider Version
4.67.0
Affected Resource(s)
Expected Behavior
This is a bit of an edgecase,
We had a stack creating a cloudsearch domain with the name search-domain, and that went well.
Then in another stack with a different statefile a cloudsearch with the same name 'search-domain' was created but failed (because of a wrong index field value)
And when the changes was reveret and applied the terraform removed the cloudsearch domain from aws
Actual Behavior
The second apply on the same resource from another stack should failed, because the cloudsearch domain already existed.
But the terraform plan and apply went through - and when the resource was removed - the first cloudsearch domain was delete, even if it was already created from another stack.
And no import of the resource had been done in stack 2.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
stack one
State two
Steps to Reproduce
Create the same cloudsearch domain from two different stacks in sequence and remove it again from the last one. The cloudsearchdomain is destroyed.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
The apply should fail if the cloudsearch domain already exists
Would you like to implement a fix?
None