anyone with an example of looking up the default n...
# google-cloud
b
anyone with an example of looking up the default network for a project ?
m
b
hey Jacob, not sure. Im trying to a project's vpc to use elsewhere
m
hopefully someone with more experience can help. I think when you create the first VPC you can reference it using the variable... but if it's not created in Pulumi I wonder how you can get that information 🤔 it looks like there are some differences between the API and some options available on Cloud Console: https://github.com/pulumi/pulumi-gcp/issues/133 maybe another idea is to delete the auto-created network:
gcp.organizations.Project ~> autoCreateNetwork: false
it will temporarily create a network then delete it right after the project is created...
Copy code
import * as gcp from "@pulumi/gcp";

const peeringNetwork = new gcp.compute.Network("peeringNetwork", {});
const privateIpAlloc = new gcp.compute.GlobalAddress("privateIpAlloc", {
     addressType: "INTERNAL",
     network: peeringNetwork.selfLink,
     prefixLength: 16,
     purpose: "VPC_PEERING",
});
const foobar = new gcp.servicenetworking.Connection("foobar", {
     network: peeringNetwork.selfLink,
     reservedPeeringRanges: [privateIpAlloc.name],
     service: "<http://servicenetworking.googleapis.com|servicenetworking.googleapis.com>",
});
g
https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/gcp/compute/#getNetwork should work for you using “default” as the name to lookup.
❤️ 1
b
Thank you @mammoth-elephant-55302 & @gentle-diamond-70147 I was making it more difficult than necessary - this simplified it a bunch :D
đź‘Ť 1