pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
183 stars 53 forks source link

Unable to create a private connection #821

Open brunoripa opened 2 years ago

brunoripa commented 2 years ago

What happened?

In GCP, I am trying to create a private connection to a vpc I have to then deploy a CloudSQL instance (which requires a network with private access enabled).

I have the Network, a GlobalAddress, and try to create the Connection, but the script fails reporting that the address cannot be found. If I make a query using gcloud, the address is present.

Steps to reproduce

This is part of the script I am running.


vpc = gcp.compute.Network(
    "default",
    name="default",
    project=project,
    auto_create_subnetworks=False,
    # to allow vpn broadcasting routes
    routing_mode="GLOBAL")

ipv4_address = gcp.compute.GlobalAddress(
  "ipv4-address",
  description="IP address range to be used for private connection",
  network=vpc.id,
  project=project,
  address_type="INTERNAL",
  purpose="PRIVATE_SERVICE_CONNECT",  # Correct ?
)

private_vpc_peering = gcp.servicenetworking.Connection(
  "private-vpc-peering",
  network=vpc.id,
  service="servicenetworking.googleapis.com",
  reserved_peering_ranges=[ipv4_address.name],
)

Expected Behavior

A Connection object should be created.

Actual Behavior

The script fails with the following error:

* Error waiting for Create Service Networking Connection: Error code 9, message: Allocated IP range 'ipv4-address-f7f5e3e' not found in network.
    Help Token: xxx

But if I execute:

NAME                                    ADDRESS/RANGE  TYPE      PURPOSE                  NETWORK  REGION       SUBNET  STATUS
ipv4-address-f7f5e3e                    192.168.3.1    INTERNAL  PRIVATE_SERVICE_CONNECT  default                       RESERVED
...

Versions used

CLI Version 3.31.0 Go Version go1.17.9 Go Compiler gc

Plugins NAME VERSION gcp 6.25.0 google-native 0.19.1 kubernetes 3.19.2 python unknown

Host OS ubuntu Version 20.04 Arch x86_64

This project is written in python (/nix/store/5dpzdxcq5vc4dh1kyg9igcailvi1qmlk-python3-3.9.12-env/bin/python3 v3.9.12)

Current Stack: loadtest

TYPE URN pulumi:pulumi:Stack urn:pulumi:loadtest::::pulumi:pulumi:Stack::-loadtest pulumi:providers:gcp urn:pulumi:loadtest::::pulumi:providers:gcp::default pulumi:providers:gcp urn:pulumi:loadtest::::pulumi:providers:gcp::default_6_25_0 gcp:compute/network:Network urn:pulumi:loadtest::::gcp:compute/network:Network::default gcp:compute/subnetwork:Subnetwork urn:pulumi:loadtest::::gcp:compute/subnetwork:Subnetwork::default gcp:compute/router:Router urn:pulumi:loadtest::::gcp:compute/router:Router::router gcp:container/cluster:Cluster urn:pulumi:loadtest::::gcp:container/cluster:Cluster::-cluster-loadtest gcp:compute/routerNat:RouterNat urn:pulumi:loadtest::::gcp:compute/routerNat:RouterNat::nat gcp:compute/instance:Instance urn:pulumi:loadtest::::gcp:compute/instance:Instance::bastion gcp:compute/firewall:Firewall urn:pulumi:loadtest::::gcp:compute/firewall:Firewall::allowiap gcp:compute/globalAddress:GlobalAddress urn:pulumi:loadtest::***::gcp:compute/globalAddress:GlobalAddress::ipv4-address

Found no pending operations associated with loadtest

Backend Name DESKTOP-UOHVP03 URL gs://xxxx User bruno Organizations

NAME VERSION pip 22.1.1 pulumi-gcp 6.25.0 pulumi-google-native 0.19.1 pulumi-kubernetes 3.19.2 setuptools 62.3.2 wheel 0.37.1

Pulumi locates its logs in /tmp by default warning: A new version of Pulumi is available. To upgrade from version '3.31.0' to '3.33.1', visit https://pulumi.com/docs/reference/install/ for manual instructions and release notes.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

brunoripa commented 2 years ago

👍

viveklak commented 2 years ago

Does this fail even if you try running the above again (after the initial failure)? I suspect some sort of an eventual consistency issue. The same seems to be alluded to here on the terraform provider: https://github.com/hashicorp/terraform-provider-google/issues/11100#issuecomment-1040863151

javamo commented 2 years ago

@brunoripa have you found a solution to this?

moulip commented 10 months ago

Hi there,

I'm currently facing the same isssue. I have setup a vpc network, a GlobalAddress and it can't be found in the network when trying to create the Private Connection.