Outputs - This object does not have an attribute named "vpc_id"

Noob question:

I’ve built a module and am calling it from it from a root module, and it all works fine and builds my VPC.

Now that I’m trying to introduce outputs, I get an error:

davehill@daves-MacBook-Pro CloudEndureVPC % terraform plan

Error: Unsupported attribute

on output.tf line 5, in output “vpc_id”:
5: value = module.vpc.vpc_id

This object does not have an attribute named “vpc_id”.

Here is the block of code from my root output.tf:

output “vpc_id” {
description = “ID of project VPC”
value = module.vpc.vpc_id

And here from the child module output.tf:

output “vpc_id” {
description = “The ID of the VPC”
value = aws_vpc.vpc.id

I’m missing something obvious but can’t see anything in the documentation saying what that might be.

Hi @mrdavehill
Is there any code you could share?
Could you check the name of your module (is it vpc?) and could you also check the name of the VPC resource within the module, is it also vpc?

Hey tbugfinder,

The root module is here:

If you run it as-is you’ll get that error, and if you delete output.tf it will spin up a VPC

The child is here:



I assume the special character here might break it: