Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #184 from microsoft/clantz/manual-merge
Browse files Browse the repository at this point in the history
Manual merge of PR #160
  • Loading branch information
Chuxel committed Jan 6, 2020
2 parents b3cb647 + 90734ec commit 1652bd0
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 5 deletions.
35 changes: 35 additions & 0 deletions containers/azure-terraform-0.11/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# Azure Terraform
# Azure Terraform 0.11

## 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* | The VS Code Team |
| *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.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.
Expand Down
87 changes: 87 additions & 0 deletions containers/azure-terraform-0.12/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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": [],
Expand Down
4 changes: 4 additions & 0 deletions containers/azure-terraform-0.12/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
README.md
test-project
.vscode
.npmignore
45 changes: 45 additions & 0 deletions containers/azure-terraform-0.12/README.md
Original file line number Diff line number Diff line change
@@ -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 <kbd>F1</kbd> 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 <kbd>F1</kbd> 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).

0 comments on commit 1652bd0

Please sign in to comment.