This is a tutorial to teach how to use terraform plan
.
- Check the
main.tf
,variables.tf
, andterraform.tfvars
files. - Run
terraform init
- Run
terraform plan
- Run
terraform apply
- Run
docker ps
- Go to the ports tab and view the NGINX welcome screen
- Change the restart to
restart = "on-failure"
inmain.tf
- Run
terraform plan
- Change the external port to
8081
interraform.tfvars
- Run
terraform plan
- Comment out the
docker_container
resource inmain.tf
- Run
terraform plan
- Run
terraform apply
- Run
terraform apply
- Run
docker rmi nginx:1.23.3
- Run
terraform plan -refresh-only
- Check
terraform.tfstate
- Run
terraform apply -refresh-only
- Check
terraform.tfstate
again
- Run
terraform plan -out tfplan
- Run
terraform apply tfplan
- Run
terraform plan -replace docker_container.nginx_container
- Run
terraform apply -replace docker_container.nginx_container
- Comment out all the contents of the
terraform.tfvars
file - Run
terraform plan
- Run
terraform plan -var image_name=nginx -var image_tag=1.23.3
- Check the
my_variables_file
in thea_random_directory
folder - Run
terraform plan -var-file a_random_directory/my_variables_file.txt
- Run
terraform plan -destroy
- Run
terraform apply -destroy
- Run
terraform apply
- Change the
image_tag
from1.23.3
to1.23.1
in theterraform.tfvars
file - Run
terraform plan
- Run
terraform plan -target docker_image.nginx_image
- Run
terraform apply -target docker_image.nginx_image