Inject values from one stack to another

Hi all,

I’m trying to create a SNS stack and I want to make this to be able to receive variables values in runtime.
To explain better:

  • I have a stack that needs SNS stack to run before this one.
  • if I run ‘terraspace up stackA all’ this will run SNS stack before my stackA
  • From stackA I want to inject values into SNS stack before it runs.

I’ve already tried to use terraspace.rb and use some custom vars but it didn’t work.
The whole point here is to make this stack dynamic so other stacks can use it.

Can you help me with this?

I think you are confusing stacks with modules. For what you are describing you want a standard terraform module.
To reference a different stack in one, add the output helper into your tfvars file and terraspace will automatically determine the dependencies (and run in order) as well inject outputs into the variables of the consumer