To streamline Terraform use you can use the typical make command. Below is a very simple Makefile and of course it can be built out for testing steps etc…
Makefile
➜ cat Makefile
init: terraform init
validate: terraform fmt -recursive terraform validate
plan: terraform validate terraform plan -var-file="variables.tfvars"
apply: terraform apply -var-file="variables.tfvars" --auto-approve
destroy: terraform destroy -var-file="variables.tfvars"
all: validate plan applyExample command
❯ make initterraform init
Initializing the backend...
Initializing provider plugins...- Reusing previous version of oracle/oci from the dependency lock file- Using previously-installed oracle/oci v5.2.1
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to seeany changes that are required for your infrastructure. All Terraform commandsshould now work.
If you ever set or change modules or backend configuration for Terraform,rerun this command to reinitialize your working directory. If you forget, othercommands will detect it and remind you to do so if necessary.