This message was deleted.
# typescript
s
This message was deleted.
l
Nice write-up! I see a few things to talk about, but I promise I'll try to focus on just problem you're currently trying to solve. Yesterday, I really muddled the waters by getting distracted.
Assuming that the infra/dev stack can be absolutely guaranteed that the infra/base stack has already been upped, then I suggest importing the base env secrets stack reference into dev, and exporting both the dev and base+dev secrets from there.
If you do that, does the problem become: "how do I merge Output<aws.ecs.Secret[]> with aws.ecs.Secret[]?"?
a
It does, there is also another problem too, if I do merge base in the dev stack and update base, ALLLL stack will need to be updated, not exactly a problem, but it can be missed pretty easy by someone coming in.
I would like to know how to merge them regardless.
l
Yes, there's a separate question of how to lay out resources across stacks and projects. Maybe that deserves its own question later.
If I was writing a method/function in typescript to do what you're describing, I'd go generic and write a function to merge two Input<T[]> objects, but we can get to that later.
a
I am begining to think the only option is to import them both into ms to make the merge there. I am at least guaranteed that I am always pulling the latest values from the base and env stack, and I am not going to have to worry if dev does not have the latest base stack
l
Yes. If deployment order is important, then you should do that. The function above can be run anywhere.
a
I think I need to do that on the MS side then. I think I am trying to over engineer this. I have to share this file with others when I get it done, because they are having the same problem, so I want this to be really easy for them to use. I thought it would be ideal for it to just return everything it needs in one go. without a bunch of manipulation. The bad part is, there is not way for you to be picky in what you select from an export, so on the ms side, am going to have to do a for each loop over what variables they need for that specific project, and pull them out, I can probably do that in the snnipits you sent pretty easy actually. So maybe it really is best to do it this way.
l
It sounds like the specific project is the place to decide what properties it needs. Base projects shouldn't know much about specific projects, if possible.
I also think you might be able to change your project / stack structure to make things easier. It is very rare to have dependencies between stacks on the same project. Across all the clients and projects I've worked with, I have one, and I hate it.
a
Okay, sounds like I would hate my life. So you use apply to "pull" objects out of outputs basically, in lay man terms.
l
Yes. But you need to remember that they remain in Outputs.
a
they remain outputs when they come out of the function right?
l
Yes. That's not a problem if they're being passed into other resource constructors though, which they almost always are.
a
Awesome! Now that we cleared that all up, I guess a bigger question is, am I even going about this the right way? Is this approach sane?
I am the only DevOps on the team, so I have no one to bounce this off of to have them tell me I am an idiot lol
l
The project layout? Maybe a new question, specific to that? You should be able to re-use chunks of the first post in this thread 🙂
s/I am the only DevOps on the team/I am the only infrastructure coder on the team/
DevOps is a philosophy, like Agile. You're not the only Agile on a team, and you can't be the only DevOps on a team.
a
That is True, I am the only engineer that knows anything about this thuogh.
💯 1
l
You could put deployment version numbers in stacks, or something like that. Then assert on them in all projects.
(In ms project) If base version > dev version then throw exception "Someone forgot to deploy infra/dev, they owe you coffee!"
Not the best solution, but it would work without re-engineering.
a
HAHAHA That could work, but I think what we talked about before is better. Just not as clean as I want it to be. I need to figure out how to wrap this in a pretty bow to share now.
l
I don't think it's an either/or. If there's a risk of a bad deployment order, then you need to build safety in. If you re-engineer to remove that risk, then you won't have to.