Terraform Interview Questions and Answers
Related differences
Ques 16. How can you manage Terraform remote state locking?
Terraform provides a 'backend' configuration for state storage, and some backends support locking. By configuring the 'lock' option, Terraform can lock the state to prevent concurrent modifications.
Ques 17. What are Terraform workspaces used for?
Terraform workspaces allow you to manage multiple instances of the same infrastructure in a single configuration. Each workspace has its own state file, making it useful for environment separation.
Ques 18. How do you handle sensitive data like API keys in Terraform?
Sensitive data like API keys can be stored securely using Terraform's sensitive input variable type or by using a secret management tool. Avoid storing sensitive information directly in configuration files.
Ques 19. Explain the purpose of 'terraform refresh'.
'terraform refresh' is used to reconcile the Terraform state with the real-world infrastructure. It updates the state file with the current state of the resources.
Ques 20. What is the difference between 'provisioners' and 'null_resource' in Terraform?
Provisioners are used to execute scripts on a remote resource after creation, while 'null_resource' is a resource type that doesn't directly create infrastructure but can be used to trigger provisioners or other actions.
Most helpful rated by users: