echoing-postman-88590
10/13/2023, 8:03 AMget*
function not run until another resource is created?
I do not see the depends_on
option for InvokeOptions
.
Thanksdry-keyboard-94795
10/13/2023, 9:54 AM_output
variant of the get function. This allows arguments to be outputs.
A workaround would be to use an output from a resource to defer the call, for example:
vpc = get_vpc_output(default=my_resource.id.apply(_: True))
echoing-postman-88590
10/13/2023, 10:07 AMimport pulumi_gcp as gcp
project = gcp.organizations.Project(
"project",
name="project",
project_id="project",
billing_account="bills",
auto_create_network=False,
)
vpc = gcp.compute.Network(
"vpc",
name="vpc",
auto_create_subnetworks=False,
project=project.name,
)
subnet = gcp.compute.Subnetwork(
"subnet",
name="subnet",
network=vpc.id,
region="us-central1",
ip_cidr_range="10.0.0.0/8",
private_ip_google_access=True,
project=project.name,
)
gcp.compute.get_zones_output(
region=subnet.region,
project=subnet.project,
status="UP",
)
but I still get the error that the project does not exist.dry-keyboard-94795
10/13/2023, 10:42 AMechoing-postman-88590
10/13/2023, 10:45 AMException: invoke of gcp:compute/getZones:getZones failed: invocation of gcp:compute/getZones:getZones returned an error: invoking gcp:compute/getZones:getZones: 1 error occurred:
* googleapi: Error 404: The resource 'projects/project' was not found, notFound
dry-keyboard-94795
10/13/2023, 10:49 AMname
output is the same as input, instead of treating the output use as a dependency, so uses it too early. I've seen it before, not really keen on this kind of optimisation.
You should be able to do project=subnet.id.apply(_: subnet.project)
Output.all(subnet.id, subnet.project).apply(args: args[1])
depends_on
added to InvokeOptions please?
It's been mentioned in a couple of issues, but never got its ownechoing-postman-88590
10/13/2023, 11:02 AMdry-keyboard-94795
10/13/2023, 11:14 AM