-
Notifications
You must be signed in to change notification settings - Fork 99
Sketch out a new attribute path package. #52
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
Conversation
|
I think we want to separate out the concept of an AttributeMatcher and an AttributePath, which this conflates. AttributePath is good for specifying a single, concrete attribute. It's used in diagnostics and to surface context to provider developers during validate and plan modification, for example. AttributeMatcher is good for specifying the types of attributes something works on, and is what the I think separating those out into separate types/concepts would be helpful in keeping straight which we're talking about, as the above technically would allow provider developers to return wildcards as part of diagnostics, which we'd need to catch and throw an error on because Terraform doesn't support that. We'd also be at risk of accidentally passing wildcard paths to provider developers as part of validation, which is less than helpful. |
|
AttributePaths also likely want a way to be navigated. For example, a |
Wanted to capture some ideas and see what an interface might look like, so I started sketching out a new attribute path package.
Split paths and the wildcard version out into two different abstractions. Move them into the `attr` package.
56e19fc to
a2b51a9
Compare
Add ChildOf method on Path that returns true of a Path contains another Path as a prefix. Add String method on Path that returns human-friendly Path representations. This required adding String methods to our attr.Value implementations so that we could call them when using elementKeyValues.
This breaks support for sets, but whatever.
|
It's only taken a few months of refactoring to catch up to this 😂 but we finally got to a place where we wanted with native attribute path handling: #390 Next up is migrating Config/Plan/State.Raw and separately on path expression handling! |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Wanted to capture some ideas and see what an interface might look like,
so I started sketching out a new attribute path package.