Skip to content

Commit 167e371

Browse files
Update Terraform and IaC tools with Terratest integration
Upgrade development environment with latest IaC tooling: - Terraform to 1.12.1 - Terraform Docs to 0.20.0 - Checkov to 3.2.439 - Terragrunt to 0.50.1 - Other tools (TFSec, TFLint, Terrascan, Infracost) - Add Terratest 0.49.0 for infrastructure testing
1 parent ccfc400 commit 167e371

File tree

8 files changed

+105
-54
lines changed

8 files changed

+105
-54
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ ARG VARIANT="jammy"
22
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
33

44
# Set versions as arguments
5-
ARG TERRAFORM_VERSION="1.5.7"
6-
ARG TERRAFORM_DOCS_VERSION="0.16.0"
7-
ARG TFSEC_VERSION="1.28.0"
8-
ARG TERRASCAN_VERSION="1.18.3"
9-
ARG TFLINT_VERSION="0.47.0"
5+
ARG TERRAFORM_VERSION="1.12.1"
6+
ARG TERRAFORM_DOCS_VERSION="0.20.0"
7+
ARG TFSEC_VERSION="1.28.13"
8+
ARG TERRASCAN_VERSION="1.19.9"
9+
ARG TFLINT_VERSION="0.48.0"
1010
ARG TFLINT_AWS_RULESET_VERSION="0.23.1"
1111
ARG TFLINT_AZURE_RULESET_VERSION="0.23.0"
1212
ARG TFLINT_GCP_RULESET_VERSION="0.23.1"
13-
ARG TERRAGRUNT_VERSION="0.48.0"
14-
ARG INFRACOST_VERSION="0.10.28"
15-
ARG CHECKOV_VERSION="2.3.360"
13+
ARG TERRAGRUNT_VERSION="0.50.1"
14+
ARG TERRATEST_VERSION="0.49.0"
15+
ARG INFRACOST_VERSION="0.10.41"
16+
ARG CHECKOV_VERSION="3.2.439"
1617

1718
# Copy library scripts
1819
COPY library-scripts/*.sh /tmp/library-scripts/
@@ -36,6 +37,7 @@ RUN /tmp/library-scripts/terraform-tools.sh \
3637
"${TFLINT_AZURE_RULESET_VERSION}" \
3738
"${TFLINT_GCP_RULESET_VERSION}" \
3839
"${TERRAGRUNT_VERSION}" \
40+
"${TERRATEST_VERSION}" \
3941
"${INFRACOST_VERSION}" \
4042
"${CHECKOV_VERSION}"
4143

.devcontainer/devcontainer.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44
"dockerfile": "Dockerfile",
55
"args": {
66
"VARIANT": "ubuntu-22.04",
7-
"TERRAFORM_VERSION": "1.5.7",
8-
"TERRAFORM_DOCS_VERSION": "0.16.0",
9-
"TFSEC_VERSION": "1.28.0",
10-
"TERRASCAN_VERSION": "1.18.3",
11-
"TFLINT_VERSION": "0.47.0",
7+
"TERRAFORM_VERSION": "1.12.1",
8+
"TERRAFORM_DOCS_VERSION": "0.20.0",
9+
"TFSEC_VERSION": "1.28.13",
10+
"TERRASCAN_VERSION": "1.19.9",
11+
"TFLINT_VERSION": "0.48.0",
1212
"TFLINT_AWS_RULESET_VERSION": "0.23.1",
1313
"TFLINT_AZURE_RULESET_VERSION": "0.23.0",
1414
"TFLINT_GCP_RULESET_VERSION": "0.23.1",
15-
"TERRAGRUNT_VERSION": "0.48.0",
16-
"INFRACOST_VERSION": "0.10.28",
17-
"CHECKOV_VERSION": "2.3.360"
15+
"TERRAGRUNT_VERSION": "0.50.1",
16+
"TERRATEST_VERSION": "0.49.0",
17+
"INFRACOST_VERSION": "0.10.41",
18+
"CHECKOV_VERSION": "3.2.439"
1819
}
1920
},
2021
"postStartCommand": "post-start",
2122
"remoteUser": "vscode",
22-
23+
2324
// Configure tool-specific properties
2425
"customizations": {
2526
"vscode": {
@@ -44,7 +45,7 @@
4445
"ms-python.python",
4546
"ms-python.vscode-pylance"
4647
],
47-
48+
4849
// Set *default* container specific settings.json values on container create
4950
"settings": {
5051
"terminal.integrated.defaultProfile.linux": "bash",
@@ -61,7 +62,7 @@
6162
"files.trimTrailingWhitespace": true,
6263
"files.insertFinalNewline": true,
6364
"files.trimFinalNewlines": true,
64-
65+
6566
// Terraform settings
6667
"[terraform]": {
6768
"editor.defaultFormatter": "hashicorp.terraform",
@@ -78,14 +79,14 @@
7879
"args": []
7980
},
8081
"terraform.experimentalFeatures.validateOnSave": true,
81-
82+
8283
// YAML settings
8384
"[yaml]": {
8485
"editor.defaultFormatter": "redhat.vscode-yaml",
8586
"editor.formatOnSave": true,
8687
"editor.tabSize": 2
8788
},
88-
89+
8990
// Markdown settings
9091
"[markdown]": {
9192
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
@@ -94,7 +95,7 @@
9495
}
9596
}
9697
},
97-
98+
9899
// Mount host volumes for credentials and caching
99100
"mounts": [
100101
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
@@ -103,10 +104,10 @@
103104
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
104105
"source=terraform-cache,target=/home/vscode/.terraform.d/plugin-cache,type=volume"
105106
],
106-
107+
107108
// Use 'forwardPorts' to make a list of ports inside the container available locally
108109
// "forwardPorts": [],
109-
110+
110111
// Features to add to the dev container
111112
"features": {
112113
"ghcr.io/devcontainers/features/github-cli:1": {},
@@ -115,7 +116,7 @@
115116
"ppa": false
116117
}
117118
},
118-
119+
119120
// Environment variables
120121
"containerEnv": {
121122
"TF_PLUGIN_CACHE_DIR": "/home/vscode/.terraform.d/plugin-cache"

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

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ set -e
44
# This script installs Terraform and related tools
55

66
# Versions
7-
TERRAFORM_VERSION=${1:-"1.5.7"}
8-
TERRAFORM_DOCS_VERSION=${2:-"0.16.0"}
9-
TFSEC_VERSION=${3:-"1.28.0"}
10-
TERRASCAN_VERSION=${4:-"1.18.3"}
11-
TFLINT_VERSION=${5:-"0.47.0"}
7+
TERRAFORM_VERSION=${1:-"1.12.1"}
8+
TERRAFORM_DOCS_VERSION=${2:-"0.20.0"}
9+
TFSEC_VERSION=${3:-"1.28.13"}
10+
TERRASCAN_VERSION=${4:-"1.19.9"}
11+
TFLINT_VERSION=${5:-"0.48.0"}
1212
TFLINT_AWS_RULESET_VERSION=${6:-"0.23.1"}
1313
TFLINT_AZURE_RULESET_VERSION=${7:-"0.23.0"}
1414
TFLINT_GCP_RULESET_VERSION=${8:-"0.23.1"}
15-
TERRAGRUNT_VERSION=${9:-"0.48.0"}
16-
INFRACOST_VERSION=${10:-"0.10.28"}
17-
CHECKOV_VERSION=${11:-"2.3.360"}
15+
TERRAGRUNT_VERSION=${9:-"0.50.1"}
16+
TERRATEST_VERSION=${10:-"0.49.0"}
17+
INFRACOST_VERSION=${11:-"0.10.41"}
18+
CHECKOV_VERSION=${12:-"3.2.439"}
1819

1920
echo "Installing Terraform v${TERRAFORM_VERSION}..."
2021
curl -sSL -o /tmp/terraform.zip "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip"
@@ -66,6 +67,32 @@ curl -sSLo /tmp/terragrunt "https://github.com/gruntwork-io/terragrunt/releases/
6667
sudo mv /tmp/terragrunt /usr/local/bin/
6768
sudo chmod +x /usr/local/bin/terragrunt
6869

70+
echo "Installing Terratest v${TERRATEST_VERSION}..."
71+
# Terratest is a Go library, so we'll set an environment variable to track the version
72+
echo "export TERRATEST_VERSION=${TERRATEST_VERSION}" >> /home/vscode/.bashrc
73+
74+
# Install Go if not already installed
75+
if ! command -v go &> /dev/null; then
76+
echo "Installing Go (required for Terratest)..."
77+
GO_VERSION="1.20.5"
78+
curl -sSLo /tmp/go.tar.gz "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz"
79+
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
80+
echo 'export PATH=$PATH:/usr/local/go/bin' >> /home/vscode/.bashrc
81+
echo 'export PATH=$PATH:$HOME/go/bin' >> /home/vscode/.bashrc
82+
rm -f /tmp/go.tar.gz
83+
fi
84+
85+
# Create a simple wrapper script for terratest
86+
cat > /tmp/terratest << EOF
87+
#!/bin/bash
88+
echo "Terratest v${TERRATEST_VERSION}"
89+
echo "Terratest is a Go library for testing infrastructure code."
90+
echo "To use Terratest, add it to your Go project:"
91+
echo "go get github.com/gruntwork-io/terratest@v${TERRATEST_VERSION}"
92+
EOF
93+
sudo mv /tmp/terratest /usr/local/bin/
94+
sudo chmod +x /usr/local/bin/terratest
95+
6996
echo "Installing Infracost v${INFRACOST_VERSION}..."
7097
curl -sSLo /tmp/infracost.tar.gz "https://github.com/infracost/infracost/releases/download/v${INFRACOST_VERSION}/infracost-linux-amd64.tar.gz"
7198
tar -xzf /tmp/infracost.tar.gz -C /tmp
@@ -94,4 +121,4 @@ EOF
94121
# Set ownership for the config file
95122
chown -R vscode:vscode /home/vscode/.tflint.d
96123

97-
echo "Terraform tools installation complete!"
124+
echo "Terraform tools installation complete!"

.devcontainer/post-start.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ echo "TFLint: $(tflint --version)"
3030
echo "TFSec: $(tfsec --version)"
3131
echo "Terrascan: $(terrascan version)"
3232
echo "Terragrunt: $(terragrunt --version)"
33+
echo "Terratest: v$(terratest | head -n 1 | cut -d 'v' -f 2)"
3334
echo "Checkov: $(checkov --version)"
3435
echo "Pre-commit: $(pre-commit --version)"
3536
echo ""

.vscode/settings.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"editor.rulers": [120],
77
"editor.renderWhitespace": "boundary",
88
"editor.codeActionsOnSave": {
9-
"source.fixAll": true
9+
"source.fixAll": "explicit"
1010
},
11-
11+
1212
// Files settings
1313
"files.trimTrailingWhitespace": true,
1414
"files.insertFinalNewline": true,
@@ -22,7 +22,7 @@
2222
"**/.terraform": true,
2323
".terraform.lock.hcl": true
2424
},
25-
25+
2626
// Terraform settings
2727
"[terraform]": {
2828
"editor.defaultFormatter": "hashicorp.terraform",
@@ -39,33 +39,33 @@
3939
"args": []
4040
},
4141
"terraform.experimentalFeatures.validateOnSave": true,
42-
42+
4343
// YAML settings
4444
"[yaml]": {
4545
"editor.defaultFormatter": "redhat.vscode-yaml",
4646
"editor.formatOnSave": true,
4747
"editor.tabSize": 2
4848
},
49-
49+
5050
// Markdown settings
5151
"[markdown]": {
5252
"editor.defaultFormatter": "yzhang.markdown-all-in-one",
5353
"editor.formatOnSave": true
5454
},
55-
55+
5656
// Terminal settings
5757
"terminal.integrated.defaultProfile.linux": "bash",
5858
"terminal.integrated.profiles.linux": {
5959
"bash": {
6060
"path": "/bin/bash"
6161
}
6262
},
63-
63+
6464
// Git settings
6565
"git.autofetch": true,
6666
"git.enableSmartCommit": true,
6767
"git.confirmSync": false,
68-
68+
6969
// Spell checker settings
7070
"cSpell.enabled": true,
7171
"cSpell.words": [

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ All notable changes to the Terraform Development Environment will be documented
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.3] - 2025-06-11
9+
10+
### Added
11+
12+
- Added terratest v0.49.0 for infrastructure testing
13+
14+
### Changed
15+
16+
- Updated tool versions:
17+
- Terraform CLI from v1.5.7 to v1.12.1
18+
- AWS CLI from v2 to v2.27.26
19+
- terraform-docs from v0.16.0 to v0.20.0
20+
- tflint from v0.47.0 to v0.48.0
21+
- tfsec from v1.28.0 to v1.28.13
22+
- terrascan from v1.18.3 to v1.19.9
23+
- terragrunt from v0.48.0 to v0.50.1
24+
- infracost from v0.10.28 to v0.10.41
25+
- checkov from v2.3.360 to v3.2.439
26+
827
## [1.2.2] - 2025-06-10
928

