Generate plan on the console output with colors.

$ terraform plan

Or if you want to persist the plans.

$ mkdir -p plans

Write out to human-readable plain text file.

$ terraform plan --no-color > plans/foo.txt

Use &> instead of > to include stderr.

We strip colors to avoid messages like No changes. Infrastructure is up-to-date.

Write out binary plan file.

$ terraform plan -out plans/foo.tfplan

That can be viewed using:

$ terraform show plans/foo.tfplan

For JSON output:

$ terraform show -json <planfile>

From JSON Format TF doc.

You can apply a plan directly, which saves TF doing a plan internally within the apply step.

$ terraform apply plans/foo.tfplan

Or for a target directory.

$ terraform apply DIR