Run Terraform in a Docker container.

<pre lang="bash">
docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest

Create an alias.

<pre lang="bash">
alias terraform='docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest'

Run the command

<pre lang="bash">
terraform --version
Terraform v1.0.2
on linux_amd64