From daaedf2d99ee56a1873aeb6da4af94eb06fc7d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Brauer?= Date: Tue, 13 Aug 2024 01:20:35 +0200 Subject: [PATCH] feat(devcontainer): configure provider override in post attach command (#1481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(devcontainer): update terraform version * refactor(devcontainer): move post attach command to separate script * feat(devcontainer): configure provider override in post attach command --------- Signed-off-by: Björn Brauer --- .devcontainer/devcontainer.json | 5 ++--- .devcontainer/post-attach.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 .devcontainer/post-attach.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 60991a6f..fc68151f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,12 +8,11 @@ // Features to add to the dev container. More info: https://containers.dev/features. "features": { "ghcr.io/devcontainers/features/terraform:1": { - "version": "1.7.2" + "version": "1.9.4" } }, - // Workaround for https://github.com/orgs/community/discussions/75161 - "postAttachCommand": "unset GIT_COMMITTER_NAME; unset GIT_COMMITTER_EMAIL;", + "postAttachCommand": ["bash", "./.devcontainer/post-attach.sh"], // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh new file mode 100644 index 00000000..7564b7fc --- /dev/null +++ b/.devcontainer/post-attach.sh @@ -0,0 +1,19 @@ +#!/usr/bin/bash + +# Workaround for https://github.com/orgs/community/discussions/75161 +unset GIT_COMMITTER_NAME +unset GIT_COMMITTER_EMAIL + +cat < ~/.terraformrc +provider_installation { + + dev_overrides { + "bpg/proxmox" = "${GOPATH}/bin/" + } + + # For all other providers, install them directly from their origin provider + # registries as normal. If you omit this, Terraform will _only_ use + # the dev_overrides block, and so no other providers will be available. + direct {} +} +EOF