sparse-intern-71089
11/05/2021, 1:22 PMprehistoric-activity-61023
11/05/2021, 1:38 PMGetNetwork come from?prehistoric-activity-61023
11/05/2021, 1:39 PMable-camera-57198
11/05/2021, 1:39 PMable-camera-57198
11/05/2021, 1:39 PMprehistoric-activity-61023
11/05/2021, 1:39 PMget function has opts where you should be able to set dependsOnable-camera-57198
11/05/2021, 1:39 PMprehistoric-activity-61023
11/05/2021, 1:40 PMdependsOn while getting existing resources but I do use that while creating some of themprehistoric-activity-61023
11/05/2021, 1:40 PMprehistoric-activity-61023
11/05/2021, 1:40 PMable-camera-57198
11/05/2021, 1:41 PMprehistoric-activity-61023
11/05/2021, 1:42 PMget behavior is no different than the one implemented while creating new resources that should do the trick. If no, I guess it’d be worth reporting this as a bug.prehistoric-activity-61023
11/05/2021, 1:42 PMable-camera-57198
11/05/2021, 1:42 PMdependsOn isn't an option there either.able-camera-57198
11/05/2021, 1:43 PMprehistoric-activity-61023
11/05/2021, 1:43 PMprehistoric-activity-61023
11/05/2021, 1:43 PMable-camera-57198
11/05/2021, 1:43 PMable-camera-57198
11/05/2021, 1:45 PMprehistoric-activity-61023
11/05/2021, 1:48 PMable-camera-57198
11/05/2021, 1:48 PMable-camera-57198
11/05/2021, 1:48 PMPulumi.Gcp.Compute. That's the classic provider.prehistoric-activity-61023
11/05/2021, 1:49 PMpublic static Network Get(string name, Input<string> id, NetworkState? state, CustomResourceOptions? opts = null)able-camera-57198
11/05/2021, 1:49 PMprehistoric-activity-61023
11/05/2021, 1:49 PMCustomResourceOptions seems to have `DependsOn`:
https://www.pulumi.com/docs/reference/pkg/dotnet/Pulumi/Pulumi.CustomResourceOptions.htmlable-camera-57198
11/05/2021, 1:49 PMable-camera-57198
11/05/2021, 1:49 PMGetNetwork functionable-camera-57198
11/05/2021, 1:50 PMprehistoric-activity-61023
11/05/2021, 1:50 PMable-camera-57198
11/05/2021, 1:50 PMprehistoric-activity-61023
11/05/2021, 1:51 PMable-camera-57198
11/05/2021, 1:51 PMable-camera-57198
11/05/2021, 1:51 PMprehistoric-activity-61023
11/05/2021, 1:52 PMprehistoric-activity-61023
11/05/2021, 1:52 PMable-camera-57198
11/05/2021, 1:52 PMable-camera-57198
11/05/2021, 1:52 PMable-camera-57198
11/05/2021, 1:52 PMprehistoric-activity-61023
11/05/2021, 1:52 PMprehistoric-activity-61023
11/05/2021, 1:53 PMprehistoric-activity-61023
11/05/2021, 1:53 PMpulumi up/preview and you’re gonna get full-fledged pulumi resource of the given typeable-camera-57198
11/05/2021, 1:54 PMGet is a method on the type?prehistoric-activity-61023
11/05/2021, 1:54 PMable-camera-57198
11/05/2021, 1:54 PMprehistoric-activity-61023
11/05/2021, 1:55 PMNetwork within Pulumi.Gcp.Compute and see whether it has a static method called Getable-camera-57198
11/05/2021, 1:55 PMable-camera-57198
11/05/2021, 1:55 PMprehistoric-activity-61023
11/05/2021, 1:57 PMable-camera-57198
11/05/2021, 1:59 PMable-camera-57198
11/05/2021, 2:02 PMprehistoric-activity-61023
11/05/2021, 2:03 PMable-camera-57198
11/05/2021, 2:04 PMable-camera-57198
11/05/2021, 2:04 PMable-camera-57198
11/05/2021, 2:04 PMprehistoric-activity-61023
11/05/2021, 2:05 PMable-camera-57198
11/05/2021, 2:05 PMError 403: Compute Engine API has not been used in project ########### before or it is disabled.able-camera-57198
11/05/2021, 2:06 PMDependsOn.able-camera-57198
11/05/2021, 2:06 PMable-camera-57198
11/05/2021, 2:07 PMable-camera-57198
11/05/2021, 2:08 PMprehistoric-activity-61023
11/05/2021, 2:08 PMprehistoric-activity-61023
11/05/2021, 2:10 PMprehistoric-activity-61023
11/05/2021, 2:11 PMprehistoric-activity-61023
11/05/2021, 2:11 PMdependsOn attribute” or sth like thatable-camera-57198
11/05/2021, 2:12 PMable-camera-57198
11/05/2021, 2:12 PMprehistoric-activity-61023
11/05/2021, 2:12 PMable-camera-57198
11/05/2021, 2:13 PMprehistoric-activity-61023
11/05/2021, 2:14 PMprehistoric-activity-61023
11/05/2021, 2:15 PMget functions might be tricky. They (most probably) are evaluated during plan phase because other changes might depend on it. If you want it to depend on some resource creation, we have chicked-and-egg problem.able-camera-57198
11/05/2021, 2:16 PMable-camera-57198
11/05/2021, 2:17 PMable-camera-57198
11/05/2021, 2:17 PMable-camera-57198
11/05/2021, 2:18 PMprehistoric-activity-61023
11/05/2021, 2:18 PMprehistoric-activity-61023
11/05/2021, 2:18 PMable-camera-57198
11/05/2021, 2:19 PMable-camera-57198
11/05/2021, 2:19 PMprehistoric-activity-61023
11/05/2021, 2:19 PMprehistoric-activity-61023
11/05/2021, 2:19 PMable-camera-57198
11/05/2021, 2:20 PMable-camera-57198
11/05/2021, 2:20 PMprehistoric-activity-61023
11/05/2021, 2:21 PMable-camera-57198
11/05/2021, 2:21 PM"default" network that GCP creates for all projects once compute is enabled.able-camera-57198
11/05/2021, 2:21 PMprehistoric-activity-61023
11/05/2021, 2:22 PMprehistoric-activity-61023
11/05/2021, 2:23 PMable-camera-57198
11/05/2021, 2:23 PMable-camera-57198
11/05/2021, 2:23 PMable-camera-57198
11/05/2021, 2:24 PMprehistoric-activity-61023
11/05/2021, 2:25 PMprehistoric-activity-61023
11/05/2021, 2:27 PMdef __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
auto_create_subnetworks: Optional[pulumi.Input[bool]] = None,
delete_default_routes_on_create: Optional[pulumi.Input[bool]] = None,
description: Optional[pulumi.Input[str]] = None,
mtu: Optional[pulumi.Input[int]] = None,
name: Optional[pulumi.Input[str]] = None,
project: Optional[pulumi.Input[str]] = None,
routing_mode: Optional[pulumi.Input[str]] = None,
__props__=None):prehistoric-activity-61023
11/05/2021, 2:27 PMprehistoric-activity-61023
11/05/2021, 2:28 PMauto_create_network=false
• you create a vpc with most of the default values (so you don’t need to create subnetwork manually if you don’t want to)
• you have a managed vpc network (so no problems with getting it)prehistoric-activity-61023
11/05/2021, 2:29 PMable-camera-57198
11/05/2021, 2:29 PMable-camera-57198
11/05/2021, 2:29 PMprehistoric-activity-61023
11/05/2021, 2:31 PMprehistoric-activity-61023
11/05/2021, 2:31 PMable-camera-57198
11/05/2021, 2:32 PMable-camera-57198
11/05/2021, 2:32 PMable-camera-57198
11/05/2021, 2:32 PMprehistoric-activity-61023
11/05/2021, 2:33 PM#
# Configure NAT router
#
self.router = gcp.compute.Router(
name,
network=self.network.name,
project=project,
region=region,
opts=ResourceOptions(parent=self.network),
)
self.nat = gcp.compute.RouterNat(
name,
router=self.router.name,
nat_ip_allocate_option="AUTO_ONLY",
source_subnetwork_ip_ranges_to_nat="ALL_SUBNETWORKS_ALL_IP_RANGES",
log_config=gcp.compute.RouterNatLogConfigArgs(
enable=True, filter="ERRORS_ONLY"
),
project=project,
region=region,
opts=ResourceOptions(parent=self.network),
)
#
# Create private VPC peering connection
#
# Some Google managed services (such as Cloud SQL) require private services access for each VPC network
# that is used for private IP connections. This is a one-time procedure but it must be performed before
# attempting to create dependent services.
#
# See: <https://cloud.google.com/sql/docs/mysql/configure-private-services-access>
#
ip_address_range = gcp.compute.GlobalAddress(
self._name,
purpose="VPC_PEERING",
address_type="INTERNAL",
prefix_length=16,
network=self.network.name,
project=project,
opts=ResourceOptions(parent=self.network),
)
self.private_connection = gcp.servicenetworking.Connection(
self._name,
network=self.network.id,
service="<http://servicenetworking.googleapis.com|servicenetworking.googleapis.com>",
reserved_peering_ranges=[ip_address_range.name],
opts=ResourceOptions(parent=self.network),
)able-camera-57198
11/05/2021, 2:34 PM.tf which I'm going to be transposing over.able-camera-57198
11/05/2021, 2:34 PMprehistoric-activity-61023
11/05/2021, 2:35 PMable-camera-57198
11/05/2021, 2:35 PMprehistoric-activity-61023
11/05/2021, 2:36 PMable-camera-57198
11/05/2021, 2:36 PMable-camera-57198
11/05/2021, 2:36 PMable-camera-57198
11/05/2021, 2:37 PMable-camera-57198
11/05/2021, 2:37 PM.tf templates to be less monolith-y, so moving to Pulumi seemed like a smart move.prehistoric-activity-61023
11/05/2021, 2:37 PMable-camera-57198
11/05/2021, 2:37 PMprehistoric-activity-61023
11/05/2021, 2:37 PMable-camera-57198
11/05/2021, 2:37 PMprehistoric-activity-61023
11/05/2021, 2:38 PMable-camera-57198
11/05/2021, 2:38 PMprehistoric-activity-61023
11/05/2021, 2:38 PMprehistoric-activity-61023
11/05/2021, 2:38 PMprehistoric-activity-61023
11/05/2021, 2:39 PMprehistoric-activity-61023
11/05/2021, 2:39 PMable-camera-57198
11/05/2021, 2:40 PMprehistoric-activity-61023
11/05/2021, 2:40 PMprehistoric-activity-61023
11/05/2021, 2:40 PMprehistoric-activity-61023
11/05/2021, 2:41 PMable-camera-57198
11/05/2021, 2:42 PMable-camera-57198
11/05/2021, 2:42 PMable-camera-57198
11/05/2021, 2:42 PMprehistoric-activity-61023
11/05/2021, 2:43 PMable-camera-57198
11/05/2021, 2:43 PMable-camera-57198
11/05/2021, 2:43 PMprehistoric-activity-61023
11/05/2021, 2:43 PMable-camera-57198
11/05/2021, 2:44 PMprehistoric-activity-61023
11/05/2021, 2:44 PMprehistoric-activity-61023
11/05/2021, 2:44 PMprehistoric-activity-61023
11/05/2021, 2:45 PMable-camera-57198
11/05/2021, 2:45 PM