diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 9a05cfd..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,106 +0,0 @@ -#------------------------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. -#------------------------------------------------------------------------------------------------------------- - -FROM golang:1.17 as base - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# 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, install packages and tools -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ - && apt-get -y install git openssh-client iproute2 procps lsb-release -y \ - && apt-get update \ - && apt-get install ca-certificates curl apt-transport-https lsb-release gnupg -y \ - && curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | \ - tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null \ - && AZ_REPO=$(lsb_release -cs) \ - && echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \ - tee /etc/apt/sources.list.d/azure-cli.list \ - && apt-get update \ - && apt-get install azure-cli -y \ - # Install Go tools w/module support - && mkdir -p /tmp/gotools \ - && cd /tmp/gotools \ - && GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \ - && GO111MODULE=on go get -v \ - honnef.co/go/tools/...@latest \ - golang.org/x/tools/cmd/gorename@latest \ - golang.org/x/tools/cmd/goimports@latest \ - golang.org/x/tools/cmd/guru@latest \ - golang.org/x/lint/golint@latest \ - github.com/mdempsky/gocode@latest \ - github.com/cweill/gotests/...@latest \ - github.com/haya14busa/goplay/cmd/goplay@latest \ - github.com/sqs/goreturns@latest \ - github.com/josharian/impl@latest \ - github.com/davidrjenni/reftools/cmd/fillstruct@latest \ - github.com/uudashr/gopkgs/v2/cmd/gopkgs \ - github.com/ramya-rao-a/go-outline@latest \ - github.com/acroca/go-symbols@latest \ - github.com/godoctor/godoctor@latest \ - github.com/rogpeppe/godef@latest \ - github.com/zmb3/gogetdoc@latest \ - github.com/fatih/gomodifytags@latest \ - github.com/mgechev/revive@latest \ - github.com/go-delve/delve/cmd/dlv@latest 2>&1 \ - # - # Install Go tools w/o module support - # && go get -v github.com/alecthomas/gometalinter 2>&1 \ - # - # Install gocode-gomod - #&& go get -x -d github.com/stamblerre/gocode 2>&1 \ - #&& go build -o gocode-gomod github.com/stamblerre/gocode \ - #&& mv gocode-gomod $GOPATH/bin/ \ - # - # Install golangci-lint - && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1 \ - # - # 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 - && apt-get install -y sudo \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - # Add write permission for /go/pkg - && chmod -R a+w /go/pkg \ - # - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* /go/src /tmp/gotools - - -# Update this to "on" or "off" as appropriate -ENV GO111MODULE=auto - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND=dialog - - -# Add terraform -FROM base - -ENV versionTerraform=0.14.5 - -RUN apt-get update \ - && apt-get -y install \ - unzip \ - # Install Terraform - && echo "Installing terraform ${versionTerraform}..." && \ - curl -sSL -o /tmp/terraform.zip https://releases.hashicorp.com/terraform/${versionTerraform}/terraform_${versionTerraform}_linux_amd64.zip 2>&1 && \ - unzip -d /usr/local/bin /tmp/terraform.zip \ - && mkdir -p /root/.terraform.d/plugins - -RUN go get github.com/bflad/tfproviderlint/cmd/tfproviderlint diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ada804d..ff05775 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,34 +1,60 @@ // For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at: // https://github.com/microsoft/vscode-dev-containers/tree/v0.101.0/containers/go { - "name": "Go", - "dockerFile": "Dockerfile", - "runArgs": [ - "--cap-add=SYS_PTRACE", - "--security-opt", - "seccomp=unconfined", - "--mount", - "type=volume,source=shell,destination=/root", - "--mount", - "type=volume,source=go,destination=/go", - // "--mount", "type=bind,source=${HOME}/.ssh,destination=/tmp/.ssh-localhost,readonly" - ], - "mounts": [ - "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/tmp/.ssh-localhost,type=bind,consistency=cached" - ], - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash", - "go.gopath": "/go" - }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "cp -R /tmp/.ssh-localhost/* ~/.ssh && chmod 700 ~/.ssh && chmod 600 ~/.ssh/*", - // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. - // "remoteUser": "vscode" - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-vscode.go" - ] + "name": "Azure SRE TF provider", + + // Use a specific image for the dev container + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "remoteUser": "vscode", + + // Mount local SSH keys into the container + "mounts": [ + "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/tmp/.ssh-localhost,type=bind,consistency=cached" + ], + + // Additional arguments for running the container + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined", + "--mount", + "type=volume,source=shell,destination=/root", + "--mount", + "type=volume,source=go,destination=/go" + ], + + // Features to be installed in the container + "features": { + "ghcr.io/azure/azure-dev/azd:latest": {}, + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/devcontainers/features/go:1": { + "version": "1.23" + }, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/terraform:1": {}, + "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": { + "plugins": [ + "aliases", + "syntax-highlighting", + "autosuggestions" + ], + "username": "vscode" + } + }, + + // Customizations for VS Code + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.go", + "GitHub.copilot", + "mutantdino.resourcemonitor", + "eamodio.gitlens" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "go.gopath": "/go" + } + } + } } \ No newline at end of file