Skip to content

Conversation

VenelinMartinov
Copy link
Contributor

@VenelinMartinov VenelinMartinov commented Apr 28, 2025

This PR fixes the schema generation for TF properties which are marked as Required and have a default.

In TF these become optional, as the default will get applied. This PR makes this also the case in Pulumi. SDKs should no longer require such properties to be specified as inputs.

This change should be fully backwards-compatible, see here for a per-language discussion.

fixes #2204

Copy link

codecov bot commented Apr 28, 2025

Codecov Report

Attention: Patch coverage is 90.47619% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@31a6c1e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
pkg/pf/internal/pfutils/default.go 85.71% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3035   +/-   ##
=======================================
  Coverage        ?   68.59%           
=======================================
  Files           ?      335           
  Lines           ?    43414           
  Branches        ?        0           
=======================================
  Hits            ?    29782           
  Misses          ?    11952           
  Partials        ?     1680           

☔ View full report in Codecov by Sentry.
📢 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.

@VenelinMartinov VenelinMartinov changed the base branch from master to vvm/remove_redundant_pf_writeonly_interface April 30, 2025 10:25
@VenelinMartinov VenelinMartinov force-pushed the vvm/fix_required_with_default branch from 03e17f3 to 8e476ca Compare April 30, 2025 10:25
@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented Apr 30, 2025

@VenelinMartinov VenelinMartinov force-pushed the vvm/fix_required_with_default branch 2 times, most recently from d183add to dce432c Compare April 30, 2025 11:32
Base automatically changed from vvm/remove_redundant_pf_writeonly_interface to master April 30, 2025 15:57
@VenelinMartinov VenelinMartinov force-pushed the vvm/fix_required_with_default branch from e9bec3e to 76c4ae7 Compare April 30, 2025 17:12
@VenelinMartinov VenelinMartinov requested review from a team and t0yv0 April 30, 2025 17:13
@VenelinMartinov VenelinMartinov marked this pull request as ready for review April 30, 2025 17:13
@VenelinMartinov VenelinMartinov force-pushed the vvm/fix_required_with_default branch from 76c4ae7 to 64e0342 Compare April 30, 2025 17:14
Copy link
Member

@t0yv0 t0yv0 left a comment

Choose a reason for hiding this comment

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

LGTM modulo some nits.

@t0yv0
Copy link
Member

t0yv0 commented May 5, 2025

Given recent findings in pulumi-aws let's flag this so some providers can implement as part of a major version change.

@VenelinMartinov
Copy link
Contributor Author

@t0yv0 which findings? I've tested this on AWS and I don't think it is affected at all

@t0yv0
Copy link
Member

t0yv0 commented May 5, 2025

Something like pulumi/pulumi-aws#5483 might indicate that at scale user programs rely on type details because output types can unexpectedly get reused in negative type positions. While arguably we do not support this, breaking a lot of programs is bad form; I think that since this change involves type changes we could minimize this impact for example by rolling it out through major releases for Tier 1 providers.

@VenelinMartinov VenelinMartinov force-pushed the vvm/fix_required_with_default branch from 461c765 to 2d8f21d Compare May 6, 2025 13:42
@VenelinMartinov
Copy link
Contributor Author

VenelinMartinov commented May 6, 2025

@t0yv0 no types in either GCP or AWS are affected - I think this isn't as widely impacting as initially assumed. Seems redundant to add the additional complexity of flagging the rollout here.

@t0yv0 t0yv0 self-requested a review May 6, 2025 14:18
@t0yv0
Copy link
Member

t0yv0 commented May 6, 2025

Can you add a flag to turn it off if needed? On by default but can be turned off. Thanks.

@VenelinMartinov VenelinMartinov enabled auto-merge (squash) May 6, 2025 14:39
@VenelinMartinov VenelinMartinov merged commit c206c43 into main May 6, 2025
75 checks passed
@VenelinMartinov VenelinMartinov deleted the vvm/fix_required_with_default branch May 6, 2025 15:00
@pulumi-bot
Copy link
Contributor

This PR has been shipped in release v3.109.0.

VenelinMartinov added a commit that referenced this pull request Jun 3, 2025
…Kv1 providers (#3101)

~Pure refactor.~ Now that adding methods to the `shim` interfaces is no
longer breaking we can remove some of the unnecessary interface clutter.

The only effective change here is that the SDKv1 now implements
`HasDefault`, which means
#3035 will apply
to it as well. This is unlikely to have a meaningful impact.
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.

Required TF properties with a DefaultFunc should be optional in Pulumi

3 participants