Mcq-terraform-commands

Question: Your friend was working on a terraform project but he is unable to execute the terraform apply command successfully. As having experience in automation he asks you for help. On further investigation he reported that he already initialized the directory and also ran terraform validate command. Even terraform plan also ran with no errors. What could be at fault here?

Correct option: All the statements are true except the bug one

When
Terraform init - success
Terraform validate - success
Terraform plan - success
Terraform apply - failing

It could be some dependency issue or other issue which cannot be seen until applied.
Ex:- If you try to remove some resource from code and run terraform apply in plan stage it will show that it’s going to destroy the resource but in apply stage if it founds some resource is already using this resource(dependency) then it will throw error saying: Unable to destroy resource because resource is being used.
You can take Security group example. If you remove security group from one module and if it’s being reference in another module. We won’t be able to delete it until we disassociate it first.