fancy-jelly-16159
06/01/2022, 4:34 PM<eliding>
specific info where necessary, I hope keeping the gist of it clear.
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:
= 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?