brabster / crucible

AWS CloudFormation templates built with Clojure
Eclipse Public License 1.0
72 stars 18 forks source link

spec-or-ref in policie spec causes circular dependency error #173

Open AgentO3 opened 5 years ago

AgentO3 commented 5 years ago

In the policy spec I have a need for a parameter to be able to take a spec-or-ref. This is because I want to use an xref parameter. However I can't simply use spec-or-ref in the crucible.policies namespace. This is because the spec-or-ref function is defined in the crucible.resources namespace. Referencing it in the crucible.policies namespace or any required namespaces in the crucible.policies causes a circular dependency.

We could move the spec-or-ref function out of the crucible.resources namespace but that would be a rather large change since the spec-or-ref function is used often. Also, it would mean a breaking change for anyone who has defined custom resources. I can't come up with a simple solution so I'm looking for any ideas. However, I think the right solution may need to move the spec-or-ref out of the crucible.resources.

brabster commented 5 years ago

Sorry you've hit this problem - my first thought is that we could copy the spec-or-ref function out to another namespace and deprecate the existing one. They just generate particular JSON structures so I think it'd be easy enough to add a few tests to ensure compatibility. Open to better ideas though!

AgentO3 commented 5 years ago

Oh, it's no problem, thanks for creating and maintaining this repo. Yeah, duplication would be the easiest solution. I wasn't sure which direction to go without some feedback first.