Terraform Interview Questions

<p><strong>Q1: Suppose you created an ec2 instance with terraform and after creation, you have removed the entry from the state file now, when you run terraform apply what will happen?</strong></p> <ul> <li>As we have removed the entry from that state file so terraform will no longer manage that resource so on the next apply it will create a new resource.</li> </ul> <p><strong>Q2: What is a state file in Terraform?</strong></p> <ul> <li>A state file is a file in which Terraform keeps track of all the infrastructure that is deployed by it.</li> </ul> <p><strong>Q3: What is the best way to store the terraform state file?</strong></p> <ul> <li>The best way to store the state file is to keep it in the remote backend like S3 or GitLab-managed terraform state so, that whenever multiple people are working on the same code resource duplication won&rsquo;t happen.</li> </ul> <p><a href="https://medium.com/@dksoni4530/terraform-interview-questions-4988bedcec80"><strong>Learn More</strong></a></p>