I've been trying to figure out the answer to this for a while, for my own purposes. I decided today that I was going to figure it out and I believe I have it working (installing terraform, the LSP and the AWS provider) using

# Terraform, LSP and AWS Provider
ENV TERRAFORM_VERSION=0.12.24
ENV TERRAFORM_LSP_VERSION=0.0.10
ENV TERRAFORM_AWS_PROVIDER_VERSION=2.59.0

RUN wget -c https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
    && unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
    && mv terraform /usr/local/bin \
    && wget -c https://releases.hashicorp.com/terraform-provider-aws/${TERRAFORM_AWS_PROVIDER_VERSION}/terraform-provider-aws_${TERRAFORM_AWS_PROVIDER_VERSION}_linux_amd64.zip \
    && unzip terraform-provider-aws_${TERRAFORM_AWS_PROVIDER_VERSION}_linux_amd64.zip \
    && mv terraform-provider-aws_v${TERRAFORM_AWS_PROVIDER_VERSION}* /usr/local/bin \
    && echo "provider \"aws\" {}" >> /usr/local/bin/providers.tf \
    && wget -c https://github.com/juliosueiras/terraform-lsp/releases/download/v${TERRAFORM_LSP_VERSION}/terraform-lsp_${TERRAFORM_LSP_VERSION}_linux_amd64.tar.gz -O - | tar -zx \
    && mv terraform-lsp /usr/local/bin \
    && rm terraform*.zip

because I'm installing this to /usr/local/bin and I'm creating a containerUser which wouldn't have access to install these components, I needed to add the following to the settings section of my devcontainer.json

        "terraform.indexing": {
            "enabled": false
        },
        "terraform.languageServer": {
            "enabled": true,
            "installCommonProviders": false,
            "pathToBinary": "/usr/local/bin"
        },

Obviously you need to make adjustments if you want other providers, or to install it elsewhere, or different versions of terraform, the LSP or the AWS provider, but they all should be simple changes.

The latest releases can be found at the following links:

  • Terraform
  • Terraform LSP
  • AWS Provider
  • Other Providers
Answer from pdr on Stack Overflow
🌐
GitHub
github.com › awslabs › aws-terraform-dev-container
GitHub - awslabs/aws-terraform-dev-container: A VSCode Dev Container with tools to help you build and manage AWS infrastructure with Terraform · GitHub
A VSCode Dev Container with tools to help you build and manage AWS infrastructure with Terraform - awslabs/aws-terraform-dev-container
Starred by 161 users
Forked by 30 users
Languages   Shell 81.0% | Dockerfile 11.6% | HCL 5.4% | Makefile 2.0%
🌐
Medium
medium.com › @gyulshenabazz › mastering-terraform-with-visual-studio-code-dev-containers-5294e3f5bfaa
Mastering Terraform with Visual Studio Code Dev Containers | by Gyulshen Abaz | Medium
October 16, 2023 - version: '3.8' services: terraform: build: context: .. dockerfile: .devcontainer/Dockerfile volumes: - ../..:/workspaces:cached - ./direnv/config.toml:/root/.config/direnv/config.toml # Overrides default command so things don't shut down after the process ends.
Discussions

Visual Studio Code Dev Container support ?
I can use the extension fine on ... systems terraform v1.5.1 is installed. The terraform explorer works fine. Now I tried to use the extension inside a Visual Studio Code (vscode) developer container (devContainer).... More on github.com
🌐 github.com
4
June 29, 2023
visual studio code - How do I add the experimental language server to a devcontainer for vscode? - Stack Overflow
I'm doing a pretty basic devcontainer for terraform work in VSCode on Windows. Every time I start it up or rebuild the container for use, it prompts me to install the experimental language server w... More on stackoverflow.com
🌐 stackoverflow.com
Terraform devcontainer: ms-azuretools.vscode-azureterraform is deprecated
The Terraform dev container ghcr.io/devcontainers/features/terraform includes the VS Code extension Azure Terraform ms-azuretools.vscode-azureterraform. This extension depends on a now deprecated e... More on github.com
🌐 github.com
0
February 7, 2025
Update Azure Terraform dev container HashiCorp Extension settings
Currently the Azure Terraform devcontainer breaks the HashiCorp Extension by contributing incorrect default settings: vscode-dev-containers/containers/azure-terraform/.devcontainer/devcontainer.jso... More on github.com
🌐 github.com
8
August 31, 2022
🌐
GitHub
github.com › microsoft › vscode-dev-containers › blob › main › script-library › docs › terraform.md
vscode-dev-containers/script-library/docs/terraform.md at main · microsoft/vscode-dev-containers
SHA256 checksum to use to verify the Terraform download. automatic will both acquire the checksum and do a signature verification of it. ... SHA256 checksum to use to verify the TFLint download. automatic will both acquire the checksum and do a signature verification of it. ... SHA256 checksum to use to verify the Terragrunt download. automatic will download the checksum. To install these capabilities in your primary dev container, reference it in devcontainer.json as follows:
Author   microsoft
🌐
GitHub
github.com › hashicorp › vscode-terraform › issues › 1524
Visual Studio Code Dev Container support ? · Issue #1524 · hashicorp/vscode-terraform
June 29, 2023 - { "name": "Terraform GCP", "build": { "dockerfile": "Dockerfile" }, "runArgs": [ "--init" ], "features": { "ghcr.io/devcontainers/features/terraform:1": { "version": "latest", "tflint": "latest", "terragrunt": "latest" }, "ghcr.io/dhoeric/features/terraform-docs:1": { "version": "latest" } }, "customizations": { "vscode": { "extensions": [ "hashicorp.terraform" ], "settings": { "terraform.languageServer": { "enabled": true, "args": ["serve"] } } } }, "remoteEnv": { "TF_LOG": "INFO", "TF_LOG_PATH": "./terraform.log" } }
Author   N7K4
🌐
Perficient Blogs
blogs.perficient.com › 2023 › 10 › 12 › azure resource provisioning with terraform using vs code devcontainer box
Azure Resource Provisioning with Terraform Using VS Code Devcontainer Box / Blogs / Perficient
October 12, 2023 - 5. Create one more devcontainer for the test environment to target test environment. Do the same thing for other environments too. 6. Create a Backend folder and create. tfconfig files(backend/my.dev.tfconfig) based on the environments and specify the backed details in that file. subscription_id = "*************" resource_group_name = "MY-RG" storage_account_name = "mytfsa2" container_name = "terraform" key = "dev.terraform.tfstate"
Top answer
1 of 1
2

I've been trying to figure out the answer to this for a while, for my own purposes. I decided today that I was going to figure it out and I believe I have it working (installing terraform, the LSP and the AWS provider) using

# Terraform, LSP and AWS Provider
ENV TERRAFORM_VERSION=0.12.24
ENV TERRAFORM_LSP_VERSION=0.0.10
ENV TERRAFORM_AWS_PROVIDER_VERSION=2.59.0

RUN wget -c https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
    && unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip \
    && mv terraform /usr/local/bin \
    && wget -c https://releases.hashicorp.com/terraform-provider-aws/${TERRAFORM_AWS_PROVIDER_VERSION}/terraform-provider-aws_${TERRAFORM_AWS_PROVIDER_VERSION}_linux_amd64.zip \
    && unzip terraform-provider-aws_${TERRAFORM_AWS_PROVIDER_VERSION}_linux_amd64.zip \
    && mv terraform-provider-aws_v${TERRAFORM_AWS_PROVIDER_VERSION}* /usr/local/bin \
    && echo "provider \"aws\" {}" >> /usr/local/bin/providers.tf \
    && wget -c https://github.com/juliosueiras/terraform-lsp/releases/download/v${TERRAFORM_LSP_VERSION}/terraform-lsp_${TERRAFORM_LSP_VERSION}_linux_amd64.tar.gz -O - | tar -zx \
    && mv terraform-lsp /usr/local/bin \
    && rm terraform*.zip

because I'm installing this to /usr/local/bin and I'm creating a containerUser which wouldn't have access to install these components, I needed to add the following to the settings section of my devcontainer.json

        "terraform.indexing": {
            "enabled": false
        },
        "terraform.languageServer": {
            "enabled": true,
            "installCommonProviders": false,
            "pathToBinary": "/usr/local/bin"
        },

Obviously you need to make adjustments if you want other providers, or to install it elsewhere, or different versions of terraform, the LSP or the AWS provider, but they all should be simple changes.

The latest releases can be found at the following links:

  • Terraform
  • Terraform LSP
  • AWS Provider
  • Other Providers
🌐
Medium
medium.com › geekculture › working-with-terraform-and-aws-within-a-container-on-visual-studio-code-8f6f1a0f2a2a
Working with Terraform and AWS within a Container on Visual Studio Code
August 2, 2022 - Create a “.devcontainer” folder. This will be where all the instructions will be given on how our container is set up. ... A new tech publication by Start it up (https://medium.com/swlh). ... Enterprise Solution Architect | Certified K8s Administrator/Developer ⚓ | SAFe SPC | Cert Terraform | AWS Solutions Architect | Dev*Ops/GitOps Engineer 🔥
Find elsewhere
🌐
Medium
medium.com › @riaan.nolan › top-gun-terraform-development-environment-60ac00d49577
Top Gun Terraform Development Environment | by Riaan Nolan | Medium
October 9, 2023 - Meaning that you don’t need to have Terraform, Terragrunt, TFEnv etc. installed on your laptop, all you need is Docker, Git and VSCode + The Dev / Remote Container extension for VSCode..
🌐
SharePoint Europe
sharepointeurope.com › getting-started-with-a-development-container-for-terraform-on-azure
Getting started with a Development Container for Terraform On Azure | ESPC Conference, 2025
December 12, 2022 - Imagine, you would like to provision resources in Azure using Terraform, but you don’t have the tools, respectively the prerequisites installed on your local machine? A dev container, including all the mandatory stuff could help for that purpose. In this post I’d like to show you how I’m using my dev container to: apply Azure CLI commands (login, updating a kubeconfig file) ... Docker Extension for Visual Studio Code: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
🌐
GitHub
github.com › hashicorp › vscode-terraform › issues › 1410
Failure to start terraform-ls in devcontainer · Issue #1410 · hashicorp/vscode-terraform
Devcontainer is a custom build with all our platform engineering tools. Here's a summary of the Containerfile spec.: configure the build · configure environment · install prerequisites · create Python virtual environment (in vscode userspace) install Ansible · install HashiCorp repo and keys · install Terraform ·
Author   ghost
🌐
GitHub
github.com › devcontainers › features › issues › 1266
Terraform devcontainer: ms-azuretools.vscode-azureterraform is deprecated · Issue #1266 · devcontainers/features
February 7, 2025 - The Terraform dev container ghcr.io/devcontainers/features/terraform includes the VS Code extension Azure Terraform ms-azuretools.vscode-azureterraform. This extension depends on a now deprecated extension Azure Account ms-vscode.azure-account.
Author   williamoconnorme
🌐
Patrickkoch
patrickkoch.dev › posts › post_24
Getting started with a Development Container for Terraform On Azure
Imagine, you would like to provision resources in Azure using Terraform, but you don’t have the tools, respectively the prerequisites installed on your local machine? A dev container, including all the mandatory stuff could help for that purpose. In this post I’d like to show you how I’m using my dev container to: apply Azure CLI commands (login, updating a kubeconfig file) ... Docker Extension for Visual Studio Code: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › containers
Developing inside a Container
November 3, 2021 - Enter microsoft/vscode-remote-try-node (or one of the other "try" repositories), a Git URI, a GitHub branch URL, or a GitHub PR URL in the input box that appears and press Enter. Tip: If you choose a private repository, you may want to setup a credential manager or add your SSH keys to your SSH agent. See Sharing Git credentials with your container. If your repository does not have a .devcontainer/devcontainer.json file in it, you'll be asked to pick a starting point from a filterable list or an existing Dockerfile or Docker Compose file (if one exists).
🌐
GitHub
github.com › microsoft › vscode-dev-containers › issues › 1608
Update Azure Terraform dev container HashiCorp Extension settings · Issue #1608 · microsoft/vscode-dev-containers
August 31, 2022 - The terraform.languageServer.args property should not be empty, it should contain at least serve. In addition, the HashiCorp Extension changed it's setting structure for some settings in v2.24.0. Old settings are still honored for a period of time, but we should update this devcontainer with the correct names.
Author   jpogran
🌐
Visual Studio Code
code.visualstudio.com › docs › devcontainers › create-dev-container
Create a Dev Container
November 3, 2021 - Note: The Dev Containers extension has a Dev Containers: Add Dev Container Configuration Files... command that lets you pick a pre-defined container configuration from a list. If you'd prefer to have a complete dev container immediately rather than building up the devcontainer.json and Dockerfile step-by-step, you can skip ahead to Automate dev container creation.
🌐
7amza's Blog
seven-ops.cloud › post › terraform-inside-container
Terraform Development Using Visual Studio Code Remote Containers | 7amza's Blog - Cloud Trends, Tips, and Tutorials
February 9, 2021 - In that folder we would find the devcontainer.json and a Dockerfile · { "name": "Azure CLI", "dockerFile": "Dockerfile", // Set *default* container specific settings.json values on container create. "settings": { "terminal.integrated.shell.linux": "/bin/bash" }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ "ms-vscode.azurecli", "4ops.terraform" ], // Comment out connect as root instead.
🌐
Visual Studio Code
code.visualstudio.com › Search
Visual Studio Code documentation search
November 3, 2021 - Search Visual Studio Code's documentation.'
🌐
DEV Community
dev.to › techielass › set-up-a-dev-container-for-terraform-in-github-codespaces-783
Set up a dev container for Terraform in GitHub Codespaces - DEV Community
July 4, 2023 - In this blog post I’ll dive into the concept of what a GitHub Codespace is and how you can build a dedicated environment to work on Terraform for Azure. GitHub Codespaces are built on top of development containers, or dev containers. These containers are Docker containers that offer a development environment you can customise to provide a consistent experience for yourself or your team. The dev containers are configured using three files: ... You’ll find for some small dev container configurations only the devcontainer.json file will be needed.
🌐
Unicast Cloud
unicast.com.br › posts › criando-devcontainer-terraform-para-azure-no-vs-code
Criando DevContainer Terraform para Azure no VS Code | Unicast Cloud
November 19, 2023 - O objetivo deste devcontainer é criar um contêiner VS Code com todas as ferramentas, bibliotecas e frameworks necessários para sua equipe, evitando perca de tempo na configuração do ambiente de desenvolvimento local.
🌐
Speaker Deck
speakerdeck.com › devops_vtj › raibudemo-visual-studio-codenodev-containerswoshi-tutekai-fa-huan-jing-gou-zhu-sitemiruyo
【ライブデモ】Visual Studio CodeのDev Containersを使って開発環境構築してみるよ - Speaker Deck
September 7, 2023 - GitHubを通じて他者と共有されない ▪ プロジェクト外に作成される • ワークスペース(緑枠) ◦ ワークスペース内のみで有効 ◦ GitHubを通じて共有することが可能 ▪ .vscode/settings.json • フォルダ(赤枠) ◦ 特定のフォルダのみに有効 ◦ Multi-root Workspaces使用時のみ ◦ GitHubを通じて共有することが可能 ▪ プロジェクト配下にpjA/.vscode/settings.json · “Dockerfile”, “context”: “.” } } 34 docker-compose.ymlの場合 { “dockerComposeFile”: “docker-compose.yml”, “service”: “devcontainer”, “workspaceFolder”: “/workspaces/${localWorkspaceFolderBasename}” }