This error means that on those lines (40, 66, 67) you are referencing module resources in your Terraform code which it cannot resolve (that are not part of this Terraform module/configuration and therefore it does not know about).
As a simple and contrived example:
resource "azurerm_resource_group" "myresourcegroup" {
name = "myResourceGroup"
location = "East US"
}
output "resource_group_name" {
value = azurerm_resource_group.myresourcegroup.name
}
output "unknown_resource_group_name" {
value = azurerm_resource_group.wibble.name # <-- This resource is not known
}
The first output block references the azurerm_resource_group.myresourcegroup
resource which is defined in the module and will successfully return the name of that resource in the output.
The second output block references the azurerm_resource_group.wibble
which is not defined in the module and therefore will fail with a similar error to what you are seeing.
Any references to resources/data resources/modules/locals/variables in your module must reference such an item that is defined in your module. If it is not defined in your module then it cannot be referenced.
Without further information (e.g… code / minimal reproducible example) it is not possible to expand on this answer further.
Also, as some future guidance it is typically not good to post a picture of a screen when requesting assistance. Ideally post the code or text directly (formatting the text using code formatting blocks as needed) or, if this is not possible (or not going to provide sufficient information), post a screen shot directly.
This makes viewing and interacting with the information provided much easier for those helping.
Hope that helps.
Happy Terraforming
Hey,
Can you please explain this in more detailed ,So i can understand more effectively.
Hi @elbertelena95,
The documentation regarding References to Resource Attributes explains this in detail.
The key part is that, in your module, you can only reference resource attributes for resources that are declared in the same module. Either using Data, Resource or Module blocks. With sub-modules (modules called by your main module) you can only access outputs that are exposed by the sub-module, you cannot directly reference the attributes on the resources that are deployed within a sub-module.
I hope that helps explain. If you have any further questions that are not directly related to the original post on this topic then please open a new topic in the forum explaining what you need and providing examples if relevant. This means others can see it is not part of the OPs original request/issue and can get involved in answering.
Happy Terraforming