Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix optional rotation state #436

Merged
merged 9 commits into from
Feb 6, 2025
Merged

Conversation

nyobe
Copy link
Contributor

@nyobe nyobe commented Jan 25, 2025

rotation state was intended to be optional, so that it could be left off a new fn::rotate if not bootstrapping initial values, but this doesn't actually work currently.

leaving state off does parse, but it ends up evaluating to an unknown value (since it's a missingExpr) which causes the evaluator to bail out.

so this tries to fix that by treating a missing state key as null, and relaxing the rotator schema to always allow state to be null.

but now that I've done this, I am having second thoughts about the whole exercise... maybe the state key should just be unconditionally required like the inputs key is, and the provider's schema can decide whether it wants to allow empty state objects or not? then a user will always need to provide at least state: {}, but maybe that's fine, since state is a fundamental part of this type of provider.

@nyobe nyobe force-pushed the claire/fix-optional-rotation-state branch from f743a92 to 550d5b3 Compare February 5, 2025 01:31
@nyobe nyobe marked this pull request as ready for review February 5, 2025 01:32
@nyobe nyobe added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Feb 5, 2025
Copy link
Contributor

@seanyeh seanyeh left a comment

Choose a reason for hiding this comment

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

tested this with some env defs, confirmed state gets created when not provided, and schema validation is fixed (requiring inputs)

@nyobe nyobe enabled auto-merge (squash) February 6, 2025 18:39
@nyobe nyobe force-pushed the claire/fix-optional-rotation-state branch from 56f9e1e to ff9873c Compare February 6, 2025 18:39
@nyobe nyobe merged commit eb1195c into main Feb 6, 2025
6 checks passed
@nyobe nyobe deleted the claire/fix-optional-rotation-state branch February 6, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants