Doubt on Output Block

Hello Team,

I want to clear my doubt on output block . I have provided the details below.
main.tf

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "4.26.0"
    }
  }
}

provider "azurerm" {
   features {}
  subscription_id   = "xxxxxxxxxx"
  tenant_id         = "xxxxxxxxxx"
  client_id         = "xxxxxxxxxx"
  client_secret     = "xxxxxxxxxx"
}
module "resource" {
  source="./modules/resource"
}

resource.tf

locals {
    location="Central India"
    resource_group_name="app_grp"
}
output "app-region"{
value=local.location
}
resource "azurerm_resource_group" "app_resource_group" {
 lifecycle {
    create_before_destroy = true
  }
 name     = local.resource_group_name
 location = local.location
}

output_resource.tf

output "resource_group"{
  value=azurerm_resource_group.app_resource_group.name
}

When i hit terraform plan

 terraform plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  + create

Terraform will perform the following actions:

  # module.resource.azurerm_resource_group.app_resource_group will be created
  + resource "azurerm_resource_group" "app_resource_group" {
      + id       = (known after apply)
      + location = "centralindia"
      + name     = "app_grp"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

No output i got for resource_group(output_resource.tf)

When i have changed the main.tf file

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "4.26.0"
    }
  }
}

provider "azurerm" {
   features {}
  subscription_id   = "xxxxxxxxxx"
  tenant_id         = "xxxxxxxxxx"
  client_id         = "xxxxxxxxxx"
  client_secret     = "xxxxxxxxxx"
}
module "resource" {
  source="./modules/resource"
}
output "test" {
value=module.resource.resource_group
}

Then i got the output

terraform plan

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  + create

Terraform will perform the following actions:

  # module.resource.azurerm_resource_group.app_resource_group will be created
  + resource "azurerm_resource_group" "app_resource_group" {
      + id       = (known after apply)
      + location = "centralindia"
      + name     = "app_grp"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + test = "app_grp"

Please clear my doubt on this.

If I’m understanding your question correctly, that’s right – if you want an output from a module in the calling state, you’ll have to make an output in the module and define an output in the calling state as well.