Skip to content

Commit 3e6ee96

Browse files
Terraform: Add proxy setting (#435) (#451)
* Terraform: Add proxy setting (#435) * Terraform: Remove unused variable GPG_OPTS (#435) * Terraform: Increment minor version (#435) * Update src/terraform/install.sh Co-authored-by: Samruddhi Khandale <[email protected]> * Add feature option * Update src/terraform/devcontainer-feature.json Co-authored-by: Samruddhi Khandale <[email protected]> * Update src/terraform/devcontainer-feature.json Co-authored-by: Samruddhi Khandale <[email protected]> * Update src/terraform/devcontainer-feature.json Co-authored-by: Samruddhi Khandale <[email protected]> * Terraform: Change environment variables to upper case (#435) * Terraform: Use HTTP_PROXY as the default for connecting to keyservers (#435) * Update src/terraform/install.sh Co-authored-by: Samruddhi Khandale <[email protected]> --------- Co-authored-by: Samruddhi Khandale <[email protected]> Co-authored-by: Samruddhi Khandale <[email protected]>
1 parent 3cc059e commit 3e6ee96

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/terraform/devcontainer-feature.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "terraform",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"name": "Terraform, tflint, and TFGrunt",
55
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/terraform",
66
"description": "Installs the Terraform CLI and optionally TFLint and Terragrunt. Auto-detects latest version and installs needed dependencies.",
@@ -47,6 +47,11 @@
4747
"type": "boolean",
4848
"default": false,
4949
"description": "Install terraform-docs, a utility to generate documentation from Terraform modules"
50+
},
51+
"httpProxy": {
52+
"type": "string",
53+
"default": "",
54+
"description": "Connect to a keyserver using a proxy by configuring this option"
5055
}
5156
},
5257
"customizations": {

src/terraform/install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ TERRAFORM_DOCS_SHA256="${TERRAFORM_DOCS_SHA256:-"automatic"}"
2828

2929
TERRAFORM_GPG_KEY="72D7468F"
3030
TFLINT_GPG_KEY_URI="https://raw.githubusercontent.com/terraform-linters/tflint/master/8CE69160EB3F2FE9.key"
31-
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com
31+
GPG_KEY_SERVERS="keyserver hkps://keyserver.ubuntu.com
3232
keyserver hkps://keys.openpgp.org
33-
keyserver hkp://keyserver.pgp.com"
33+
keyserver hkps://keyserver.pgp.com"
34+
KEYSERVER_PROXY="${HTTPPROXY:-"${HTTP_PROXY:-""}"}"
3435

3536
architecture="$(uname -m)"
3637
case ${architecture} in
@@ -53,6 +54,9 @@ receive_gpg_keys() {
5354
if [ ! -z "$2" ]; then
5455
keyring_args="--no-default-keyring --keyring $2"
5556
fi
57+
if [ ! -z "${KEYSERVER_PROXY}" ]; then
58+
keyring_args="${keyring_args} --keyserver-options http-proxy=${KEYSERVER_PROXY}"
59+
fi
5660

5761
# Use a temporary location for gpg keys to avoid polluting image
5862
export GNUPGHOME="/tmp/tmp-gnupg"

0 commit comments

Comments
 (0)