Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR builds on
refactor
, adding a plugin system forDiff*
engines. To make the plugin system work, I needed to simplify the interface betweenParameterStore
(formerlyRemoteState
) andDiffResolver
(formerlyFlatDictDiffer
). My proposed interface is:DiffBase.configure(args)
is a standard way for plugins to pre-configure themselves using CLI args. This method would normally usefunctools.partial
to pre-populate constructor kwargs.--force
(to--diffresolver-force
) since it's specific to theDiffResolver
plugin.DiffBase.__init__(remote, local, **kwargs)
initializes the plugin with the local and remote data. The constructorkwargs
can be populated directly by programmatic users.<instance>.plan
(an@property
) returns adict
of operations that will be applied to Parameter Store:DiffBase.describe_diff(plan)
will provide a print-friendly display of the elements inplan
. Since the possible operations inplan
are finite and well-described (i.e. what you can do on the AWS API), the default implementation should work for 99% of implementations.By consolidating all API operations in a
plan
dict, theDiff*
plugin can support an arbitrary amount of complexity. For example, a concurrency-sensitive plugin (like the one proposed in #16) could use additional methods to change the behavior of plans:ImaginaryDiff
would needlocal_changes()
andremote_changes()
instead of simplychanged()
. The result of these methods would be unchanged byresolve()
but the plan would be updated accordingly.I'm not married to the API if you can think of a situation that isn't addressed by it. I needed to get something working and this has been adequate so-far.