Complete the command to list all resources in the Terraform state.
terraform state [1]The terraform state list command shows all resources tracked in the current Terraform state.
Complete the command to list resources in a specific Terraform workspace.
terraform workspace select [1] && terraform state listSelecting the workspace prod before listing state shows resources in that workspace.
Fix the error in the command to list resources with a filter prefix.
terraform state list [1]The terraform state list command accepts a prefix filter directly as an argument, like aws_instance.
Fill both blanks to list resources filtered by prefix and output to a file.
terraform state list [1] > [2]
Filtering by aws_s3_bucket lists only those resources, and redirecting output to resources.txt saves the list.
Fill all three blanks to list resources, filter by prefix, and select a workspace.
terraform workspace select [1] && terraform state list [2] > [3]
Selecting the dev workspace, listing resources filtered by aws_lambda_function, and saving output to lambda_resources.txt is a common workflow.