Is there a way to output the resource reference of a terraform resource block?
11:08 17 Dec 2025

I am working on an automation to delete a terraform resource at particular intervals, however, what I need is to output the resource reference, since terraform delete requires the resource reference.

I.e. the resource reference for an azure bastion host resource block:

azurerm_bastion_host.we_bastion_host

What I am to do is to create an output block, so that the resource reference can be referenced in my GitHub action so it will delete the specific resource block.

I know how to get the output for the resource block name attribute like this:

output "bastion_host_resource_block_name" {
  value = azurerm_bastion_host.we_bastion_host.name
}

Ideally I would like the value argument to get the resource path instead of the resource name. Any ideas on this?

azure github terraform github-actions