Skip to content

Commit 721eeba

Browse files
committed
dev: improve devcontainer env
1 parent 0578891 commit 721eeba

File tree

6 files changed

+76
-29
lines changed

6 files changed

+76
-29
lines changed

.devcontainer/Dockerfile

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
1-
FROM mcr.microsoft.com/devcontainers/base:jammy
1+
FROM mcr.microsoft.com/vscode/devcontainers/base:jammy
22

3-
# Install AWS CLI
4-
RUN apt-get update && \
5-
apt-get install -y unzip python3-pip && \
6-
pip3 install --no-cache-dir --upgrade awscli && \
7-
apt-get clean && \
8-
rm -rf /var/lib/apt/lists/*
9-
10-
# Install Docker CLI
11-
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
3+
# install aws
4+
RUN SYSTEM_ARCH=$(uname -m) \
5+
&& curl "https://awscli.amazonaws.com/awscli-exe-linux-${SYSTEM_ARCH}.zip" -o "awscliv2.zip" \
6+
&& unzip awscliv2.zip \
7+
&& aws/install \
8+
&& aws --version \
9+
&& rm -rf aws
1210

13-
# Install Terraform
11+
# install terraform
1412
ENV TERRAFORM_VERSION=1.5.1
1513
ENV TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
14+
RUN mkdir -p $TF_PLUGIN_CACHE_DIR
1615
RUN SYSTEM_ARCH=$(dpkg --print-architecture) \
17-
&& mkdir -p $TF_PLUGIN_CACHE_DIR \
1816
&& curl -OL https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
1917
&& unzip terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip \
2018
&& mv terraform /usr/local/bin/ \
2119
&& terraform version \
2220
&& rm terraform_${TERRAFORM_VERSION}_linux_${SYSTEM_ARCH}.zip
2321

24-
# Verify Installs
22+
# install docker
23+
COPY --from=docker:dind /usr/local/bin/docker /usr/local/bin/
24+
25+
# install pip
26+
RUN apt-get update
27+
RUN apt-get install -y \
28+
python3-pip \
29+
shellcheck
30+
31+
# install python packages
32+
RUN python3 -m pip install \
33+
boto3 \
34+
black
35+
36+
# verify installs
2537
RUN terraform --version \
2638
&& aws --version \
2739
&& docker --version

.devcontainer/devcontainer.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
"features": {
55
"ghcr.io/devcontainers/features/docker-in-docker:2.0.1": {},
66
},
7+
"mounts": [
8+
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
9+
],
710
"containerEnv": {
8-
"TF_PLUGIN_CACHE_DIR": "/workspaces/terraform-aws-terraform-aws-teleport-cluster/.devcontainer/tmp/.terraform.d/"
11+
"TF_PLUGIN_CACHE_DIR": "${containerWorkspaceFolder}/.devcontainer/tmp/.terraform.d/"
912
},
1013
"customizations": {
1114
"vscode": {
@@ -17,22 +20,30 @@
1720
"editor.formatOnType": false,
1821
"editor.inlineSuggest.enabled": true,
1922
"terminal.integrated.shell.linux": "/bin/bash",
23+
"python.formatting.provider": "black",
24+
"python.defaultInterpreterPath": "/usr/bin/python3",
2025
"[markdown]": {
2126
"editor.rulers": [
2227
80
2328
]
24-
}
29+
},
30+
"[python]": {
31+
"editor.defaultFormatter": "ms-python.black-formatter"
32+
},
2533
},
2634
"extensions": [
2735
"darkriszty.markdown-table-prettify",
2836
"editorconfig.editorconfig",
2937
"github.copilot",
38+
"github.copilot-chat",
3039
"github.vscode-github-actions",
40+
"github.vscode-pull-request-github",
3141
"hashicorp.terraform",
3242
"ms-azuretools.vscode-docker",
43+
"ms-python.black-formatter",
3344
"timonwong.shellcheck",
3445
"VisualStudioExptTeam.vscodeintellicode",
3546
],
3647
}
3748
},
38-
}
49+
}

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ The development container is based on Ubuntu 22.04 (Jammy) and includes the
1414
following tools:
1515

1616
- AWS CLI
17-
- Node.js
18-
- TypeScript
17+
- Python v3.8
18+
- Python Packages: `boto3`, `black`
1919
- Docker CLI
20+
- Shellcheck
2021
- Terraform
21-
- Open Policy Agent
2222

2323
### Prerequisites
2424

@@ -34,8 +34,8 @@ following tools:
3434
1. Clone and open this repository:
3535

3636
```bash
37-
git clone https://github.com/sgtoj/terraform-aws-terraform-aws-teleport-cluster.git
38-
code terraform-aws-terraform-aws-teleport-cluster
37+
git clone https://github.com/sgtoj/terraform-aws-teleport-cluster.git
38+
code terraform-aws-teleport-cluster
3939
```
4040

4141
2. When prompted to "Reopen in Container", click "Reopen in Container". This

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Brian Ojeda
3+
Copyright (c) 2023 CruxStack LLC
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
PROJ_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
2+
3+
# allows args to pass to run-cmd example: make run-cmd echo "hello world"
4+
ifeq (run-cmd,$(firstword $(MAKECMDGOALS)))
5+
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
6+
$(eval $(RUN_ARGS):;@:)
7+
endif
8+
9+
all: deps build
10+
@exit 0
11+
12+
deps:
13+
@exit 0
14+
15+
build:
16+
@exit 0
17+
18+
clean:
19+
@find . -type d -name "dist" -exec rm -rf {} +
20+
@find . -type d -name ".terraform" -exec rm -rf {} +
21+
@find . -type d -name ".terraform.d" -exec rm -rf {} +
22+
@find . -type d -name ".tfstate" -exec rm -rf {} +
23+
@find . -type d -name ".tfstate.backup" -exec rm -rf {} +
24+
@touch .devcontainer/.terraform.d/.gitkeep || true

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This project is under development. See `dev` branch for latest activity.
1111

1212
```hcl
1313
module "teleport_cluster" {
14-
source = "sgtoj/teleport-cluster/aws"
14+
source = "cruxstack/teleport-cluster/aws"
1515
version = "x.x.x"
1616
1717
# TBD
@@ -29,15 +29,15 @@ In addition to the variables documented below, this module includes several
2929
other optional variables (e.g., `name`, `tags`, etc.) provided by the
3030
`cloudposse/label/null` module. Please refer to the [`cloudposse/label` documentation](https://registry.terraform.io/modules/cloudposse/label/null/latest) for more details on these variables.
3131

32-
| Name | Description | Type | Default | Required |
33-
|--------------------------------------|---------------------------------------------------------------------------------------------------------------|:------------------------------------:|:--------:|:--------:|
34-
| `placehold` | N/A | string | null | No |
32+
| Name | Description | Type | Default | Required |
33+
|-------------|-------------|:------:|:-------:|:--------:|
34+
| `placehold` | N/A | string | null | No |
3535

3636
## Outputs
3737

38-
| Name | Description |
39-
|-------------------------------------|-------------------------------------------------------------------------------|
40-
| `placehold` | N/A |
38+
| Name | Description |
39+
|-------------|-------------|
40+
| `placehold` | N/A |
4141

4242
## Contributing
4343

0 commit comments

Comments
 (0)