I don’t understand this question in the terraform course, state MCQ. The question states:
“A requirement has come up which requires you to inspect the state file of terraform configuration. Your terraform script is already configured to work with the remote backend. Which of the following commands would you use to view a specific field in the state file”
and answer is: terraform state pull
I feel this is not the correct answer as ‘terraform state pull’ would retrieve the entire remote state and does not help in “viewing a specific field in the state file”. On the very least the wording of the question is misleading, in that, if all you need is to inspect the state file, then one could check their local copy and do so without running “terraform state pull”.
Hi @minaf1 ,
Thanks for sharing the feedback. I notified the team. They will check.
terraform state pull
This command downloads the state from its current location, upgrades the local copy to the latest state file version that is compatible with locally-installed Terraform, and outputs the raw format to stdout.
This is useful for reading values out of state (potentially pairing this command with something like . It is also useful if you need to make manual modifications to state."
so this is the right command to be used as it will download the status and update the local file.
also the question is asking about what terraform command can be used to achieve this so the answer must contain a terraform command.
You are welcome