← 所有公开测验
开始测验(游客或账户)
HashiCorp Terraform Associate (003) — Practice
作者 Jude · 14/05/2026 · 184 次浏览 · 次分享
Practice questions on Terraform workflow, state, providers, modules, and Terraform Cloud. Original wording.
12
题目
🇬🇧 English
语言
中等
难度
测验题目
-
1. Which Terraform command shows the execution plan without applying it?
- terraform apply
- terraform plan
- terraform validate
- terraform refresh
-
2. Where does Terraform store the mapping between configuration and real-world infrastructure by default?
- In the .tf files
- In a local
terraform.tfstatefile (or a configured remote backend) - In environment variables
- In the cloud provider only
-
3. Which feature prevents two engineers from running
terraform applysimultaneously against the same state?- Provider authentication
- State locking (e.g. DynamoDB lock table for the S3 backend)
- Workspaces
- Variables
-
4. Which block declares a reusable group of Terraform resources?
- resource
- module
- provider
- variable
-
5. What does
terraform initdo?- Creates infrastructure
- Initializes the working directory: downloads providers, configures the backend, installs modules
- Destroys resources
- Formats files
-
6. Which Terraform function reads the value of an environment variable?
- env()
- lookup(env, ...)
- Reading via the input variable mechanism with
TF_VAR_<name>env vars os.getenv()
-
7. Which command forces re-creation of a specific resource on the next apply?
- terraform recreate
- terraform taint (deprecated) or `terraform apply -replace=`
- terraform destroy
- terraform refresh
-
8. Which file typically pins provider versions for reproducibility?
- main.tf
- .terraform.lock.hcl
- providers.json
- terraform.tfstate
-
9. What is the recommended way to handle secrets in Terraform configuration?
- Hard-code them in .tf files
- Pass them via input variables sourced from a secret manager or env vars, and avoid committing them or plain state to source control
- Store them in the lock file
- Put them in outputs
-
10. Which feature lets one configuration manage multiple environments (e.g. dev, staging, prod) with separate state?
- Workspaces (or, more commonly in practice, separate root modules per environment)
- Providers
- Variables alone
- Outputs
-
11. What does
terraform fmtdo?- Validates resource configuration
- Rewrites configuration files into a canonical format and style
- Generates a plan
- Removes resources
-
12.
Which output type should be marked `sensitive = true`?
Public IP addresses
Outputs that contain secrets (e.g. passwords, tokens, private keys) so they aren't shown in CLI output
All outputs
Outputs from data sources only