boltops-tools/terraspace

Variables usage is all but clear

az-z opened this issue · 1 comments

az-z commented

Hello,
the usage of env and terrspace vars in the application needs clarity:
For example:

  1. How can env var be used in stack tf files?
  2. How can env variable be used in terraform.tfvars file?
  3. How terraspace specific variables can be accessed in stacks tf files and tfvars?
  4. What is the rule for using a single vs double quote symbol when referencing a variable?

Here are the examples:
config/app.rb:

Terraspace.configure do |config|
  config.cloud.project = "InfraIAC" 
end

stack/demo/terraform.tfvars:

aws_region = "<%= expansion(':ENV') %>"
client_abbr = "<%= expansion(":CLIENT_ABBR") %>"
project_abbr = "<%= expansion(':APP') %>"

cached version:

aws_region = "dev"
client_abbr = ":CLIENT_ABBR"
project_abbr = ""
  1. Consistency in accessing vars:
    Can't locate at the moment, but in some parts of the documentation access to vars is:
ENV['FOO']

at others :

 "<%= expansion(':ENV') %>"

when to use what is not obvious and not clearly documented.

Not a documentation, but a usage impediment:

the variables used in the code (.tf, rb and tfvars ) and their values should be printed during the "plan" stage, so that a user can inspect their value or absence of it.