Git Product home page Git Product logo

Comments (2)

ambsw-technology avatar ambsw-technology commented on September 14, 2024

Maybe this is what -p does, but a flag is really dangerous. If I init -p /path/ and plan -p /path/ but forget the flag and apply, won't I delete a bunch of keys?

from ssm-diff.

ambsw-technology avatar ambsw-technology commented on September 14, 2024

OK I see why the current behavior exists:

  • -p accepts multiple paths.
  • To avoid key collisions, full paths must be retained.
    • If two of the -p paths had the same key, they would collide.
    • Keeping the parent key won't help either since -p a/b/c and -p b/c would also collide.

Even if you preserve the -p behavior, it would be OK to remove any paths shared by the two keys.

  • Let's assume you add an environment variable ROOT_PATH=a/b.
  • It would be valid to call -p a/b/c, returning a YAML with only the c key (and any nested values)
  • It would be invalid (need to error) to call -p x/y/z since they are not contained in the ROOT_PATH
  • It would also be valid to call -p a/b/c -p a/b/z/c. The resulting file would include c and z/c in the root (plus any nested values). It would exclude a key like a/b/z/d per the -p behavior.

So I guess I need to revise my proposal:

  • Support an ENV variable (e.g. ROOT_PATH). These paths are excluded from the YAML file during generation and the YAML file is nested at this path during update.
    • For example, if the SSM structure can be represented by a dict like {a: b: c: {d: da, e: ea}}} and you init with ROOT_PATH=a/b/c, this would produce the YAML:
      d: da
      e: ea
  • The -p flag is retained. It can still filter keys within the ROOT_PATH
    • If -p is not specified ROOT_PATH implicitly limits the search to the same path (i.e. like adding -p $ROOT_PATH)
    • If both are present, all values for the -p flag must be children of ROOT_PATH (or an error will be thrown)

from ssm-diff.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.