-
Notifications
You must be signed in to change notification settings - Fork 31
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
Allow maintaining nested sub-resources at arbitrary depth #2950
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments inline. Update test snapshot to fix failing test.
e3461ed
to
99cc16c
Compare
62982a7
to
1b4f1ef
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2950 +/- ##
==========================================
+ Coverage 59.93% 60.18% +0.25%
==========================================
Files 64 64
Lines 10296 10361 +65
==========================================
+ Hits 6171 6236 +65
+ Misses 3602 3601 -1
- Partials 523 524 +1 ☔ View full report in Codecov by Sentry. |
1b4f1ef
to
340fa94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to go once we've resolved the failing test.
340fa94
to
b2dc7c9
Compare
…nd a recursive traversal to populate it
This commit works for the Key Vault access policy case. Open points: - Tests. The code needs the provider to look up types, which are in a PartialMap which is hard to instantiate. Will probably extract a type lookup interface. - Handling of flattened containers - how does it mesh with the property path?
… and make it mockable
b2dc7c9
to
45da4ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything's green, all the discussed changes seem to be there and working. Let's ship it!
This PR fixes a defect introduced by #2950. When handling sub-resource properties that may be maintained as stand-alone resources, we need to overwrite them in several code paths. Before, we set them to their default value `[]` on Create, but removed them entirely on Read. This causes unnecessary diffs on Refresh. This PR standardizes the handling on resetting to the default value `[]`. Resolves #3049
This PR is a generalization of #2755, and groundwork for #594. I recommend reading their descriptions first.
The properties pointing to sub-resources that can be maintained as stand-alone resources can now be at any level, with
#/type
references being followed. Traversal methods have been added toresources.AzureAPIProperty
that can gather the paths leading to sub-resource properties (and can also be used for other traversals).In the provider, a new function
findUnsetSubResourceProperties
uses the collected sub-resource paths to look up these properties in API-shaped objects and collects the ones that are not set. InRead()
, we remove them from outputs so they are not projected into inputs. InUpdate()
, we use them to determine where we need to insert cloud state to preserve values not set in our inputs.In order to be able to unit test code that looks up types, this PR also introduces an abstraction
resources.TypeLookupFunc
over the previous direct access toazureNativeProvider.resourceMap.Types
which is hard to mock.