Hi folks, does it matter in what order you define ...
# general
i
Hi folks, does it matter in what order you define resources in your code? Or does Pulumi intelligently select the right order?
For example usually creating an ingress with specified ip before creating the ip will result in an error. So in theory this would fail:
Copy code
new Ingress(name, ingressTemplate);
new GlobalAddress(ipName, {
  name: ipName,
  project: con.glob.project,
});
But what I'm trying to ask is if Pulumi cares about the order?
e
It doesn't matter in what order you place them, Pulumi will try to apply all of them if there are no dependencies.
Let's say that your ingress are going to use the GlobalAddress resource, you can reference the GlobalAddress, which makes it a dependency.
But let's say you use the
ipName
variable as reference in the Ingress, it'll fail, as there are no way for Pulumi to register the dependency.
i
So how would I tell pulumi that the address is a dependency for ingress?
e
I would probably write it something like this:
Copy code
const address = new GlobalAddress(ipName, {
  name: 'the-global-ip',
  project: con.glob.project,
});
new Ingress(name, { ipAddress: address.ip });
i
ip name is part of the ingress config, yes
e
You could also declare the dependency manually, like this:
Copy code
const address = new GlobalAddress(ipName, {
  name: ipName,
  project: con.glob.project,
});
new Ingress(name, ingressTemplate, { dependsOn: address });
i
That's what I'm looking for, thanks!
e
👍