-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Feature Request: "blank" resource #1181
Comments
Another related thought: being able to
|
These are some really interesting ideas! I definitely think we should provide some sort of model for accomplishing the goals you are talking about here. I sort of like the idea of a Going to mark this |
I've come to the very same need: running some local orchestration script having the output from other various resource/s as input, specially when the others are multi-instance. We implemented the idea of a using an unneeded resource just as @ctro mentioned, using joined splat interpolations as input, and it worked fine, except TF can not kill the resource when it's not longer needed. I think having a "null" (yet another possible name) resource capable of executing "local-exec" provisioners would be enough for solving the issue, but possibly it should not allow using "remote-exec" or "file" provisioners (those make no sense here without some mental twist) so it would be pretty much a "special case" resource (which always smells). So, what if TF could have provisioners outside resources and participating in the dependency graph on its own, so being capable of dependending on other resources? For instance:
I believe this could easily be seen as a generalization of provisioners given you could do with it all the things you can do now with "resource" provisioners, we only lose the implicit provisioner to resource connection of a given "remote-exec" or "file" provisioner which of course could be easily reinstated explicitly:
|
Just wanted to mention that I've previously written up a lot of thoughts on this matter in #580. I currently believe it wouldn't be that hard to write a provisioner shim resource that does everything you'd expect it to do versus just using the null_resource as a hack. |
shoot, @knuckolls I can't believe I didn't see #580. Thank you for ref-ing it here. |
@ctro: same here. |
This is also a problem that can be solved by not using provisioners. Instead, "the IP written on the instance" is a resource: it's a thing that can exist or not, which you can update or delete. It maps very nicely to CRUD operations. |
Hey folks, going to merge this thread with #580. See you there! |
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. |
Imagine:
aws_eip
has a dependency onaws_instance
.The final public ip (i.e.
aws_eip.public_ip
) has to be written to a file onaws_instance
.That means that a provisioner has to live on
aws_eip
. This is a known workaround, and makes sense.Now you invalidate
aws_instance
, maybe bumping a version number or something.Because EIPs are not always re-provisioned the next
apply
will run provisioners foraws_instance
but NOTaws_eip
.That means
aws_eip.public_ip
will not be written to our file onaws_instance
.A dirty workaround is to add some un-needed resource, maybe an
s3_bucket
, that has a provisioner that points to ouraws_instance
. The bucket is not needed, but it gives me a place to add a provision step that referencesaws_eip.public_ip
w/o creating a circular dependency.Then I thought: maybe an easy solution to this problem is to add a "blank" or "resource-less" resource. One could add a custom
connection
block in this blank resource, and provisioner steps could referenceaws_eip.public_ip
This blank resource would always be Created, never Updated -- ensuring that we always write the necessary file on theaws_instance
.The text was updated successfully, but these errors were encountered: