Skip to content

Commit

Permalink
Terraform: Add proxy setting (#435) (#451)
Browse files Browse the repository at this point in the history
* 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 <skhandale@microsoft.com>

* Add feature option

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* 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 <samruddhikhandale@github.com>

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
  • Loading branch information
3 people authored Mar 6, 2023
1 parent 3cc059e commit 3e6ee96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/terraform/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "terraform",
"version": "1.2.0",
"version": "1.3.0",
"name": "Terraform, tflint, and TFGrunt",
"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.",
Expand Down Expand Up @@ -47,6 +47,11 @@
"type": "boolean",
"default": false,
"description": "Install terraform-docs, a utility to generate documentation from Terraform modules"
},
"httpProxy": {
"type": "string",
"default": "",
"description": "Connect to a keyserver using a proxy by configuring this option"
}
},
"customizations": {
Expand Down
8 changes: 6 additions & 2 deletions src/terraform/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ TERRAFORM_DOCS_SHA256="${TERRAFORM_DOCS_SHA256:-"automatic"}"

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

architecture="$(uname -m)"
case ${architecture} in
Expand All @@ -53,6 +54,9 @@ receive_gpg_keys() {
if [ ! -z "$2" ]; then
keyring_args="--no-default-keyring --keyring $2"
fi
if [ ! -z "${KEYSERVER_PROXY}" ]; then
keyring_args="${keyring_args} --keyserver-options http-proxy=${KEYSERVER_PROXY}"
fi

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

0 comments on commit 3e6ee96

Please sign in to comment.