You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do I store and reuse terraform interpolation result within resources that do not expose them as output? Inability to use self reference further adds on to this issue.
example: In aws_ebs_volume , I am calculating my volume size using:
Now I need to reuse the same size for calculating the cost tags in the same resource as well as in corresponding ec2 resource (in same local module).
How do I do this without copy pasting the entire formula?
PS: I have come across this use case in multiple scenarios, so the above is just one of the use cases where I need to reuse the interpolated results. Getting the interpolated result using the corresponding data source is one way out in this particular scenario but looking for a more straight forward solution and generic solution.
The text was updated successfully, but these errors were encountered:
Right now there isn't a convenient way to do what you describe here. There are some workarounds described in the comments of #4084.
In the near future this will be possible using the feature being added in #15449. Development on that didn't complete in time before the 0.10.0 feature freeze but it should be included in an upcoming version soon.
Since we already have #4084 open discussing this problem and #15449 for the proposed solution, I'm going to close this just to consolidate the discussion there. Thanks for this question/suggestion!
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.
ghost
locked and limited conversation to collaborators
Apr 8, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Terraform version
Terraform Configuration Files
Hi,
How do I store and reuse terraform interpolation result within resources that do not expose them as output? Inability to use self reference further adds on to this issue.
example: In aws_ebs_volume , I am calculating my volume size using:
size = "${lookup(merge(var.default_ebs_vol_sizes,var.ebs_vol_sizes), var.tag_disk_location[var.extra_ebs_volumes[count.index % length(var.extra_ebs_volumes)]])}"
Now I need to reuse the same size for calculating the cost tags in the same resource as well as in corresponding ec2 resource (in same local module).
How do I do this without copy pasting the entire formula?
PS: I have come across this use case in multiple scenarios, so the above is just one of the use cases where I need to reuse the interpolated results. Getting the interpolated result using the corresponding data source is one way out in this particular scenario but looking for a more straight forward solution and generic solution.
The text was updated successfully, but these errors were encountered: