sparse-intern-71089
01/20/2022, 9:03 PMmillions-furniture-75402
01/20/2022, 9:09 PMbored-table-20691
01/20/2022, 9:10 PMlocal.Command
be run every time the pulumi up
is executed) or notmillions-furniture-75402
01/20/2022, 9:10 PMpulumi up
bored-table-20691
01/20/2022, 9:14 PMCommand
docs are not super clear on this, in the sense that the Command
resource is a resource in the overall graph as far as I understand, so assuming no updates are needed (i.e. nothing has changed in it or its dependencies that cause it to need to be updated), it won’t be re-executed again.
An example would be if I used Command
to set up the tunnel, and ran pulumi up
, and then rebooted my machine, and ran pulumi up
again (let’s say changed some postgresql.Role
object, so it needs to be updated), will the tunnel get recreated (since it doesn’t exist locally anymore?
Is my understanding wrong?bored-table-20691
01/20/2022, 9:14 PMFWIW, the automation API can be used inline in a Pulumi plan and work with only pulumi up
I’m not sure I followed this one 🙂millions-furniture-75402
01/20/2022, 9:17 PMindex.ts
looks like:
const executePlan = async (): Promise<void> => {
...
}
executePlan();
Then all your logic inside of that plan will execute using pulumi up
including the tunnel that you want to setup.bored-table-20691
01/20/2022, 9:20 PMpostgresql
provider, all in the same stack.
So I don’t know ahead of time the RDS information in order to set up the tunnel, or my bastion host that I’ll use for the tunnel, etc.
Does that make sense? It feels like in order to do this, I’d need to split it up into two stacks in order to be able to create the tunnel prior to running the main Pulumi program. But I could be thinking about it wrongmillions-furniture-75402
01/20/2022, 9:33 PMSo I don’t know ahead of time the RDS information in order to set up the tunnel, or my bastion host that I’ll use for the tunnel, etc.For this part, you just can apply your outputs, but then you're in the trap of putting resource declarations inside your applies
bored-table-20691
01/20/2022, 9:34 PMbored-table-20691
01/20/2022, 9:35 PMmillions-furniture-75402
01/20/2022, 9:36 PMmillions-furniture-75402
01/20/2022, 9:38 PMbored-table-20691
01/20/2022, 9:41 PMstopSshTunnel
might already be called?
Conceptually, the way I think about it, it has to be:
startTunnel();
... run Pulumi plan ...
stopTunnel();
millions-furniture-75402
01/20/2022, 9:42 PMmillions-furniture-75402
01/20/2022, 9:43 PMmillions-furniture-75402
01/20/2022, 9:44 PMbored-table-20691
01/20/2022, 9:44 PMCREATE DATABASE …
going to be done asynchronously, and as such, the stopTunnel()
call on line 58 might be called prior to that asynchronous activity happening?millions-furniture-75402
01/20/2022, 9:46 PMmillions-furniture-75402
01/20/2022, 9:46 PMbored-table-20691
01/20/2022, 9:48 PMmillions-furniture-75402
01/20/2022, 9:51 PMbored-table-20691
01/20/2022, 9:51 PMCommand
is promising, but I can’t tell if it’s suitable for this particular case, as I think it’s treated as a resource rather than as a procedural command 🙂bored-table-20691
01/20/2022, 9:52 PMpostgresql
provider (i.e. does this DB exist, does it need to be modified, etc).millions-furniture-75402
01/20/2022, 9:57 PM