After terraform plan succeeds, it means Terraform has successfully verified your configuration and mapped out the necessary changes. However, nothing has actually been changed or created yet.
Here is what typically happens next in the Terraform workflow:
1. The Review Step (Manual)
As a user, you review the plan output to ensure it matches your expectations. Since your plan shows 1 to add, 0 to change, 0 to destroy, you can confirm that Terraform is only going to create the one file you defined.
2. Running terraform apply
The most important next step is to execute the plan. You run:
terraform apply
When you run this command:
- Terraform will show you the same plan again for a final confirmation.
- It will ask you to type
yesto proceed. - Once confirmed, Terraform will actually perform the actions (in this case, creating the
hello.txtfile on your disk).
3. State File Update
After the apply finishes, Terraform creates or updates a file called terraform.tfstate. This file acts as a database that tracks exactly what Terraform created, so it knows how to manage those resources in the future.
4. Verification
Once the apply is complete, you can verify the result. For your current lab, you would check your directory to see if the hello.txt file exists and contains the correct text.
In summary: plan is the "Map," and apply is the "Journey." You've checked the map, and now you're ready to start the journey!