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

Ability to get Stack Outputs as a Data Source #504

Open
ikegentz opened this issue Jan 30, 2024 · 2 comments
Open

Ability to get Stack Outputs as a Data Source #504

ikegentz opened this issue Jan 30, 2024 · 2 comments
Labels
question Further information is requested

Comments

@ikegentz
Copy link

It would be great to have a way to get the outputs from other stacks with a data source.

For example:

data "spacelift_stack_output" "other_stack_output" {
  stack = "some other stack"
  key   = "output key"
}

Right now I'm not aware of a way to do this short of running a null_resource and querying the graphQL API directly.

@marcinwyszynski
Copy link
Contributor

Spacelift provides a dedicated way to consume outputs of stacks, in the form of references.
Are there use cases that would be better covered by the hypothetical spacelift_stack_output data source?

@marcinwyszynski marcinwyszynski added the question Further information is requested label Apr 3, 2024
@mbainter
Copy link

mbainter commented Apr 4, 2024

For us, references would be the reason for wanting the resource.

Consider a scenario where you have a stack that is creating the environment for a service, and you want to make that information available via a context that can attach to any service in the space that will be deploying to that environment.

In order to do this, you have to create an individual reference for every output that you want to connect between those stacks. Later, if you go back and say, add a bunch of additional subnets, then you have to also create more reference connections between those stacks. You can, of course, use foreach and a list(string) in terraform to DRY this up, but you will still need to manually maintain that list of outputs.

If you could get a list of all of the available outputs, then you wouldn't have to do that. You could just iterate on that datasource and create references automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants