Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
devcontainer-features
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eazydevelop-devcontainer-temp
devcontainer-features
Commits
84f3e62d
Unverified
Commit
84f3e62d
authored
Dec 13, 2022
by
Pierre-Emmanuel Mercier
Committed by
GitHub
Dec 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add TFSec and Terraform Docs to Terraform features (#327)
* Add TFSec and Terraform Docs * PR Review * code review
parent
7b009e66
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
2 deletions
+104
-2
devcontainer-feature.json
src/terraform/devcontainer-feature.json
+12
-2
install.sh
src/terraform/install.sh
+44
-0
install_terraform_docs.sh
test/terraform/install_terraform_docs.sh
+15
-0
install_tfsec.sh
test/terraform/install_tfsec.sh
+15
-0
scenarios.json
test/terraform/scenarios.json
+18
-0
No files found.
src/terraform/devcontainer-feature.json
View file @
84f3e62d
{
{
"id"
:
"terraform"
,
"id"
:
"terraform"
,
"version"
:
"1.
0.7
"
,
"version"
:
"1.
1.0
"
,
"name"
:
"Terraform, tflint, and TFGrunt"
,
"name"
:
"Terraform, tflint, and TFGrunt"
,
"documentationURL"
:
"https://github.com/devcontainers/features/tree/main/src/terraform"
,
"documentationURL"
:
"https://github.com/devcontainers/features/tree/main/src/terraform"
,
"description"
:
"Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies."
,
"description"
:
"Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies."
,
...
@@ -32,6 +32,16 @@
...
@@ -32,6 +32,16 @@
],
],
"default"
:
"latest"
,
"default"
:
"latest"
,
"description"
:
"Terragrunt version"
"description"
:
"Terragrunt version"
},
"installTFsec"
:
{
"type"
:
"boolean"
,
"default"
:
false
,
"description"
:
"Install tfsec, a tool to spot potential misconfigurations for your terraform code"
},
"installTerraformDocs"
:
{
"type"
:
"boolean"
,
"default"
:
false
,
"description"
:
"Install terraform-docs, a utility to generate documentation from Terraform modules"
}
}
},
},
"customizations"
:
{
"customizations"
:
{
...
...
src/terraform/install.sh
View file @
84f3e62d
...
@@ -15,10 +15,14 @@ rm -rf /var/lib/apt/lists/*
...
@@ -15,10 +15,14 @@ rm -rf /var/lib/apt/lists/*
TERRAFORM_VERSION
=
"
${
VERSION
:-
"latest"
}
"
TERRAFORM_VERSION
=
"
${
VERSION
:-
"latest"
}
"
TFLINT_VERSION
=
"
${
TFLINT
:-
"latest"
}
"
TFLINT_VERSION
=
"
${
TFLINT
:-
"latest"
}
"
TERRAGRUNT_VERSION
=
"
${
TERRAGRUNT
:-
"latest"
}
"
TERRAGRUNT_VERSION
=
"
${
TERRAGRUNT
:-
"latest"
}
"
INSTALL_TFSEC
=
${
INSTALLTFSEC
:-
false
}
INSTALL_TERRAFORM_DOCS
=
${
INSTALLTERRAFORMDOCS
:-
false
}
TERRAFORM_SHA256
=
"
${
TERRAFORM_SHA256
:-
"automatic"
}
"
TERRAFORM_SHA256
=
"
${
TERRAFORM_SHA256
:-
"automatic"
}
"
TFLINT_SHA256
=
"
${
TFLINT_SHA256
:-
"automatic"
}
"
TFLINT_SHA256
=
"
${
TFLINT_SHA256
:-
"automatic"
}
"
TERRAGRUNT_SHA256
=
"
${
TERRAGRUNT_SHA256
:-
"automatic"
}
"
TERRAGRUNT_SHA256
=
"
${
TERRAGRUNT_SHA256
:-
"automatic"
}
"
TFSEC_SHA256
=
"
${
TFSEC_SHA256
:-
"automatic"
}
"
TERRAFORM_DOCS_SHA256
=
"
${
TERRAFORM_DOCS_SHA256
:-
"automatic"
}
"
TERRAFORM_GPG_KEY
=
"72D7468F"
TERRAFORM_GPG_KEY
=
"72D7468F"
TFLINT_GPG_KEY_URI
=
"https://raw.githubusercontent.com/terraform-linters/tflint/master/8CE69160EB3F2FE9.key"
TFLINT_GPG_KEY_URI
=
"https://raw.githubusercontent.com/terraform-linters/tflint/master/8CE69160EB3F2FE9.key"
...
@@ -212,6 +216,46 @@ if [ "${TERRAGRUNT_VERSION}" != "none" ]; then
...
@@ -212,6 +216,46 @@ if [ "${TERRAGRUNT_VERSION}" != "none" ]; then
mv
-f
/tmp/tf-downloads/
${
terragrunt_filename
}
/usr/local/bin/terragrunt
mv
-f
/tmp/tf-downloads/
${
terragrunt_filename
}
/usr/local/bin/terragrunt
fi
fi
if
[
"
${
INSTALL_TFSEC
}
"
=
"true"
]
;
then
TFSEC_VERSION
=
"latest"
find_version_from_git_tags TFSEC_VERSION
'https://github.com/aquasecurity/tfsec'
tfsec_filename
=
"tfsec_
${
TFSEC_VERSION
}
_linux_
${
architecture
}
.tar.gz"
echo
"(*) Downloading TFSec...
${
tfsec_filename
}
"
curl
-sSL
-o
/tmp/tf-downloads/
${
tfsec_filename
}
https://github.com/aquasecurity/tfsec/releases/download/v
${
TFSEC_VERSION
}
/
${
tfsec_filename
}
if
[
"
${
TFSEC_SHA256
}
"
!=
"dev-mode"
]
;
then
if
[
"
${
TFSEC_SHA256
}
"
=
"automatic"
]
;
then
curl
-sSL
-o
tfsec_SHA256SUMS https://github.com/aquasecurity/tfsec/releases/download/v
${
TFSEC_VERSION
}
/tfsec_
${
TFSEC_VERSION
}
_checksums.txt
else
echo
"
${
TFSEC_SHA256
}
*
${
tfsec_filename
}
"
>
tfsec_SHA256SUMS
fi
sha256sum
--ignore-missing
-c
tfsec_SHA256SUMS
fi
mkdir
-p
/tmp/tf-downloads/tfsec
tar
-xzf
/tmp/tf-downloads/
${
tfsec_filename
}
-C
/tmp/tf-downloads/tfsec
chmod
a+x /tmp/tf-downloads/tfsec/tfsec
mv
-f
/tmp/tf-downloads/tfsec/tfsec /usr/local/bin/tfsec
fi
if
[
"
${
INSTALL_TERRAFORM_DOCS
}
"
=
"true"
]
;
then
TERRAFORM_DOCS_VERSION
=
"latest"
find_version_from_git_tags TERRAFORM_DOCS_VERSION
'https://github.com/terraform-docs/terraform-docs'
tfdocs_filename
=
"terraform-docs-v
${
TERRAFORM_DOCS_VERSION
}
-linux-
${
architecture
}
.tar.gz"
echo
"(*) Downloading Terraform docs...
${
tfdocs_filename
}
"
curl
-sSL
-o
/tmp/tf-downloads/
${
tfdocs_filename
}
https://github.com/terraform-docs/terraform-docs/releases/download/v
${
TERRAFORM_DOCS_VERSION
}
/
${
tfdocs_filename
}
if
[
"
${
TERRAFORM_DOCS_SHA256
}
"
!=
"dev-mode"
]
;
then
if
[
"
${
TERRAFORM_DOCS_SHA256
}
"
=
"automatic"
]
;
then
curl
-sSL
-o
tfdocs_SHA256SUMS https://github.com/terraform-docs/terraform-docs/releases/download/v
${
TERRAFORM_DOCS_VERSION
}
/terraform-docs-v
${
TERRAFORM_DOCS_VERSION
}
.sha256sum
else
echo
"
${
TERRAFORM_DOCS_SHA256
}
*
${
tfsec_filename
}
"
>
tfdocs_SHA256SUMS
fi
sha256sum
--ignore-missing
-c
tfdocs_SHA256SUMS
fi
mkdir
-p
/tmp/tf-downloads/tfdocs
tar
-xzf
/tmp/tf-downloads/
${
tfdocs_filename
}
-C
/tmp/tf-downloads/tfdocs
chmod
a+x /tmp/tf-downloads/tfdocs/terraform-docs
mv
-f
/tmp/tf-downloads/tfdocs/terraform-docs /usr/local/bin/terraform-docs
fi
rm
-rf
/tmp/tf-downloads
${
GNUPGHOME
}
rm
-rf
/tmp/tf-downloads
${
GNUPGHOME
}
# Clean up
# Clean up
...
...
test/terraform/install_terraform_docs.sh
0 → 100644
View file @
84f3e62d
#!/bin/bash
set
-e
# Import test library for `check` command
source
dev-container-features-test-lib
# Check to make sure the user is vscode
check
"user is vscode"
whoami
|
grep
vscode
# Terraform Docs specific tests
check
"tfsec"
terraform-docs
--version
# Report result
reportResults
\ No newline at end of file
test/terraform/install_tfsec.sh
0 → 100644
View file @
84f3e62d
#!/bin/bash
set
-e
# Import test library for `check` command
source
dev-container-features-test-lib
# Check to make sure the user is vscode
check
"user is vscode"
whoami
|
grep
vscode
# TFSec specific tests
check
"tfsec"
tfsec
--version
# Report result
reportResults
\ No newline at end of file
test/terraform/scenarios.json
0 → 100644
View file @
84f3e62d
{
"install_tfsec"
:
{
"image"
:
"mcr.microsoft.com/devcontainers/base:jammy"
,
"features"
:
{
"terraform"
:
{
"installTFsec"
:
true
}
}
},
"install_terraform_docs"
:
{
"image"
:
"mcr.microsoft.com/devcontainers/base:jammy"
,
"features"
:
{
"terraform"
:
{
"installTerraformDocs"
:
true
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment