Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for devcontainer #1246

Merged
merged 5 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .devcontainer/.terraformrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider_installation {
dev_overrides {
"scaleway/scaleway" = "/workspaces/terraform-provider-scaleway"
}

# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go/.devcontainer/base.Dockerfile

# [Choice] Go version (use -bullseye variants on local arm64/Apple Silicon): 1, 1.16, 1.17, 1-bullseye, 1.16-bullseye, 1.17-bullseye, 1-buster, 1.16-buster, 1.17-buster
ARG VARIANT="1.18-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}

COPY .terraformrc /home/vscode/.terraformrc

# Check out the latest release available on github <https://github.com/scaleway/scaleway-cli/releases/latest>
ARG SCW_CLI_VERSION="2.5.1"
# Download the release from github
RUN curl -o /usr/local/bin/scw -L "https://github.com/scaleway/scaleway-cli/releases/download/v${SCW_CLI_VERSION}/scaleway-cli_${SCW_CLI_VERSION}_linux_amd64"
# Allow executing file as program
RUN chmod +x /usr/local/bin/scw
59 changes: 59 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go
{
"name": "Go",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"VARIANT": "1.18",
// Options
"NODE_VERSION": "none"
}
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

// Set *default* container specific settings.json values on container create.
"settings": {
"go.toolsManagement.checkForUpdates": "local",
"go.useLanguageServer": true,
"go.gopath": "/go"
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"golang.Go"
],
"containerEnv": {
// Access key of a token
"SCW_ACCESS_KEY": "${localEnv:SCW_ACCESS_KEY}",
// Secret key of a token
"SCW_SECRET_KEY": "${localEnv:SCW_SECRET_KEY}",
// Url of the API
//"SCW_API_URL": "${localEnv:SCW_API_URL}",
// Your default availability zone (fr-par-1, nl-ams-1, ...)
//"SCW_DEFAULT_ZONE": "${localEnv:SCW_DEFAULT_ZONE}",
// Your default region (fr-par, nl-ams, ...)
//"SCW_DEFAULT_REGION": "${localEnv:SCW_DEFAULT_REGION}",
// Your default project ID
"SCW_DEFAULT_PROJECT_ID": "${localEnv:SCW_DEFAULT_PROJECT_ID}",
// Your default organization ID
"SCW_DEFAULT_ORGANIZATION_ID": "${localEnv:SCW_DEFAULT_ORGANIZATION_ID}"
},

// 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": "go version",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"kubectl-helm-minikube": "1.23",
"github-cli": "latest",
"terraform": "1.1"
}
}