Pin TF_PLUGIN_CACHE_DIR to a predictable path on terraformer (#274)#275
Merged
Conversation
Configure a shared Terraform provider plugin cache at a fixed path so provider binaries are stored once under a deterministic prefix instead of per-workdir .terraform/providers paths that vary run to run. This gives AWS Inspector EC2 scanning a single PREFIX anchor to suppress the provider-binary noise while still scanning the host's OS packages. New profile::terraformer::plugin_cache: - creates /var/cache/terraform/plugins (terraform won't create it itself) - exports TF_PLUGIN_CACHE_DIR via /etc/profile.d for login shells - makes the cache writable by the admin group (setgid + default POSIX ACL) so non-privileged admin users sharing the box can populate it Mirrored across the top-level, development, and sandbox module copies. Pairs with infrahouse/terraform-aws-terraformer#34. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
infrahouse8
approved these changes
Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #274.
Why
The terraformer host runs
terraformacross many working directories. By defaultterraform initdownloads provider binaries into each workdir's.terraform/providers/..., so the real Go binaries land at per-workdir paths that vary run to run.We want AWS Inspector EC2 scanning enabled on this host (to catch real OS-package CVEs) while suppressing only the noise from Terraform provider binaries. Inspector suppression filters match
file_pathwithEQUALS/PREFIX/NOT_EQUALSonly — no glob, noCONTAINS— so the provider binaries must sit under a single, stable prefix to be targetable.What
New
profile::terraformer::plugin_cache, included fromprofile::terraformer:/var/cache/terraform/plugins(Terraform won't create the cache dir itself).TF_PLUGIN_CACHE_DIRvia/etc/profile.d/terraform-plugin-cache.shfor login shells.admingroup —setgid+ a default POSIX ACL (d:g:admin:rwx), since terraform is run by non-privileged users in theadmingroup and setgid alone loses group-write on nested provider dirs under the default umask. Installs theaclpackage; thesetfaclexec is idempotent via agetfaclguard.Mirrored across the top-level, development, and sandbox module copies (matching the prior terraformer change in #229).
Verified on a live terraformer
TF_PLUGIN_CACHE_DIR=/var/cache/terraform/pluginsin a login shell./var/cache/terraform/pluginsisdrwxrwsr-x+groupadmin; nested provider dirs inherit setgid + the ACL.terraform init, real provider binaries live once under/var/cache/terraform/plugins/registry.terraform.io/...and every.terraform/providers/...entry in the workdir is a symlink back into the cache.Companion
Pairs with infrahouse/terraform-aws-terraformer#34 (make the Inspector EC2 exclusion opt-in, then suppress the provider-binary noise via this predictable path).
🤖 Generated with Claude Code