sparse-intern-71089
11/11/2022, 1:37 PMechoing-dinner-19531
11/11/2022, 4:07 PMoutputX = outputX.Apply(x => validateX(x); return x)
Such that anything using this value will only see it if it's been validated.early-plastic-49211
11/11/2022, 4:19 PM_ = args.Tags.Apply(t =>
{
if (t["tier"] == "prod")
{
Common.ValidateTags(t);
}
return true;
});
Where an exception is thrown if the validation fails.
Another use case that feels hacky is if I have to wait for a resource to be created, I literally discard the value:
_ = privateZone.Id.Apply(_ =>
{
CreatePrivateEndpoint();
return true;
});
Inside CreatePrivateEndpoint, I use "GetPrivateZone" which uses parameters from another part of the code (which doesn't use Inputs). This is to make the method more flexible (it supports private zones created from Pulumi and from the web console).echoing-dinner-19531
11/11/2022, 4:32 PMargs.Tags = args.Tags.Apply(t =>
{
if (t["tier"] == "prod")
{
Common.ValidateTags(t);
}
return t;
});
?
The second one, you might want to look at the dependsOn resource option. Lets you delay the creation of other resources until one has resolved.early-plastic-49211
11/11/2022, 4:34 PM