Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

People will probably want some kind of output wiring #31

Open
spilliams opened this issue Feb 15, 2023 · 5 comments
Open

People will probably want some kind of output wiring #31

spilliams opened this issue Feb 15, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@spilliams
Copy link
Owner

not unlike Terragrunt's dependency blocks. maybe use terraform_remote_state blocks though.

@spilliams spilliams added the enhancement New feature or request label Feb 15, 2023
@spilliams spilliams added this to the root-dependencies milestone Feb 15, 2023
@spilliams
Copy link
Owner Author

It strikes me that the program currently does not care where state is stored for a given root. In order to provide a downstream root with a remote state data source on its dependency, it will need to know where the dependency stores its state. Which means we'll need a backend block in terrascope.

This feels too heavy. How about this: for this ticket to be called Done, implement an example that uses a dependency and internally has a remote state block that pulls on some of the root scope variables to configure that data source.

@spilliams
Copy link
Owner Author

The remote_state option is interesting, but I think out of scope for this entire project.
Until and unless terrascope knows about a root-scope's backend, we can't have it tell downstreams those details.

There are two options I see, not mutually exclusive:

  1. terrascope provides, in the context, all of the attributes of each dependency. Users could build a module that would take attributes and build a remote state. This is something I could provide an example of. Perhaps the user could build a "partial" of a module.(Have I done anything with partials yet? I meant to...)
  2. terrascope provides, in the context, the terraform output from each dependency. This should be flagged so that the user can tell terrascope to do it or to not do it. It must not happen 100% of the time. I can't tell which direction it should be flagged though.

If we implement both options, the context (and thus the debuggable context file) would look like this:

root = {...}
scope = {...}
attributes = {...}
dependencies = {
  foo = {
    attributes = {...}
    output = {...}
  }
}

@spilliams
Copy link
Owner Author

(No, I haven't done anything with partials yet. I do have a generate block in the root schema, which works for now. But maybe I'll want partials...)

@spilliams
Copy link
Owner Author

AC for this is the 2nd point above.

  1. Build a flag in the root dependency schema that tells terrascope to include (or exclude) the dependency's outputs.
  2. when the flag is enabled (or disabled), provide each dependency's outputs as part of the context of the root-scope.

@spilliams
Copy link
Owner Author

ooh, maybe the project has a default, and the root can have a flag that overrides that setting. I like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant