diff --git a/containers/azure-terraform/.devcontainer/Dockerfile b/containers/azure-terraform-0.11/.devcontainer/Dockerfile similarity index 100% rename from containers/azure-terraform/.devcontainer/Dockerfile rename to containers/azure-terraform-0.11/.devcontainer/Dockerfile diff --git a/containers/azure-terraform-0.11/.devcontainer/devcontainer.json b/containers/azure-terraform-0.11/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..489556aef9 --- /dev/null +++ b/containers/azure-terraform-0.11/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "name": "Azure Terraform 0.11", + "dockerFile": "Dockerfile", + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + // Use 'settings' to set *default* container specific settings.json values on container create. + // You can edit these settings after create using File > Preferences > Settings > Remote. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Use 'appPort' to create a container with published ports. If the port isn't working, be sure + // your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost. + // "appPort": [], + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "terraform --version", + + // Uncomment the next line if you will use a ptrace-based debugger like C++, Go, and Rust + // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], + + // Uncomment the next line to have VS Code connect as an existing non-root user in the container. + // On Linux, by default, the container user's UID/GID will be updated to match your local user. See + // https://aka.ms/vscode-remote/containers/non-root for details on adding a non-root user if none exist. + // "remoteUser": "vscode", + + // Add the IDs of extensions you want installed when the container is created in the array below. + "extensions": [ + "mauve.terraform", + "ms-azuretools.vscode-azureterraform", + "ms-vscode.azurecli", + "ms-azuretools.vscode-docker" + ] +} \ No newline at end of file diff --git a/containers/azure-terraform/.npmignore b/containers/azure-terraform-0.11/.npmignore similarity index 100% rename from containers/azure-terraform/.npmignore rename to containers/azure-terraform-0.11/.npmignore diff --git a/containers/azure-terraform/README.md b/containers/azure-terraform-0.11/README.md similarity index 89% rename from containers/azure-terraform/README.md rename to containers/azure-terraform-0.11/README.md index c6bd0da4a5..7077754e86 100644 --- a/containers/azure-terraform/README.md +++ b/containers/azure-terraform-0.11/README.md @@ -1,4 +1,4 @@ -# Azure Terraform +# Azure Terraform 0.11 ## Summary @@ -6,7 +6,7 @@ | Metadata | Value | |----------|-------| -| *Contributors* | The VS Code Team | +| *Contributors* | [Carlos Mendible](https://github.com/cmendible) | | *Definition type* | Dockerfile | | *Languages, platforms* | Terraform | @@ -14,6 +14,12 @@ While technically optional, this definition includes the Azure Terraform extension which requires an Azure account to use. You can create a [free trial account here](https://azure.microsoft.com/en-us/free/) and find out more about using [Teraform with Azure here](https://docs.microsoft.com/en-us/azure/terraform/terraform-overview). If you plan to use the Azure Cloud Shell for all of your Terraform operations, you can comment out the installation of the Docker CLI in `.devcontainer/Dockerfile`. Conversely, if you do not plan to use Cloud Shell, you can comment out the installation of Node.js. The definition has been setup so you can do either as it makes sense. +You can also choose the specific version of Terraform installed by updating the following line in `.devcontainer/Dockerfile`: + +```Dockerfile +ARG TERRAFORM_VERSION=0.11.13 +``` + Next, follow these steps: 1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. diff --git a/containers/azure-terraform-0.12/.devcontainer/Dockerfile b/containers/azure-terraform-0.12/.devcontainer/Dockerfile new file mode 100644 index 0000000000..76f323b813 --- /dev/null +++ b/containers/azure-terraform-0.12/.devcontainer/Dockerfile @@ -0,0 +1,87 @@ +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- + +# Pick any base image, but if you select node, skip installing node. 😊 +FROM debian:9 + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Terraform and tflint versions +ARG TERRAFORM_VERSION=0.12.16 +ARG TFLINT_VERSION=0.8.2 + +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ + # + # install git iproute2, required tools installed + && apt-get install -y \ + git \ + curl \ + procps \ + unzip \ + apt-transport-https \ + ca-certificates \ + gnupg-agent \ + software-properties-common \ + lsb-release 2>&1 \ + # + # [Optional] Install Node.js for Azure Cloud Shell support + # Change the "lts/*" in the two lines below to pick a different version + && curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 2>&1 \ + && /bin/bash -c "source $HOME/.nvm/nvm.sh \ + && nvm install lts/* \ + && nvm alias default lts/*" 2>&1 \ + # + # [Optional] For local testing instead of cloud shell + # Install Docker CE CLI. + && curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \ + && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \ + && apt-get update \ + && apt-get install -y docker-ce-cli \ + # + # [Optional] For local testing instead of cloud shell + # Install the Azure CLI + && echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ + && curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \ + && apt-get update \ + && apt-get install -y azure-cli \ + # + # Install Terraform, tflint, and graphviz + && mkdir -p /tmp/docker-downloads \ + && curl -sSL -o /tmp/docker-downloads/terraform.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip \ + && unzip /tmp/docker-downloads/terraform.zip \ + && mv terraform /usr/local/bin \ + && curl -sSL -o /tmp/docker-downloads/tflint.zip https://github.com/wata727/tflint/releases/download/v${TFLINT_VERSION}/tflint_linux_amd64.zip \ + && unzip /tmp/docker-downloads/tflint.zip \ + && mv tflint /usr/local/bin \ + && cd ~ \ + && rm -rf /tmp/docker-downloads \ + && apt-get install -y graphviz \ + # + # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. + && groupadd --gid $USER_GID $USERNAME \ + && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # [Optional] Add sudo support for the non-root user + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ + && chmod 0440 /etc/sudoers.d/$USERNAME \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file diff --git a/containers/azure-terraform/.devcontainer/devcontainer.json b/containers/azure-terraform-0.12/.devcontainer/devcontainer.json similarity index 91% rename from containers/azure-terraform/.devcontainer/devcontainer.json rename to containers/azure-terraform-0.12/.devcontainer/devcontainer.json index ae30b393ec..a001af078d 100644 --- a/containers/azure-terraform/.devcontainer/devcontainer.json +++ b/containers/azure-terraform-0.12/.devcontainer/devcontainer.json @@ -1,15 +1,16 @@ { - "name": "Azure Terraform", + "name": "Azure Terraform 0.12", "dockerFile": "Dockerfile", - "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], // Use 'settings' to set *default* container specific settings.json values on container create. // You can edit these settings after create using File > Preferences > Settings > Remote. "settings": { "terminal.integrated.shell.linux": "/bin/bash" }, - // Use 'appPort' to create a container with published ports. If the port isn't working, be sure // your server accepts connections from all interfaces (0.0.0.0 or '*'), not just localhost. // "appPort": [], diff --git a/containers/azure-terraform-0.12/.npmignore b/containers/azure-terraform-0.12/.npmignore new file mode 100644 index 0000000000..1d72d293eb --- /dev/null +++ b/containers/azure-terraform-0.12/.npmignore @@ -0,0 +1,4 @@ +README.md +test-project +.vscode +.npmignore diff --git a/containers/azure-terraform-0.12/README.md b/containers/azure-terraform-0.12/README.md new file mode 100644 index 0000000000..16e656c799 --- /dev/null +++ b/containers/azure-terraform-0.12/README.md @@ -0,0 +1,45 @@ +# Azure Terraform 0.12 + +## Summary + +*Get going quickly with Terraform in Azure. Includes Terraform, the Azure CLI, the Docker CLI (for testing locally), Node.js for Cloud Shell, and related extensions and dependencies.* + +| Metadata | Value | +|----------|-------| +| *Contributors* | [Carlos Mendible](https://github.com/cmendible) | +| *Definition type* | Dockerfile | +| *Languages, platforms* | Terraform | + +## Using this definition with an existing folder + +While technically optional, this definition includes the Azure Terraform extension which requires an Azure account to use. You can create a [free trial account here](https://azure.microsoft.com/en-us/free/) and find out more about using [Teraform with Azure here](https://docs.microsoft.com/en-us/azure/terraform/terraform-overview). If you plan to use the Azure Cloud Shell for all of your Terraform operations, you can comment out the installation of the Docker CLI in `.devcontainer/Dockerfile`. Conversely, if you do not plan to use Cloud Shell, you can comment out the installation of Node.js. The definition has been setup so you can do either as it makes sense. + +You can also choose the specific version of Terraform installed by updating the following line in `.devcontainer/Dockerfile`: + +```Dockerfile +ARG TERRAFORM_VERSION=0.12.16 +``` + +Next, follow these steps: + +1. If this is your first time using a development container, please follow the [getting started steps](https://aka.ms/vscode-remote/containers/getting-started) to set up your machine. + +2. To use VS Code's copy of this definition: + 1. Start VS Code and open your project folder. + 2. Press F1 select and **Remote-Containers: Add Development Container Configuration Files...** from the command palette. + 3. Select the Azure Terraform definition. + +3. To use latest-and-greatest copy of this definition from the repository: + 1. Clone this repository. + 2. Copy the contents of `containers/azure-terraform/.devcontainer` to the root of your project folder. + 3. Start VS Code and open your project folder. + +4. After following step 2 or 3, the contents of the `.devcontainer` folder in your project can be adapted to meet your needs. + +5. Finally, press F1 and run **Remote-Containers: Reopen Folder in Container** to start using the definition. + +## License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the MIT License. See [LICENSE](https://github.com/Microsoft/vscode-dev-containers/blob/master/LICENSE).