-
-
Notifications
You must be signed in to change notification settings - Fork 81
Description
The issue is a bit hard to explain but it is mostly relevant to large packages which produce a lot of resources. Given the default Timoni structure:
- timoni.cue
- templates/
- config.cue
- file1.cue
- file2.cue
Let's say that the templates folder has grown very large (>10 files at the root). The templates
package is also starting to become overcrowded. So, we introduce a new subpackage:
- timoni.cue
- templates/
- config.cue
- file1.cue
- file2.cue
- subpkg/
- file3.cue
Now, here we run into a problem:
- Each of the files contains structures that rely on
#Config
being passed in. This is normal and is used in all of the Timoni examples. - The
#Instance
structure inconfig.cue
also relies on these individual files, as they declare the resources being generated by the module. For example,#Instance
might usesubpkg.#Deployment
. - So, for example,
config.cue
importstimoni.sh/my_module/subpkg
to access the resource structures andfile3.cue
importstimoni.sh/my_module/templates
to access the#Config
structure. This creates a cyclic dependency.
The only reason this appears to be a problem is because #Instance
is included with #Config
in the same package. If, for example, we moved #Instance
to another package, it could have a dependency on #Config
and all of the resources in the subpkg
package without creating a cyclic dependency.
It's very possible I'm missing something obvious here, or there is another way to solve this issue, but my limited CUE knowledge isn't really showing me anything. From what I'm seeing, it's impossible to easily introduce additional packages containing resource structures without running into a cyclic dependency every time.