Visitar URL original
Warn about invalid cloud credentials in interactive `pulumi new` by VenelinMartinov · Pull Request #24456 · pulumi/pulumi · GitHub
Skip to content

Warn about invalid cloud credentials in interactive pulumi new - #24456

Merged
VenelinMartinov merged 19 commits into
masterfrom
new-aws-credentials-preflight
Sep 9, 2026
Merged

VenelinMartinov merged 19 commits into
masterfrom
new-aws-credentials-preflight

Conversation

@VenelinMartinov

@VenelinMartinov VenelinMartinov commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

After creating a project in interactive pulumi new, run a best-effort credentials preflight (CheckConfig + Configure with the stack's provider config) against every required provider whose schema sets the new validateCredentialsOnNew field, and print an advisory warning linking to the schema's configurationDocsUrl when credentials are missing or invalid. The CLI carries no provider-specific knowledge; providers opt in via their schema (pulumi-aws: pulumi/pulumi-aws#6638).

The command never fails because of the check. It is bounded by a 15s timeout and skipped for --generate-only, --offline, non-interactive runs, or when PULUMI_SKIP_NEW_CREDENTIALS_CHECK=true is set.

🤖 Generated with Claude Code

Comment thread pkg/cmd/pulumi/project/newcmd/new.go Resolved
@VenelinMartinov
VenelinMartinov force-pushed the new-aws-credentials-preflight branch 3 times, most recently from 70c1110 to 109c858 Compare August 27, 2026 12:43
@VenelinMartinov
VenelinMartinov marked this pull request as ready for review August 27, 2026 15:19
@VenelinMartinov
VenelinMartinov requested a review from a team as a code owner August 27, 2026 15:19
@VenelinMartinov
VenelinMartinov requested a review from a team August 27, 2026 17:34
@VenelinMartinov VenelinMartinov changed the title Warn about invalid AWS credentials in interactive pulumi new Warn about invalid cloud credentials in interactive pulumi new Aug 27, 2026
@VenelinMartinov
VenelinMartinov marked this pull request as draft August 28, 2026 11:30
@VenelinMartinov
VenelinMartinov marked this pull request as ready for review August 31, 2026 09:35
@VenelinMartinov
VenelinMartinov force-pushed the new-aws-credentials-preflight branch from e9330bd to fc9c7d2 Compare September 8, 2026 11:42
@VenelinMartinov
VenelinMartinov changed the base branch from master to fraser/provconf September 8, 2026 11:42
Base automatically changed from fraser/provconf to master September 9, 2026 15:15
VenelinMartinov and others added 13 commits September 9, 2026 19:00
After creating a project from an AWS template in interactive mode, run a
best-effort CheckConfig against the AWS provider and print an advisory
warning (with a pointer to the credentials docs) when credentials are
missing or invalid. Never fails the command; skippable via
PULUMI_SKIP_NEW_CREDENTIALS_CHECK=true.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The preflight now calls Configure after a clean CheckConfig and surfaces
its error, which is where azure-native (and assume-role style AWS
failures) actually validate credentials. Plugin-backed providers run
Configure asynchronously, so add an optional plugin.ConfigureAwaiter that
callers can use to wait for the result, forwarded through the host's
provider wrapper.

Generalise the AWS-only check into a small table of cloud providers and
add azure-native to it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ages and add GCP

The preflight previously chose the provider by scanning the template's
config keys for an aws:/azure-native: namespace prefix. Instead, reuse
the packages the language host reports via GetRequiredPackages (already
gathered by InstallRequiredPackages) so the check is keyed off the
program's actual provider dependency and loads the exact plugin version
it depends on. Parameterized packages are skipped since their plugin
name is the base plugin rather than the cloud provider.

Also add the gcp provider to the set of preflighted providers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Run the preflight on its own deadline-bound plugin context so plugin
launch, CheckConfig and Configure share one timeout and no goroutine or
channel plumbing is needed. Move the wiring out of runNew behind
preflightCloudCredentials, collapse the two warning blocks into one, and
table-drive the tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the hardcoded aws/azure-native/gcp table with two new package
schema fields, validateCredentialsOnNew and configurationDocsUrl, and
preflight every required package that opts in.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Print the success banner unconditionally and drop the warned bool that was threaded
back into runNew; split the probe from the warning rendering; pass CheckConfig's
properties straight to Configure instead of falling back to the raw inputs; fold the
pass-through parameters into a credentialsPreflight struct.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Configure now runs synchronously in the plugin layer, so the preflight no
longer needs the optional ConfigureAwaiter interface to wait for its result.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@VenelinMartinov
VenelinMartinov force-pushed the new-aws-credentials-preflight branch from fc9c7d2 to 8ece75d Compare September 9, 2026 16:02
Comment on lines +57 to +64
"configurationDocsUrl": {
"description": "The URL of the provider's installation and configuration documentation, if any.",
"type": "string"
},
"validateCredentialsOnNew": {
"description": "Indicates that `pulumi new` may configure the provider after creating a project in order to validate the user's credentials.",
"type": "boolean"
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it makes sense to just merge these together. If configurationDocsUrl is set to non-empty, then do credential validation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially had it like that but it seemed a bit implicit and non-obvious. An unknowing provider author could accidentally enable it thinking it's an informational field like name, provider url etc

VenelinMartinov and others added 2 commits September 9, 2026 19:26
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
VenelinMartinov and others added 2 commits September 9, 2026 19:40
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@VenelinMartinov
VenelinMartinov added this pull request to the merge queue Sep 9, 2026
Merged via the queue into master with commit 098d56d Sep 9, 2026
189 of 192 checks passed
@VenelinMartinov
VenelinMartinov deleted the new-aws-credentials-preflight branch September 9, 2026 18:48
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.

2 participants