Is there any way to get local variables within Terraform console?
> local.name
unknown values referenced, can't compute value
Seems like Terraform console allows only to check input variables and module output variables.
> var.in
2
> module.abc.out
3
Configuration file examples:
# main.tf
locals {
name = 1
}
variable "in" {
value = 2
}
module "abc" {
source "path/to/module"
}
# path/to/module/main.tf
output "out" {
value = 3
}
Unfortunately, it looks like this is not possible in Terraform v0.11.x, but will be in v0.12 as described in this issue ticket:
https://github.com/hashicorp/terraform/issues/18413
HTH!
This should work in recent Terraform releases.
$ terraform version
Terraform v1.0.5
$ terraform console
> local.name
1
> var.in
2
The tested 'main.tf'
locals {
name = 1
}
variable in {
default = 2
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With