0
0
Terraformcloud~20 mins

Terraform state pull and push - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform State Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
What happens when you run terraform state pull?
You run terraform state pull in your Terraform project directory. What is the output or result of this command?
AIt downloads the current remote state file and prints it to your terminal in JSON format.
BIt uploads your local state file to the remote backend, overwriting the remote state.
CIt deletes the remote state file from the backend storage.
DIt initializes the backend configuration and prepares Terraform to work with the remote state.
Attempts:
2 left
💡 Hint
Think about what 'pull' means in everyday life, like pulling data down to you.
service_behavior
intermediate
2:00remaining
What does terraform state push do?
You have a local state file that you want to upload to the remote backend. What does running terraform state push do?
AUploads the local state file to the remote backend, replacing the existing remote state.
BDownloads the remote state file and merges it with the local state file.
CDeletes the local state file and replaces it with the remote state file.
DInitializes the backend and prepares Terraform to use remote state.
Attempts:
2 left
💡 Hint
Think about what 'push' means, like pushing something up or sending it somewhere.
Architecture
advanced
2:30remaining
Which backend configuration ensures safe state locking when multiple users run Terraform?
You want to configure Terraform to store state remotely and prevent multiple users from overwriting state at the same time. Which backend configuration below achieves this?
AUse the local backend with state files stored on a shared network drive.
BUse the Terraform CLI without any backend configuration.
CUse the S3 backend without any locking mechanism configured.
DUse the S3 backend with DynamoDB table enabled for state locking.
Attempts:
2 left
💡 Hint
Think about how to prevent two people from editing the same file at once.
security
advanced
2:30remaining
What is a security risk of manually running terraform state push with a local state file?
You manually run terraform state push to upload a local state file to the remote backend. What is a potential security risk of this action?
AThe command automatically encrypts the state file, so there is no security risk.
BYou might overwrite the remote state with outdated or incorrect information, causing infrastructure drift.
CIt exposes your cloud provider credentials in the state file to the public internet.
DIt deletes all resources managed by Terraform without confirmation.
Attempts:
2 left
💡 Hint
Think about what happens if you replace the current state with an old version.
🧠 Conceptual
expert
3:00remaining
After running terraform state pull, you modify the JSON state file locally. What happens if you then run terraform state push with this modified file?
You pulled the remote state with terraform state pull, edited the JSON state file manually, and then pushed it back with terraform state push. What is the expected outcome?
ATerraform merges your changes with the remote state automatically, preserving all existing resources.
BTerraform validates the JSON and rejects the push if any changes are detected.
CThe remote state is replaced with your modified state, which may cause Terraform to mismanage resources if the changes are incorrect.
DThe push command fails because manual edits to state files are not allowed.
Attempts:
2 left
💡 Hint
Consider what happens when you replace a file with a changed version without checks.