https://pulumi.com logo
#general
Title
# general
s

salmon-leather-17096

10/10/2023, 9:55 PM
hi all! Is there any way to block program execution until an output value is known? For example if I conditionally wanted to peer a vpc - but only if a VPC of a certain name exists?
Copy code
const inRegionJumpVPC = getVpcOutput({ name: "foo" });
    //Somehow Block here
  if (inRegionJumpVPC) {
    const vpcPeeringConnection = new VpcPeeringConnection(
      `${clusterId}-jumpVpc-peering`,
      {
I know this would be possible with `async`/`await` I’m specifically curious about outputs. The ultimate goal is conditional resource creation in a ComponentResource
i

incalculable-motherboard-92742

10/11/2023, 2:16 AM
Hi Brady, take a look at [apply](https://www.pulumi.com/docs/concepts/inputs-outputs/#apply) to create dependencies.
s

salmon-account-74572

10/11/2023, 4:35 AM
You might also be able to add an explicit dependency with
dependsOn
, more details at https://www.pulumi.com/docs/concepts/options/dependson/
s

salmon-leather-17096

10/11/2023, 3:56 PM
> You might also be able to add an explicit dependency with
dependsOn
, more details at https://www.pulumi.com/docs/concepts/options/dependson/ unfortunately the vpc in question is not created by pulumi so dependencies can not be used here (
get
function results can not be used as dependencies ) @salmon-account-74572 > Hi Brady, take a look at [apply](https://www.pulumi.com/docs/concepts/inputs-outputs/#apply) to create dependencies. Im not sure how apply can be used to create dependencies here @calm-airplane-91573, all values accessible in an apply block would be strings anot not resources
s

salmon-account-74572

10/11/2023, 4:56 PM
Apologies, I overlooked the fact you’re using a
get
function to look up an existing VPC.
2 Views