Running Terraform Plan Locally

Whilst it is possible to see the results of a Terraform plan when you create a pull request, it is also possible to run a Terraform plan locally. Some engineers prefer this as it provides a quicker feedback loop to identify any issues with your infrastructure code.

Enter your AWS SSO credentials

Get your AWS SSO credentials as detailed here, choose option 1 and paste the credentials into the terminal window you are working from.

Please note that the credentials will expire after a period of 1 hour.

Install Terraform

Follow the instructions here to install the latest version of Terraform according to your platform.

Run Terraform plan

  1. Navigate to your application infrastructure code - cd modernisation-platform-environments/terraform/environments/my-application
  2. Run terraform init
  3. View the workspaces (you have different workspaces for your different environment accounts) - terraform workspace list
  4. Select the required workspace - terraform workspace select my-application-development
  5. Run a Terraform plan - terraform plan

Running a plan locally has read only permissions, you will not be able to run an apply, destroy or import. The example syntax for assuming a backend role is appropriate for Terraform 1.6.0 onwards.

Last reviewed: 23 January 2026Review status: ✓ Up to dateOwner: #modernisation-platformSource: View source on GitHub

Was this page useful?