1029
### Added

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,18 @@ A comprehensive VS Code Dev Container with tools to help you build and manage in
3636

3737
| Tool | Version | Description |
3838
|------|---------|-------------|
39-
| Terraform | 1.5.7 | Infrastructure as Code tool |
40-
| AWS CLI | v2 | Command line interface for AWS |
39+
| Terraform | 1.12.1 | Infrastructure as Code tool |
40+
| AWS CLI | 2.27.26 | Command line interface for AWS |
4141
| Azure CLI | Latest | Command line interface for Azure |
4242
| Google Cloud SDK | Latest | Command line interface for GCP |
43-
| terraform-docs | 0.16.0 | Documentation generator for Terraform modules |
44-
| tflint | 0.47.0 | Terraform linter |
45-
| tfsec | 1.28.0 | Security scanner for Terraform code |
46-
| terrascan | 1.18.3 | Detect compliance and security violations |
47-
| terragrunt | 0.48.0 | Thin wrapper for Terraform that provides extra tools |
48-
| infracost | 0.10.28 | Cloud cost estimates for Terraform |
49-
| checkov | 2.3.360 | Static code analysis tool for IaC |
43+
| terraform-docs | 0.20.0 | Documentation generator for Terraform modules |
44+
| tflint | 0.48.0 | Terraform linter |
45+
| tfsec | 1.28.13 | Security scanner for Terraform code |
46+
| terrascan | 1.19.9 | Detect compliance and security violations |
47+
| terragrunt | 0.50.1 | Thin wrapper for Terraform that provides extra tools |
48+
| terratest | v0.49.0 | Testing utility for infrastructure code |
49+
| infracost | 0.10.41 | Cloud cost estimates for Terraform |
50+
| checkov | 3.2.439 | Static code analysis tool for IaC |
5051
| pre-commit | Latest | Framework for managing git pre-commit hooks |
5152

5253
## Authentication

tools.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GITIGNORE=macos,windows,linux,visualstudiocode,python,node,terraform
22
TFLINT_AWS_RULESET_VERSION=0.21.1
3-
TERRAFORM_DOCS_VERSION=0.16.0
4-
TERRASCAN_VERSION=1.17.1
5-
TFSEC_VERSION=1.28.1
3+
TERRAFORM_DOCS_VERSION=0.20.0
4+
TERRASCAN_VERSION=1.19.9
5+
TFSEC_VERSION=1.28.13

0 commit comments

Comments
 (0)