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

Add support for global variables #631

Open
dmlemos opened this Issue Jul 7, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@dmlemos

dmlemos commented Jul 7, 2017

Motivation

I tend to use a main.hcl file and from there call all the necessary modules.

Given

main.hcl

param "cred_user" {}
param "cred_password" {}

module "<src>" "setup_x" {
  params = {
    cred_user          = "{{param `cred_user`}}"
    cred_password = "{{param `cred_password`}}"
  }
}

module "<src>" "setup_y" {
    cred_user          = "{{param `cred_user`}}"
    cred_password = "{{param `cred_password`}}"
}
...

In order for this to work as of 0.6.0 I need to pass all the parameters required by the modules every time.
When there are quite a few modules it is cumbersome to keep specifying the same parameters.

Modest proposal

main.hcl

#Option 1
param "global" "cred_user" {}
param "global" "cred_password" {}
...

#Option 2
param "cred_user" {
  type = "global"
}
param "cred_password" {
  type = "global"
}
...

module "setup_x" {}
module "setup_y" {}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment