acquia / moonshot

Moonshot: Because releasing services shouldn't be a moonshot!
Apache License 2.0
52 stars 49 forks source link

Parent stack outputs not updated #90

Open borsothy opened 8 years ago

borsothy commented 8 years ago

I'm not sure if this is intentional or just an unexpected scenario. When I first create a child stack with a parent stack, it works out nice, Moonshot pulls all outputs from the parent stack and "maps" them to the child input parameters. Now this is done by saving all parameters to the local parameter yaml file, which is okay until you relaunch/update the parent stack. The output values of the parent will actually change, but since all keys are already present in the yaml file, it wont ask for the outputs again (which I expected to happen), but use the outdated ones from the yaml instead. This is somewhat related to the issue raised in the parent stack docs, but not exactly the same.

I'm not quite sure how to handle this, since if we just grab all the outputs of the parent stack each time a child stack is being created, we cannot override those values "manually" anymore. Maybe a switch would be nice to force overriding?

askreet commented 8 years ago

This design was actually on purpose, though it should be more explicitly so perhaps. I had a hard time coming up with scenarios where you'd ever want to update the parent stack in a way that would require your child stacks to also update. In production, this sounds like a very bad idea. In development, tear everything down and try again.

In our case (the first use for parent stacks), we are defining networking equipment in the parent stack (like VPCs, Subnets, etc.) as well as a persistent data storage layer (Aurora). If we ever push an update that changes the output of the parent stack, we have by definition completely ruined all child stacks, as they are dependent on resources that have been deprovisioned.

However, if you add new resources to the parent stack, then require their outputs in the child stack, it will all work with two updates.

Could you explain your scenario and we can go from there?

borsothy commented 8 years ago

We are just switching to the exact same setup you described ("network" stack as parent, everything else as child stack).

How I discovered this was:

  1. launch a parent stack
  2. launch child stack
  3. tear down parent and child stack
  4. relaunch parent stack
  5. relaunch child stack

...and output values were "stuck" in the yaml file from # 1 parent launch. It's fine if I have to remove those parameters manually, and it's obviously not a thing in prod, just a bit annoying on dev. I guess you just need to pay attention haha.

This issue is not a crucial at all, just thought it's worth mentioning. :bowtie:

glennpratt commented 8 years ago

What I'd like to see is a sanity check where we check the parent values and stop if they've changed. Then have two flags like --keep-parent-parameters and --update-parent-parameters.