Terraform v0.8.5
terraform console > module
terraform apply
aws_iam_user.user1: Refreshing state... (ID: me)
data.aws_subnet.default_subnet_a: Refreshing state...
module.vpc1.aws_vpc.vpc: Refreshing state... (ID: vpc-a48cc0c0)
terraform console
> aws_iam_user.user1.name
me
> data.aws_subnet.default_subnet_a.vpc_id
vpc-7953a81d
> module.vpc1.id
Couldn't find output "id" for module var: module.vpc1.id
module output value should be displayed
interpolation not accepted
Please list the steps required to reproduce the issue, for example:
terraform console
module.vpc1.id
Couldn't find output "id" for module var: module.vpc1.id
Hi @harkamals! Sorry this doesn't work as expected.
Just wanted to confirm: the module instantiated as module.vpc1 does have an output block named "id", right? This message seems to suggest that one doesn't exist.
If it does, it would be really helpful if you could share a cut down version of your config that exhibits this problem. For example, a root module that just contains the module "vpc1" block and the child module that just contains the output "id" block with some hard-coded value. If it works as expected with that minimal configuration then that would be useful information too!
Hi @harkamals!
Since I didn't hear back from you, I'm going to close this.
For reference if anyone else finds this in future: terraform console resolves expressions in the context of the root module, so only expressions that would be available in the configuration of the root module can be evaluated. In particular this means that only the outputs of child modules are accessible.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.