Skip to content

Respect PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION in the dynamic provider loader - #3564

Open
DwaineSaunderson wants to merge 1 commit into
pulumi:mainfrom
DwaineSaunderson:fix/dynamic-respect-disable-plugin-acquisition
Open

Respect PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION in the dynamic provider loader#3564
DwaineSaunderson wants to merge 1 commit into
pulumi:mainfrom
DwaineSaunderson:fix/dynamic-respect-disable-plugin-acquisition

Conversation

@DwaineSaunderson

Copy link
Copy Markdown

Motivation

When the dynamic bridge loads a named Terraform provider and the requested
version is not present in the local plugin cache, getProviderServer downloads
it from the registry. That download performs terraform-svchost discovery,
which is a genuine outbound HTTP call.

This happened even when the user set PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION,
because that variable previously only gated Pulumi's own plugin-binary
acquisition in the engine — it never reached the dynamic bridge's Terraform
provider download path. In air-gapped or hermetic environments this is
surprising: setting the variable is expected to prevent automatic network
acquisition entirely.

Change

Honor PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION in getProviderServer. On a
cache miss with acquisition disabled, fail fast with an actionable error instead
of contacting the registry.

The variable is already inherited by provider plugins — the engine launches them
with os.Environ() (sdk/go/common/resource/plugin/plugin.go) — so no
additional forwarding is required; the guard reads it inside the plugin process
where the download occurs.

Behavior is unchanged when the variable is unset, and cached providers continue
to load regardless of the variable.

Testing

  • New unit test TestGetProviderServerDisablesAutomaticAcquisition forces a
    cache miss with the variable set and asserts an error is returned; the test
    provides no network access, so a regression would surface as a registry-reach
    attempt.
  • gofmt -s, go build ./dynamic/..., golangci-lint run ./dynamic/internal/shim/run/...
    (0 issues), and the dynamic unit tests all pass.

…ovider loader

On a plugin cache miss, the dynamic provider loader downloaded the requested
Terraform provider from the registry, which performs terraform-svchost discovery
(a genuine outbound HTTP call). This happened even when the user set
PULUMI_DISABLE_AUTOMATIC_PLUGIN_ACQUISITION, since that variable previously only
gated Pulumi's own plugin-binary acquisition in the engine.

Honor the variable in getProviderServer: on a cache miss with acquisition
disabled, fail fast with an actionable error instead of contacting the registry.
This matches user expectations in air-gapped and hermetic environments. The
variable is already inherited by provider plugins, which the engine launches with
os.Environ(), so no additional forwarding is required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant