Hello All. I'm trying to import an existing googl...
# general
f
Hello All. I'm trying to import an existing google cloud ServiceAccount using the latest google-native v0.19.1 plugin and am failing. As I'm new to Pulumi, I'm coding in golang a hybrid "query existing resources and pass them to the corresponding New calls as an import" in my Pulumi program. This lets me play around with both the query/get side and the upsert side. Note: please forgive the variable prefixes... p is for pulumi to differentiate other model spaces from which I'm drawing while I get my bearings. Note: Also, I'm
<eliding>
specific info where necessary, I hope keeping the gist of it clear.
Copy code
var pServiceAccountOptions []pulumi.ResourceOption
var pServiceAccount *pulumiIAM.LookupServiceAccountResult
if pServiceAccount, err = pulumiIAM.LookupServiceAccount(pctx, &pulumiIAM.LookupServiceAccountArgs{
    Project:          "<my-actual-google-project-id>",
    ServiceAccountId: "<my-actual-service-account-id>",
}); err != nil {
    err = nil // Don't propagate an error, but don't try to import it.
} else {
    // Import it.
    // This works, and we get the pServiceAccount
    pServiceAccountOptions = append(pServiceAccountOptions, pulumi.Import(pulumi.ID(<WHAT-HERE>)))
}
The query works, and I'm trying to set up the ResourceOption to import into a following iam NewServiceAccount call (not shown here). I've tried many properties and variants taken from the pServiceAccount for <WHAT-HERE>, but I get:
Copy code
=  google-native:iam/v1:ServiceAccount projects/<project-id>/serviceAccounts/<service-account-id>@<project-id>.<http://iam.gserviceaccount.com|iam.gserviceaccount.com> import
 =  google-native:iam/v1:ServiceAccount projects/<project-id>/serviceAccounts/s<service-account-id>@<project-id>.<http://iam.gserviceaccount.com|iam.gserviceaccount.com> import error: Preview failed: property "projectsId"/"project" not found
 +  pulumi:pulumi:Stack <my-stack> create error: preview failed
 =  google-native:iam/v1:ServiceAccount projects/<project-id>/serviceAccounts/<service-account-id>@<project-id>.<http://iam.gserviceaccount.com|iam.gserviceaccount.com> import 1 error
 +  pulumi:pulumi:Stack <my-stack> create 1 error
Note: If I do NOT use the resource import option, the preview shows that a new service account would be created. I've done the same approach with other resources, and it works, but I know that Service Accounts are an odd beast with respect to identifiers. What am I doing wrong here? What does <WHAT-HERE> need to be?