Which are forbidden actions when the Terraform state file is locked? (Choose three.)
Which are forbidden actions when the Terraform state file is locked? (Choose three.)
When the Terraform state file is locked, actions that modify the state, such as 'terraform destroy,' 'terraform apply,' and 'terraform plan,' are forbidden. These operations can lead to data corruption or conflicts because they involve changes to the infrastructure defined in the state file. Conversely, commands like 'terraform fmt,' 'terraform state list,' and 'terraform validate' are generally safe to execute because they do not modify the state file.
A. terraform destroy D. terraform apply E. terraform plan When the Terraform state file is locked, there are certain actions that are not allowed as they can result in data corruption or loss. The actions that are forbidden when the state file is locked include: A. terraform destroy: This command destroys all resources defined in the configuration file, which could cause data loss if the state file is locked. D. terraform apply: This command applies changes to the infrastructure as defined in the configuration file, which could cause data corruption if the state file is locked. E. terraform plan: This command creates an execution plan of what changes Terraform will apply to the infrastructure, which could cause data corruption if the state file is locked. Actions such as terraform fmt, terraform state list, and terraform validate are read-only operations that do not modify the state file, and can be performed safely even when the state file is locked.
The other options are Information only
When the state file is locked, the following actions are forbidden: Running terraform apply or any other command that modifies the state file (e.g. terraform plan, terraform destroy, etc.) Running terraform refresh, which updates the state file to reflect the current state of the infrastructure Running terraform state push, which uploads the current state file to the remote backend Running terraform state pull, which downloads the current state file from the remote backend Running terraform state mv, which renames resources in the state file Running terraform state rm, which removes resources from the state file You have to unlock the state first with terraform state unlock
ADE is correct
A D E is right I think
A. terraform destroy, D. terraform apply, and E. terraform plan are the forbidden actions when the Terraform state file is locked. When the state file is locked, it means that another Terraform process is already running and has acquired a lock on the state file. In such a situation, it is not safe to apply changes to the infrastructure, as it may result in conflicts and errors. Therefore, the destroy, apply, and plan commands are forbidden while the state file is locked. The fmt, validate, and state list commands do not modify the state file, so they can be executed when the state file is locked.