-
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: shorthand for setting variables #15784
Comments
Hi @boompig! Thanks for this suggestion. The particular syntax you proposed here can't really fit within the constraints of the configuration format right now, but that doesn't mean we could try to find a different concise way to declare variables. I'm curious though: do you find that your modules generally have a lot of variables? If so, I'm curious how you would characterize the usage of variables:
The reason for this question is that we've been looking at some other language improvements that may help with the above in some different ways. With #15449 (which we should be able to land soon, after we get through some 0.10.0 fixes) we'll have a different way to deal with the second problem above. For the first, we're still in the early planning stage but we're planning to make it possible to pass complex object structures as variables, which I expect would result in certain modules requiring many fewer variables than before. Of course neither of those things directly address the verbosity of individual |
I find that factoring out those values which are likely to change in variables at the top of files is helpful. In practice this ends up being file paths mostly. |
Along these lines, I'd find it way, way better to be able to alias certain strings. At this point I'm quite tired of typing null_data_source. If we could come up with a way to alias strings to objects, that'd be nice. I'd much rather type .nds. |
Hi all! Sorry for the long silence here. In Terraform 0.10.3 we added the concept of local values as a way to factor out a particular expression and give it a name, separately from the concept of input variables. With that feature in place, we now recommend using Local values have a more concise syntax because they don't have all of the other requirements that input variables need to deal with: locals {
template_file = "${path.module}/example.tmpl"
} While this change hasn't changed the Thanks for sharing this use-case, and sorry again I didn't find this issue while we were preparing the 0.10.3 release. |
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. |
Is it possible to have a shorthand for variables? Something like
Typing
is not only cumbersome, it means less code can fit on screen. This results in unnecessary long files.
The text was updated successfully, but these errors were encountered: