Skip to content

Optimize AWS provider startup metadata checks#6365

Merged
corymhall merged 1 commit into
masterfrom
aws-pf-schema-metadata-startup
Jun 16, 2026
Merged

Optimize AWS provider startup metadata checks#6365
corymhall merged 1 commit into
masterfrom
aws-pf-schema-metadata-startup

Conversation

@corymhall

@corymhall corymhall commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

This PR moves a few AWS-specific provider startup decisions out of live Terraform schema inspection and into generated metadata.

The provider currently needs resource-level facts for:

  • generic name autonaming
  • region pre-check callback installation
  • SDKv2 tags / tags_all pre-check handling

For AWS, asking live schemas for those facts during runtime provider construction can trigger expensive SDKv2 SchemaFunc paths and large allocations. This PR adds aws-resource-metadata.json, generated during tfgen, and uses that embedded metadata at runtime instead.

Details

  • Adds generated AWS resource metadata for hasInputName, hasUsableRegion, and hasTagsAndTagsAll.
  • Updates ProviderFromMeta to use embedded metadata for runtime callback/autonaming decisions.
  • Adds a tfgen-only provider construction path that computes those facts from live schemas and refreshes the generated metadata file during schema generation.
  • Keeps SDKv2 tag handling explicitly gated in resources.go; Plugin Framework resources continue to rely on upstream behavior.
  • Adds parity tests that compare embedded metadata against live schema facts.
  • Adds behavior tests for region callback installation, SDKv2-only tags callback handling, and generic autonaming behavior.

Refs #6357

Notes

aws-resource-metadata.json intentionally omits resources where all generated facts are false. At runtime, a missing key means zero-value metadata. Provider upgrades should refresh this file through schema generation; the parity tests are intended to catch stale metadata.

Testing

  • cd provider && go test -v -short .
  • cd provider && go test -v -short -run 'Test(HasNonComputedTagsAndTagsAllOptimized|HasOptionalOrRequiredNamePropertyOptimized|HasUsableRegionMetadata|RegionPreCheckCallbackInstalledFromMetadata|TagsPreCheckCallbackAppliesOnlyToSDKV2Resources|SetAutonamingAddsGenericNameWithoutOverwritingFields|CustomAutoNameTransforms)$' .
  • bin/pulumi-tfgen-aws schema --out /private/tmp/pulumi-aws-schema-metadata --skip-docs --skip-examples
  • gofmt -l provider/resources.go provider/resources_test.go provider/region.go provider/tags.go provider/cmd/pulumi-tfgen-aws/main.go
  • git diff --check

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

@codecov

codecov Bot commented May 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 15.98%. Comparing base (dc5ba2b) to head (b8f39a6).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6365   +/-   ##
=======================================
  Coverage   15.98%   15.98%           
=======================================
  Files         374      374           
  Lines       91298    91298           
=======================================
  Hits        14596    14596           
  Misses      76682    76682           
  Partials       20       20           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@corymhall
corymhall force-pushed the aws-pf-schema-metadata-startup branch 2 times, most recently from 6d82de5 to 02801be Compare June 5, 2026 14:21
@corymhall
corymhall marked this pull request as ready for review June 5, 2026 16:39

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No actionable issues found.

Reviewed by Internal Trusted PR Reviewer

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add pulumi-labs/gh-aw-internal/.github/workflows/gh-aw-pr-review.md@8a92f53fac170563f7727cacab2dbedb5d5b9e29

@corymhall
corymhall requested a review from a team June 5, 2026 17:09
@corymhall
corymhall force-pushed the aws-pf-schema-metadata-startup branch from 02801be to b8f39a6 Compare June 16, 2026 11:14
@corymhall
corymhall merged commit 72bd522 into master Jun 16, 2026
29 of 30 checks passed
@corymhall
corymhall deleted the aws-pf-schema-metadata-startup branch June 16, 2026 17:44
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v7.34.0.

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.

3 participants