Skip to content

Dependencies between constructs and resources #95

Closed

Description

@eladb

We have an interface called IDependable, but It's not a nice API and very explicit. I wonder if it will be sufficient to automatically just add all resources that are children of a dependency target instead, so when you do source.addDependency(target), the tree under target is inspected and any construct that has a logicalId under that tree will be automatically added.

Activity

  1. added
    pr/breaking-change
    on Aug 29, 2018
  2. changed the title [-]Reconsider IDependable[/-] [+]Dependencies between constructs and resources[/+] on Aug 29, 2018
  3. added
    package/awscl
    on Aug 29, 2018
  4. buffovich commented on Aug 29, 2018

    @buffovich

    Two strategies might be considered:

    • Propagation as dependencies of all low-level constructs of the composite we depend on to DependsOn section.
      -- Pros: simple, natural, no cryptic artifacts in the resulting CFN document
      -- Cons: bloats (sometimes exponentially) each DependsOn section of individual simple construct or every DependsOn section of a composite if we establish dependencies between composites
    • Creating fake barrier artifacts and put dependencies on those
      Let me describe it in more details. You need to create two nodes in CFN document - entry node for start barrier and exit nodes for completion barrier. If a composite depends on something, in CFN it will be reflected as start barrier node DependsOn this thing. If there are dependencies on the composite then those dependencies are reflected with DependsOn on completion node (barrier).
      -- Pros: potentially better size optimization of the template, more direct mapping between model and representation.
      -- Cons: presence of obscure barrier nodes in the output document, need to write optimizing algorithms to tree-shake useless barrier nodes if they don't have any dependencies, flatten dependency tree if needed to optimize resource usage, resource number limit exhaustion.

    In https://github.com/awslabs/cloud-templates-ruby we chose the latter because of some important metrics of the templates we already have. For instance size limit becomes a serious problem for us shall we propagate dependencies. However, it's in no way optimal approach for everybody.

    So, looking forward to developments on this front.

  5. buffovich commented on Aug 29, 2018

    @buffovich

    Oh, and another dimension to consider is nested stacks (they make sense after particular size threshold). However, it introduces value/attribute propagation problems between them.

  6. added a commit that references this issue on Feb 4, 2019
    53e6825
  7. added a commit that references this issue on Feb 5, 2019
    f706c3d
  8. added a commit that references this issue on Jul 29, 2026
    06e3268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package/awsclpr/breaking-change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions