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

Support for Complex Types in Bundle Variables #1342

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stevenayers
Copy link

@stevenayers stevenayers commented Apr 6, 2024

Changes

Adding Support for Complex Types in Bundle Variables.

#1298

Tests

Using existing testing pattern with dummy databricks.yml files

@stevenayers
Copy link
Author

stevenayers commented Apr 8, 2024

@pietern I optimistically and naively started this PR but realised it's a pretty huge refactor.

I've mentioned you because it looks like dyn.Value is your brain child.

The issue I'm having is that when normalising the config tree, the logic expects a solid Native type. I explored adding a type field to the variable definition, but because normalize walks the config tree, it's unaware of the elements under the same parent struct. Putting logic into normalizeStruct to look for a type field could maybe help, but it doesn't feel like the right solution.

I wanted to explore:

  1. Using https://github.com/icza/dyno to load the yaml config and convert it to JSON.
  2. Then use https://github.com/zclconf/go-cty which terraform uses for variable resolution to convert the JSON and unmashal it against the tree using cty Types.

But I'd be completely changing the design of how bundle configuration is parsed, so maybe there's a better way by extending dyn.Value with something similar to cty.DynamicPseudoType?

Ps. Haven't used Golang since 2019 so I might be overlooking a cleaner solution using Generics etc.

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.

None yet

1 participant