-
Notifications
You must be signed in to change notification settings - Fork 140
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
r/me_ssh_key: fix setting key default property and handle key not found error #158
Conversation
95ed15e
to
948d22d
Compare
cf9f477
to
bdcda64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @invidian,
Thank you for your PR but I'm not sure I understand what you are trying to solve.
It seems that you want terraform to automatically re-create a key that has been manually deleted between two runs of terraform.
This is not an expected behavior of terraform: if a resource has been deleted, the user should see that it needs to be re-created and must agree on the plan to add it. There must not be any automatic creation.
Would you consider removing this part in resourceMeSshKeyRead
but keep the rest of the fix?
Hey @pgaxatte, thanks for the reply. No resources will be "automatically" re-created with this PR. This is what confirmation in Most of Terraform providers handle resource life-cycle this way. If resource has been removed by the external process, Terraform will remove it from internal state and then Currently, if one removes SSH key by hand, one must run |
Thanks for the clarification. You're right about the removal in the state so returning However, it would be best if you used the error code from the An example of such an error handling can be found here:
|
It was mistakenly implemented, so rather than passing parameters to the function, parameters gets passed to response struct. Signed-off-by: Mateusz Gozdek <[email protected]>
So if key gets manually removed, Terraform is able to re-create it. Signed-off-by: Mateusz Gozdek <[email protected]>
948d22d
to
4c2c3e5
Compare
Right, thanks for the suggestion. I implemented it. Perhaps similar fix should be applied to all other resources, for consistency. |
You're right we'll have to sieve through all our code to see where we can apply the same reasoning |
No description provided.