How can I programmatically list all available outputs for a terraform resource, or generate outputs.tf automatically?

Help Wanted

Hello, I'm attempting to get some help with 1 of 2 things - Either automatically generating my outputs.tf file based on what outputs are available for a resource, or atleast have a way to programmatically list all outputs for a resource.

For example, for https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mysql_flexible_server i would like a way to programmatically retrieve the outputs/attribute references "id", "fqdn" & "replica_capacity".

I have tried to curl that URL however it doesn't seem to work, it just returns an error saying JS is required. I have also tried to run terraform providers schema and navigate to the resource I want - This doesn't work because the only nested field is one called "attributes", This includes both argument and attribute references, with nothing to differentiate the outputs from inputs.

Is there any way I can programmatically retrieve everything under the "Attributes reference" for a given terraform resource?

Posted Aug 7, 2025, 12:51 AM UTC

611
Loading comments…