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

Pulumi imports gcp backendService with wrong `generatedId` #1460

Open losisin opened 11 months ago

losisin commented 11 months ago

What happened?

When importing gcp:compute/backendService:BackendService there is wrong value for generatedId. I need this value to be correct because I'm using it as env var for cloudrun service. It is required by jitaccess. This was working fine with terraform (that's how it was initially created). After import, last 4 digits are replaced with 0000. My guess is that it could be connected to this comment here

Example

pulumi import 'gcp:compute/backendService:BackendService' default projects/XXXXXXXXXXXX/global/backendServices/jitaccess-backend

Output of pulumi about

CLI          
Version      3.97.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME        VERSION
cloudflare  5.16.0
gcp         7.3.1
nodejs      unknown

Host     
OS       darwin
Version  14.2
Arch     arm64

This project is written in nodejs: executable='/opt/homebrew/opt/node@20/bin/node' version='v20.9.0'

Current Stack: organization/jitaccess/production

TYPE                                       URN
pulumi:pulumi:Stack                        urn:pulumi:production::jitaccess::pulumi:pulumi:Stack::jitaccess-production
pulumi:providers:gcp                       urn:pulumi:production::jitaccess::pulumi:providers:gcp::default_7_3_1
gcp:cloudrun/service:Service               urn:pulumi:production::jitaccess::gcp:cloudrun/service:Service::default
gcp:compute/globalAddress:GlobalAddress    urn:pulumi:production::jitaccess::gcp:compute/globalAddress:GlobalAddress::default
gcp:compute/backendService:BackendService  urn:pulumi:production::jitaccess::gcp:compute/backendService:BackendService::default

Found no pending operations associated with production

Backend        
Name           xxxxxxxxxx
URL            gs://xxxxxxx
User           xxxxxxxxxxx
Organizations  
Token type     xxxxxxx

Dependencies:
NAME                VERSION
@pulumi/cloudflare  5.16.0
@pulumi/gcp         7.3.1
@pulumi/pulumi      3.98.0
@types/node         18.19.3

Pulumi locates its logs in /var/folders/8y/q1drmg0x11gcswc4wlxhpynr0000gn/T/ by default

Additional context

I verified both terraform state and output from gcloud compute backend-services describe jitaccess-backend --global and the value there is as it should.

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).

t0yv0 commented 11 months ago

Thank you for reporting this issue and I am sorry you are affected!

The ticket you mention says the user got their scenario to work on v6.49.0, does this version work for you as well (in which case we have a regression here?).

I'm suspecting https://github.com/pulumi/pulumi-terraform-bridge/issues/1342 might be implicated here as we're possibly truncating large "numbers" somewhere in the translation between Pulumi and TF.

losisin commented 11 months ago

@t0yv0 the ticket I mentioned says the user couldn't reference the output at all judging by the error: E AttributeError: 'BackendService' object has no attribute 'generated_id' the comment however, makes me think that this was issue since v6.49.0. I took the hint from the last 3 digits posted from output 9033009296946491000 which is similar to mine.