Skip to main content

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 a Terraform init - 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.

This page was last reviewed on 14 April 2023. It needs to be reviewed again on 14 October 2023 by the page owner #modernisation-platform .
This page was set to be reviewed before 14 October 2023 by the page owner #modernisation-platform. This might mean the content is out of date.