This object does not have an attribute named "name"

Hi,

I keep getting this error everytime I’m trying to run a plan

│ Error: Unsupported attribute
│
│   on main.tf line 53, in module "subnet1":
│   53:   virtual_network_name       = module.vnet.name
│     ├────────────────
│     │ module.vnet is a object, known only after apply
│
│ This object does not have an attribute named "name".
module "subnet1" {

  source = "../Modules/tf-vnets/subnets"

  name                       = "snet-${var.prefix}-01"

  environment                = var.environment

  resource_group_name        = module.rsgrp.name

  location                   = module.rsgrp.location

  virtual_network_name       = module.vnet.name

  address_prefixes           = ["${var.subnet}.1.0/24"]

}

Can anyone assist.

Hi,

Does your module have an output named “name”?
Have a look at Output Values - Configuration Language - Terraform by HashiCorp & Modules Overview - Configuration Language - Terraform by HashiCorp

1 Like