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

Creating vars.tf entries automatically #31

Open
mjbright opened this issue Aug 10, 2023 · 1 comment
Open

Creating vars.tf entries automatically #31

mjbright opened this issue Aug 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mjbright
Copy link

It would be great if this tool allowed to avoid the painful process (ok, I'm lazy) of adding variable block definitions each time a new variable is referenced in a config.

e.g. if we have a file main.tf in the config like:

resource aws_instance example {
ami = var.ami
...
}

Would check to see if a variable definition exists already for ami and if not add this to a tfvar_vars.tf file.

Options:

  • append to existing vars.tf (specify file on command-line)
  • recurse into sub-directories aka modules
  • generate current outputs such as env vars, cli flags, terraform.tfvars
@shihanng
Copy link
Owner

Thank you for the suggestion. Currently, this tool looks for variable blocks and extracts the information. If we'd implement something like the above, we'd need to do it "in reverse"? It'd be like asking an editor to perform autocompletion on a variable declaration based on its usage. It does seem very interesting, and I am happy to accept PR for this feature.

@shihanng shihanng added the enhancement New feature or request label Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants