Skip to content

Commit cba3d4f

Browse files
committed
feat: add support for devcontainer (scaleway#1246)
1 parent b5320b9 commit cba3d4f

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed

.devcontainer/.terraformrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
provider_installation {
2+
dev_overrides {
3+
"scaleway/scaleway" = "/workspaces/terraform-provider-scaleway"
4+
}
5+
6+
# For all other providers, install them directly from their origin provider
7+
# registries as normal. If you omit this, Terraform will _only_ use
8+
# the dev_overrides block, and so no other providers will be available.
9+
direct {}
10+
}

.devcontainer/Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go/.devcontainer/base.Dockerfile
2+
3+
# [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
4+
ARG VARIANT="1.18-bullseye"
5+
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT}
6+
7+
COPY .terraformrc /home/vscode/.terraformrc
8+
9+
# Check out the latest release available on github <https://github.com/scaleway/scaleway-cli/releases/latest>
10+
ARG SCW_CLI_VERSION="2.5.1"
11+
# Download the release from github
12+
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"
13+
# Allow executing file as program
14+
RUN chmod +x /usr/local/bin/scw

.devcontainer/devcontainer.json

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go
3+
{
4+
"name": "Go",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"args": {
8+
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
9+
// Append -bullseye or -buster to pin to an OS version.
10+
// Use -bullseye variants on local arm64/Apple Silicon.
11+
"VARIANT": "1.18",
12+
// Options
13+
"NODE_VERSION": "none"
14+
}
15+
},
16+
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
17+
18+
// Set *default* container specific settings.json values on container create.
19+
"settings": {
20+
"go.toolsManagement.checkForUpdates": "local",
21+
"go.useLanguageServer": true,
22+
"go.gopath": "/go"
23+
},
24+
25+
// Add the IDs of extensions you want installed when the container is created.
26+
"extensions": [
27+
"golang.Go"
28+
],
29+
"containerEnv": {
30+
// Access key of a token
31+
"SCW_ACCESS_KEY": "${localEnv:SCW_ACCESS_KEY}",
32+
// Secret key of a token
33+
"SCW_SECRET_KEY": "${localEnv:SCW_SECRET_KEY}",
34+
// Url of the API
35+
//"SCW_API_URL": "${localEnv:SCW_API_URL}",
36+
// Your default availability zone (fr-par-1, nl-ams-1, ...)
37+
//"SCW_DEFAULT_ZONE": "${localEnv:SCW_DEFAULT_ZONE}",
38+
// Your default region (fr-par, nl-ams, ...)
39+
//"SCW_DEFAULT_REGION": "${localEnv:SCW_DEFAULT_REGION}",
40+
// Your default project ID
41+
"SCW_DEFAULT_PROJECT_ID": "${localEnv:SCW_DEFAULT_PROJECT_ID}",
42+
// Your default organization ID
43+
"SCW_DEFAULT_ORGANIZATION_ID": "${localEnv:SCW_DEFAULT_ORGANIZATION_ID}"
44+
},
45+
46+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
47+
// "forwardPorts": [],
48+
49+
// Use 'postCreateCommand' to run commands after the container is created.
50+
// "postCreateCommand": "go version",
51+
52+
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
53+
"remoteUser": "vscode",
54+
"features": {
55+
"kubectl-helm-minikube": "1.23",
56+
"github-cli": "latest",
57+
"terraform": "1.1"
58+
}
59+
}

0 commit comments

Comments
 (0)