-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Move aws_kms_ciphertext to resource #2568
Conversation
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.
Hi @JoelSpeed
Thanks for the proposal here!
Unfortunately, we can't accept such work as it is a major breaking change: people relying on the data source would not be able to use it anymore, while just upgrading from something to 1.6.0 for instance.
I'm not sure to see how having a resource would fix it here: it's just me trying to better understand it.
Thanks!
The argument for making it into a resource was based on reading this page https://www.terraform.io/docs/configuration/data-sources.html and my general understanding of terraform idoms. My understanding is that we are creating the ciphertext from the input. We only need to recreate this when the input changes which sounds to me, more like a resource than a datasource. By making this a resource, we can use the My thoughts were that you could wrap the creation of the |
@Ninir Assuming you won't look at this again with the |
@JoelSpeed No worries 😄 What I meant is, if we were to do such thing, we could not remove the data source for now, but first deprecate it, and in a coming future remove it. So we should instead ADD a new resource rather than moving the data source to a resource. Having a resource might be the way to go, even though I think this is resolvable at the data source level. |
@Ninir What would you prefer me to do then? I see two options, try and add some logic to the data type and fix it that way. Or put the data type back into this PR and follow a deprecation path to move it to a resource? |
@JoelSpeed In an utopian world, I would go for your 1st suggestion, fixing it as is. Let us know If we can help! |
@Ninir I've had a go at this over the last few hours but have run into a few problems. I was hoping to be able to use the This means that you cannot check whether the input to the I then thought, maybe you could try decrypting the old ciphertext, the The only input the Without access to the old state or the old ciphertext blob, I don't think this bug can be fixed while keeping the ciphertext as a data resource. |
It sounds like this PR is almost ready if you add it the existing behavior and add the resource. |
I've just encountered this problem. We would like to have idempotent deployments, and have just introduced the use of kms ciphertext into our workflow. Now, however, each execution results in a change to the ciphertext, which means that resources get updated with the new data and the deployment is no longer idempotent. My understanding of the discussion so far is...
So my understanding would be that if the data resource were left alone, and the new (regular) resource were created with the logic proposed here, that would allow the original data resource to continue working as it does (and nobody is any worse off who uses it), and give an easy migration path for them to move to the new resource which avoids this change in state on each invocation. Would that be a correct understanding of the situation? If it is, I may have a go at updating this change to implement that, if I get an opportunity in the next few weeks. |
@charles-at-geospock If that's the case, I can just amend my commits to remove the deletion of the If the maintainers will accept having both a |
Would it also be feasible to store a hash of the plaintext instead of the plaintext itself? |
Hi @JoelSpeed 👋 Thanks for your contribution here. As noted above, this pull request would have required creating a separate resource, which looks like was taken care of after a few months in a new pull request: #6993. Since #6993 does not introduce breaking changes and implements the functionality as expected, opting to merge that one. Thanks again for submitting this. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #960
As a resource, the encryption is performed on
create
only.Changing any of the input forces a new resource.