Skip to content
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

New function to expose variable address #32220

Open
XieGuochao opened this issue Nov 15, 2022 · 1 comment
Open

New function to expose variable address #32220

XieGuochao opened this issue Nov 15, 2022 · 1 comment
Labels
enhancement new new issue not yet triaged

Comments

@XieGuochao
Copy link

XieGuochao commented Nov 15, 2022

Terraform Version

Terraform v1.3.3
on linux_amd64

Use Cases

A function address would be useful and interesting to expose the absolute address of a variable or resource, especially when using in a module.

Suppose a resource vpc in a vcp module with the address module.vpc.aws_vpc.main, then calling the function address(aws_vpc.main) inside the module VPC returns a string "module.vpc.aws_vpc.main".

In different module instances, the result of calling address would be different. Like "module.vpc_one.aws_vpc.main" and "module.vpc_two.aws_vpc.main" for two usages of the VPC module.

This functionality would make a great difference in tag-based tracing, i.e. encode the absolute address in the resource tag, and many other use cases.

Attempted Solutions

The implementation is non-trivial and even this issue #2771 does not help implement this feature.

Proposal

It would be challenging to implement with the current Function interface because this function applies to a reference instead of a value.

References

No response

@XieGuochao XieGuochao added enhancement new new issue not yet triaged labels Nov 15, 2022
@crw
Copy link
Collaborator

crw commented Nov 17, 2022

Thanks for this feature request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants