Skip to content

Commit 2eca939

Browse files
author
Matthew Weber
committed
Note folder and Docker assumptions
- Update readme with steps to help user have success with volume mounts - Note a quick test for Docker working - pre-commit fixups - end of file new lines - no comments in json files - shellcheck ignores on intentional syntax Signed-off-by: Matthew Weber <matthew.l.weber@gmail.com>
1 parent e1b1932 commit 2eca939

13 files changed

Lines changed: 59 additions & 62 deletions

File tree

.devcontainer/config/terraform.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ TF_CLI_ARGS_apply=""
2121

2222
# GCP Provider Configuration
2323
# GOOGLE_APPLICATION_CREDENTIALS=/home/vscode/.config/gcloud/application_default_credentials.json
24-
# CLOUDSDK_CORE_PROJECT=your-project-id
24+
# CLOUDSDK_CORE_PROJECT=your-project-id

.devcontainer/devcontainer.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121
"postStartCommand": "post-start",
2222
"remoteUser": "vscode",
2323

24-
// Configure tool-specific properties
2524
"customizations": {
2625
"vscode": {
27-
// Add the IDs of extensions you want installed when the container is created
2826
"extensions": [
2927
"hashicorp.terraform",
3028
"ms-azuretools.vscode-azureterraform",
@@ -46,7 +44,6 @@
4644
"ms-python.vscode-pylance"
4745
],
4846

49-
// Set *default* container specific settings.json values on container create
5047
"settings": {
5148
"terminal.integrated.defaultProfile.linux": "bash",
5249
"terminal.integrated.profiles.linux": {
@@ -63,7 +60,6 @@
6360
"files.insertFinalNewline": true,
6461
"files.trimFinalNewlines": true,
6562

66-
// Terraform settings
6763
"[terraform]": {
6864
"editor.defaultFormatter": "hashicorp.terraform",
6965
"editor.formatOnSave": true,
@@ -80,14 +76,12 @@
8076
},
8177
"terraform.experimentalFeatures.validateOnSave": true,
8278

83-
// YAML settings
8479
"[yaml]": {
8580
"editor.defaultFormatter": "redhat.vscode-yaml",
8681
"editor.formatOnSave": true,
8782
"editor.tabSize": 2
8883
},
8984

90-
// Markdown settings
9185
"[markdown]": {
9286
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
9387
"editor.formatOnSave": true
@@ -96,7 +90,6 @@
9690
}
9791
},
9892

99-
// Mount host volumes for credentials and caching
10093
"mounts": [
10194
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
10295
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind,consistency=cached",
@@ -105,10 +98,8 @@
10598
"source=terraform-cache,target=/home/vscode/.terraform.d/plugin-cache,type=volume"
10699
],
107100

108-
// Use 'forwardPorts' to make a list of ports inside the container available locally
109-
// "forwardPorts": [],
101+
"forwardPorts": [],
110102

111-
// Features to add to the dev container
112103
"features": {
113104
"ghcr.io/devcontainers/features/github-cli:1": {},
114105
"ghcr.io/devcontainers/features/git:1": {
@@ -117,7 +108,6 @@
117108
}
118109
},
119110

120-
// Environment variables
121111
"containerEnv": {
122112
"TF_PLUGIN_CACHE_DIR": "/home/vscode/.terraform.d/plugin-cache"
123113
}

.devcontainer/library-scripts/cloud-cli-tools.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ chown -R vscode:vscode /home/vscode/.aws
3030
chown -R vscode:vscode /home/vscode/.azure
3131
chown -R vscode:vscode /home/vscode/.config/gcloud
3232

33-
echo "Cloud CLI tools installation complete!"
33+
echo "Cloud CLI tools installation complete!"

.devcontainer/library-scripts/common-utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ mkdir -p /home/vscode/.ssh
3737
chown -R vscode:vscode /home/vscode/.ssh
3838
chmod 700 /home/vscode/.ssh
3939

40-
echo "Common utilities installation complete!"
40+
echo "Common utilities installation complete!"

.devcontainer/library-scripts/terraform-tools.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ if ! command -v go &> /dev/null; then
7777
GO_VERSION="1.20.5"
7878
curl -sSLo /tmp/go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz"
7979
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
80+
#shellcheck disable=SC2016
8081
echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/vscode/.bashrc
82+
#shellcheck disable=SC2016
8183
echo 'export PATH=$PATH:$HOME/go/bin' >> /home/vscode/.bashrc
8284
rm -f /tmp/go.tar.gz
8385
fi
@@ -100,7 +102,7 @@ sudo mv /tmp/infracost-linux-amd64 /usr/local/bin/infracost
100102
rm -f /tmp/infracost.tar.gz
101103

102104
echo "Installing Checkov v${CHECKOV_VERSION}..."
103-
pip3 install checkov==${CHECKOV_VERSION}
105+
pip3 install checkov=="${CHECKOV_VERSION}"
104106

105107
# Create .tflint.hcl config file
106108
mkdir -p /home/vscode/.tflint.d

.devcontainer/post-start.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ chmod +x /home/vscode/.devcontainer/scripts/*.sh
1717

1818
# Display welcome message
1919
clear
20-
printf "\e[0;32mTerraform Development Environment: $(basename $PWD)\e[0m\n\n"
20+
#shellcheck disable=SC2059
21+
printf "\e[0;32mTerraform Development Environment: $(basename "$PWD")\e[0m\n\n"
2122

2223
# Display installed tools and versions
2324
echo "=== Installed Tools ==="

.devcontainer/scripts/aws-auth.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fi
6868
if [ "$USE_SSO" = true ]; then
6969
echo "Authenticating with AWS SSO..."
7070
aws sso login
71-
71+
7272
# Verify authentication
7373
echo "Verifying authentication..."
7474
aws sts get-caller-identity
@@ -78,4 +78,4 @@ else
7878
aws sts get-caller-identity
7979
fi
8080

81-
echo "AWS authentication complete!"
81+
echo "AWS authentication complete!"

.devcontainer/scripts/azure-auth.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ if [ "$USE_SP" = true ]; then
8383
echo "Error: Service principal authentication requires --client-id and --client-secret"
8484
exit 1
8585
fi
86-
86+
8787
export ARM_CLIENT_ID="$CLIENT_ID"
8888
export ARM_CLIENT_SECRET="$CLIENT_SECRET"
89-
89+
9090
echo "Authenticating with Azure service principal..."
9191
az login --service-principal --username "$CLIENT_ID" --password "$CLIENT_SECRET" --tenant "$TENANT_ID"
9292
else
9393
echo "Authenticating with Azure interactive login..."
9494
az login
95-
95+
9696
# Set subscription if provided
9797
if [ -n "$SUBSCRIPTION_ID" ]; then
9898
az account set --subscription "$SUBSCRIPTION_ID"
@@ -103,4 +103,4 @@ fi
103103
echo "Verifying Azure authentication..."
104104
az account show
105105

106-
echo "Azure authentication complete!"
106+
echo "Azure authentication complete!"

.devcontainer/scripts/gcp-auth.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ if [ -n "$CREDENTIALS_FILE" ]; then
5959
echo "Error: Credentials file not found: $CREDENTIALS_FILE"
6060
exit 1
6161
fi
62-
62+
6363
export GOOGLE_APPLICATION_CREDENTIALS="$CREDENTIALS_FILE"
6464
echo "Using service account credentials: $CREDENTIALS_FILE"
65-
65+
6666
# Activate service account
6767
gcloud auth activate-service-account --key-file="$CREDENTIALS_FILE"
6868
else
@@ -74,4 +74,4 @@ fi
7474
echo "Verifying GCP authentication..."
7575
gcloud auth list
7676

77-
echo "GCP authentication complete!"
77+
echo "GCP authentication complete!"

.vscode/settings.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
// Editor settings
32
"editor.formatOnSave": true,
43
"editor.tabSize": 2,
54
"editor.insertSpaces": true,
@@ -8,8 +7,6 @@
87
"editor.codeActionsOnSave": {
98
"source.fixAll": "explicit"
109
},
11-
12-
// Files settings
1310
"files.trimTrailingWhitespace": true,
1411
"files.insertFinalNewline": true,
1512
"files.trimFinalNewlines": true,
@@ -22,8 +19,6 @@
2219
"**/.terraform": true,
2320
".terraform.lock.hcl": true
2421
},
25-
26-
// Terraform settings
2722
"[terraform]": {
2823
"editor.defaultFormatter": "hashicorp.terraform",
2924
"editor.formatOnSave": true,
@@ -39,34 +34,24 @@
3934
"args": []
4035
},
4136
"terraform.experimentalFeatures.validateOnSave": true,
42-
43-
// YAML settings
4437
"[yaml]": {
4538
"editor.defaultFormatter": "redhat.vscode-yaml",
4639
"editor.formatOnSave": true,
4740
"editor.tabSize": 2
4841
},
49-
50-
// Markdown settings
5142
"[markdown]": {
5243
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
5344
"editor.formatOnSave": true
5445
},
55-
56-
// Terminal settings
5746
"terminal.integrated.defaultProfile.linux": "bash",
5847
"terminal.integrated.profiles.linux": {
5948
"bash": {
6049
"path": "/bin/bash"
6150
}
6251
},
63-
64-
// Git settings
6552
"git.autofetch": true,
6653
"git.enableSmartCommit": true,
6754
"git.confirmSync": false,
68-
69-
// Spell checker settings
7055
"cSpell.enabled": true,
7156
"cSpell.words": [
7257
"azurerm",

0 commit comments

Comments
 (0)