Skip to content

Migrate Environment to infer - #836

Draft
iwahbe wants to merge 1 commit into
mainfrom
iwahbe/migrate-environment
Draft

Migrate Environment to infer#836
iwahbe wants to merge 1 commit into
mainfrom
iwahbe/migrate-environment

Conversation

@iwahbe

@iwahbe iwahbe commented May 14, 2026

Copy link
Copy Markdown
Member

Summary

  • Migrates the Environment resource to the infer framework. The legacy PulumiServiceEnvironmentResource (manual gRPC) is removed in favour of an infer.Resource-shaped Environment with EnvironmentInput / EnvironmentState structs.
  • The Environment resource needs both the Pulumi Cloud client (for the metadata UUID) and the upstream Pulumi ESC HTTP client (for the YAML body); it reaches the latter via the existing config.GetEscClient, which the provider already vends alongside config.GetClient.
  • Removes the manual pulumiservice:index:Environment block from manual-schema.json. Infer regenerates the schema with the same wire shape; the only diff is the addition of replaceOnChanges: true annotations on organization, project, and name, which were previously enforced in the legacy resource's custom Diff.

Test plan

  • make provider
  • make build_sdks
  • go test -short ./... in provider/pkg
  • make lint
  • CI integration tests

Notes

  • yaml is typed as types.AssetOrArchive to preserve the published schema (pulumi.json#/Asset).
  • EnvironmentState deliberately does not embed EnvironmentInput: keeping project required in state (with a default) matches the legacy SDK's non-nullable Project output even though project is optional on input.

@github-actions

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 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.95122% with 128 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.75%. Comparing base (6bafee8) to head (797210b).

Files with missing lines Patch % Lines
provider/pkg/resources/environment.go 21.47% 128 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #836      +/-   ##
==========================================
- Coverage   52.18%   51.75%   -0.44%     
==========================================
  Files          82       82              
  Lines        9598     9481     -117     
==========================================
- Hits         5009     4907     -102     
- Misses       4117     4118       +1     
+ Partials      472      456      -16     

☔ 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.

@iwahbe

iwahbe commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

Metabase shows we don't need an __inputs migration.

Replaces the manual `PulumiServiceEnvironmentResource` implementation with
an infer-based resource. The Environment resource is unusual in that it
talks to two backends — the Pulumi Cloud API (for the metadata UUID) and
the upstream Pulumi ESC HTTP client (for the YAML body); it reaches the
latter via `config.GetEscClient`, which the provider already vends
alongside the Pulumi Cloud client.

Regenerates the embedded provider schema. The wire-level shape is
unchanged apart from the addition of `replaceOnChanges` annotations on
the identifier inputs, which the legacy resource enforced inside its
custom `Diff` rather than declaring in the schema.
@iwahbe
iwahbe force-pushed the iwahbe/migrate-environment branch from 481df20 to 797210b Compare June 9, 2026 15:45
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