-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
support lifecycle on data sources #8849
Comments
Hi @mengesb! Data sources are re-fetched on every run, regardless of whether the parameters are changed... their lifecycle only includes the "read" action, so there is no concept of updating or replacing them. The lifecycle block on managed resources affects how it behaves for the purpose of the update, replace and delete actions, so those settings have no meaning on a data resource, since it lacks these actions. I can't really follow from your example what exactly you want to achieve here, but here are some pointers that might help:
|
@apparentlymart I was not aware of What I'm trying to achieve is a reliable way to generate a GUID (uuid) that doesn't change based on some static text input really. This is then used in several other places including DB inserts (templates to generate these scripts). |
@apparentlymart So I looked into In the case of RFC 4122v4 strings, there are hyphens which generally I'd be stripping out ; should I want those I'm guessing I'll have to be more creative. That said, I can utilize I'd like to think that it is simpler to add the ability to generate immutable UUID values (unless expressly |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I'm using UUID() interpolation on several segments in template generation and noticed that
lifecycle
blocks aren't allowed. Strangely enough, I'm also noticing that the changes in the data (because UUID() generates new values each invocation) aren't resulting in changed resources. Is this deliberate or an oversight?Desired functionality
It would be splendid if
outputs
could include lifecycle management blocks for just rawuuid()
invocation as well, however even in this invocation I would expect that any block utilizinguuid()
that we don't want changing values to require lifecycle blocks preventing the unique generation. It'd also be great if there was auuid(string)
method where we can generate UUIDs based on a string input, which I would expect to NOT change... thus solving for the need of a lifecycle block in these cases.Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Unable to provide currently (sensitive data in very large plan)
Panic Output
N/A
Expected Behavior
Expect that
uuid()
invocations on data sources result in new values; recreating the data source and requiringlifecycle {}
to prevent this behaviorActual Behavior
Nothing
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
Generating
uuid()
values for template usageReferences
The text was updated successfully, but these errors were encountered: