Hello :wave:, Can you specify in Pulumi that you ...
# general
l
Hello 👋, Can you specify in Pulumi that you want to depend for one resource on all sub-resources of a ComponentResource to be ready? For example, I want to create an Istio service mesh, want to wait until all the things are ready, and then launch the rest of the pods. Happy to hear suggestions or patterns. :)
ah, found this: https://github.com/pulumi/pulumi/issues/1743 Is it only related to Helm not following this principle?
could it theoretically be achieved through remodelling stuff directy as Pulumi ComponentResource?
b
Hey @loud-noon-7189,
so you have wrapped all of the implementation details of istio inside a component resource and then want to wait for that entire component resource to finish before the next resource is created?
l
Exactly :)
b
ok, so I have a small example here
basically, I have 2 VPCs (in AWS)
the VPC class is a component resource and manages all of the infrastructure required (e.g. NAT gateways, route etc) I then peer these together
the code looks like this
Copy code
const appVpc = new Vpc("app-vpc", {
	description: `${baseTags.ManagedBy} App VPC`,
	baseTags: baseTags,

	baseCidr: "172.28.0.0/16",
	availabilityZoneNames: availabilityZones.names.slice(0, azCount),
	enableFlowLogs: true,

	endpoints: {
		s3: true,
		dynamodb: true,
	},
});

const dataVpc = new Vpc("data-vpc", {
	description: `${baseTags.ManagedBy} Data VPC`,
	baseTags: baseTags,

	baseCidr: "172.18.0.0/16",
	availabilityZoneNames: availabilityZones.names.slice(0, azCount),
	enableFlowLogs: true,

	endpoints: {
		s3: true,
		dynamodb: true,
	},
});

appVpc.configurePeering({
	peerVpc: dataVpc,
	nameTag: `${baseTags.ManagedBy} Peer App to Data`,
	routeSubnets: "private",
});
so I need both VPCs to be created before the peering is take care of
now in the second VPC, I can update to this
Copy code
const dataVpc = new Vpc("data-vpc", {
	description: `${baseTags.ManagedBy} Data VPC`,
	baseTags: baseTags,

	baseCidr: "172.18.0.0/16",
	availabilityZoneNames: availabilityZones.names.slice(0, azCount),
	enableFlowLogs: true,

	endpoints: {
		s3: true,
		dynamodb: true,
	},
}, {
	dependsOn: appVpc,
});
notice I added a depends on
and this will ensure that the second resource actually depends on the first resource (in this case it's a component resource) is completed
does this help?
❤️ 1
l
Neat! So the second vpc is waiting for all resources of the first vpc?
b
yes - and even on destroy, it does it in the reverse order
❤️ 1