I want to have a clear, machine-readable (e.g. JSON) representation of all the resources that are currently defined in my Terraform project, along with all of the resource configs/options. Is there a way to do that?
The tfstate file is not what I need, because that is a representation of the state, not the current configuration.
The tfplan file kind of contains the information I want, but upon closer inspection, it seems much more complex and difficult to work with. So it is not exactly what I need.
This may help you: https://developer.hashicorp.com/terraform/cli/commands/show
The terraform show command is used to provide human-readable output from a state or plan file. This can be used to inspect a plan to ensure that the planned operations are expected, or to inspect the current state as Terraform sees it. Machine-readable output is generated by adding the -json command-line flag.
Alternatively: https://developer.hashicorp.com/terraform/cli/commands/plan
-json - Enables the machine readable JSON UI output. This implies -input=false, so the configuration must have no unassigned variable values to continue.