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

Error thrown when variable is used in a config source job block #24

Open
carlosreyna-bread opened this issue Sep 6, 2020 · 2 comments

Comments

@carlosreyna-bread
Copy link

When var is used in a config source job block, it throws an error.

Error message:

Unknown variable; There is no variable named "var"

Example code that throws error:

variable "a" {
  value = "some value"
}

config "aconfig" {
  source job {
    name   = "ajob"
    args   = {
      errors_on   = "${var.a}"
      also_errors = var.a
    }
  }
}
@mumoshu
Copy link
Owner

mumoshu commented Sep 6, 2020

@carlosreyna-bread Hey!

Thanks for trying Variant. Currently, a variable can depend on config, but the opposite is impossible. Do you think we need a real DAG computation among arbitrary combinations of variable and config so that it can be e.g. var a -> config b -> var b -> config c -> ....?

Also, I was trying to make Variant 2's variable resolution as much similar as possible to Terraform. Do you know if Terraform does support a DAG of e.g. arbitrary local and `var?

AFAIK, in Terraform, a complex dependency graph like resource -> provider -> resource dependency isn't handled very well, that you usually need terraform apply -target whatever to cut the graph manually. So probably it won't work for local and var as well?

@carlosreyna-bread
Copy link
Author

carlosreyna-bread commented Sep 6, 2020

@mumoshu, terraform variables cannot use locals. locals can be used on modules / resources and locals can point to outputs of modules and attributes of resources.

When the local is parsed, it adds the module / resource been used into a dependency and runs the module before the local can be used.

module / resource -> local -> module / resource.

I can see where this would be a lot of complex work, and if it cannot be done, there are work arounds, so it is not a huge deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants