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

Identify the missing/deleted resources in ES cluster #40

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

olksdr
Copy link
Contributor

@olksdr olksdr commented Jan 25, 2022

For TF to understand that some resources were deleted manually (maybe by accident) we must make sure to set the resource id to empty string (""). In our case if ES reports back 404 we know that requested resource is missing and we can let TF restore it based on the configuration or update the TF state if the deletion was done appropriately.

As part of this PR I decided to split the ES client file into few different files by the cluster functionality.

fix: #37

Additionaly check response http status, and if it's 404 we know that
resource is missing and we must set ID to empty string ("") in the state
so the TF will be able to re-create the resources again.

TF will keep the state and resources up-to-date, even if those were
accidentally removed.
@olksdr olksdr added the bug Something isn't working label Jan 25, 2022
@olksdr olksdr requested a review from Crazybus January 25, 2022 12:33
@olksdr olksdr self-assigned this Jan 25, 2022
@olksdr olksdr requested a review from JoshMock January 25, 2022 12:36
@olksdr
Copy link
Contributor Author

olksdr commented Jan 25, 2022

For review please see commit 69353a3, which has actual change.

Copy link
Contributor

@Crazybus Crazybus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@olksdr olksdr merged commit 66df922 into elastic:main Jan 26, 2022
@olksdr olksdr deleted the fix/identify-missing-resources branch January 26, 2022 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error deleting snapshot resources manually
3 participants