{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/15784","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/15784/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/15784/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/15784/events","html_url":"https://github.com/hashicorp/terraform/issues/15784","id":249488663,"number":15784,"title":"Feature request: shorthand for setting variables","user":{"login":"boompig","id":2791268,"avatar_url":"https://avatars3.githubusercontent.com/u/2791268?v=4","gravatar_id":"","url":"https://api.github.com/users/boompig","html_url":"https://github.com/boompig","followers_url":"https://api.github.com/users/boompig/followers","following_url":"https://api.github.com/users/boompig/following{/other_user}","gists_url":"https://api.github.com/users/boompig/gists{/gist_id}","starred_url":"https://api.github.com/users/boompig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boompig/subscriptions","organizations_url":"https://api.github.com/users/boompig/orgs","repos_url":"https://api.github.com/users/boompig/repos","events_url":"https://api.github.com/users/boompig/events{/privacy}","received_events_url":"https://api.github.com/users/boompig/received_events","type":"User","site_admin":false},"labels":[{"id":608979767,"url":"https://api.github.com/repos/hashicorp/terraform/labels/config","name":"config","color":"0e8a16","default":false},{"id":85946959,"url":"https://api.github.com/repos/hashicorp/terraform/labels/enhancement","name":"enhancement","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-08-10T21:58:52Z","updated_at":"2018-03-29T18:04:25Z","closed_at":"2018-03-29T18:04:25Z","author_association":"CONTRIBUTOR","body":"Is it possible to have a shorthand for variables? Something like\r\n\r\n```\r\nvariable \"varname\" = { \"value\" }\r\n```\r\n\r\nTyping\r\n\r\n```terraform\r\nvariable \"varname\" {\r\n    default = \"value\"\r\n}\r\n```\r\n\r\nis not only cumbersome, it means less code can fit on screen. This results in unnecessary long files.\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/377322079","html_url":"https://github.com/hashicorp/terraform/issues/15784#issuecomment-377322079","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/15784","id":377322079,"user":{"login":"apparentlymart","id":20180,"avatar_url":"https://avatars1.githubusercontent.com/u/20180?v=4","gravatar_id":"","url":"https://api.github.com/users/apparentlymart","html_url":"https://github.com/apparentlymart","followers_url":"https://api.github.com/users/apparentlymart/followers","following_url":"https://api.github.com/users/apparentlymart/following{/other_user}","gists_url":"https://api.github.com/users/apparentlymart/gists{/gist_id}","starred_url":"https://api.github.com/users/apparentlymart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apparentlymart/subscriptions","organizations_url":"https://api.github.com/users/apparentlymart/orgs","repos_url":"https://api.github.com/users/apparentlymart/repos","events_url":"https://api.github.com/users/apparentlymart/events{/privacy}","received_events_url":"https://api.github.com/users/apparentlymart/received_events","type":"User","site_admin":false},"created_at":"2018-03-29T18:04:25Z","updated_at":"2018-03-29T18:04:25Z","author_association":"CONTRIBUTOR","body":"Hi all! Sorry for the long silence here.\r\n\r\nIn Terraform 0.10.3 we added the concept of [local values](https://www.terraform.io/docs/configuration/locals.html) as a way to factor out a particular expression and give it a name, separately from the concept of input variables.\r\n\r\nWith that feature in place, we now recommend using `variable` blocks _only_ for values that are to be provided by the caller, and use the `locals` block for the situation described here where an expression is extracted so that it can be easily reused and changed in one place.\r\n\r\nLocal values have a more concise syntax because they don't have all of the other requirements that input variables need to deal with:\r\n\r\n```hcl\r\nlocals {\r\n  template_file = \"${path.module}/example.tmpl\"\r\n}\r\n```\r\n\r\nWhile this change hasn't changed the `variable` block syntax at all, it does tend to reduce the number of `variable` blocks in a configuration since there's no longer a need to declare input variables just to reuse their values in multiple locations. Therefore I'm going to close this issue, since the current syntax complexity is necessary for the intended use-case of variable blocks (defining what is expected from the caller) and there's now a more concise way to achieve the other emergent use-case of factoring out values.\r\n\r\nThanks for sharing this use-case, and sorry again I didn't find this issue while we were preparing the 0.10.3 release.\r\n"}}
{"actor":{"display_login":"apparentlymart"}}