Restore tls_cert_request to being a managed resource #9035
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In c244e5a (#7469) this resource was converted to a data source, but that was a big mistake on my part since data sources are expected to produce stable results on each run, and yet certificate requests contain a random nonce as part of the signature and so any other downstream resources will see a new cert request PEM on each run, preventing convergence.
Additionally, using the data source as a managed resource through the provided compatibility shim was not actually working, since
Read
was trying to parse the private key out of a SHA1 hash of the key, which is what we place in state due to theStateFunc
on that attribute.By restoring this we restore Terraform's ability to produce all of the parts of a basic PKI/CA, which is useful for creating dev environments and bootstrapping PKI for production environments.
This is basically just a revert of c244e5a, but with some extra text in the docs to explain this resource's temporary stint as a data source in case some folks find old, broken examples elsewhere and wonder what's going on. (These docs assume this would be merged in time for 0.7.5, and will need to be amended if not.)
This is a backward-compatibility break that should be noted in
CHANGELOG.md
if merged. I intentionally did not preserve compatibility with using this as a data source since it was so broken as to be useless anyway, and so little reason to stay compatible with it.This fixes #8764 and #8782, addresses an issue reported via the mailing list, and makes my article on using Terraform as a CA actually work. 😀