You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to import an existing ServiceAccount for use in our stack. Since I know that for this stack, the SA will often exist before I use Pulumi to create any infrastructure, I tried to import the SA in code. Unfortunately, it returns an error:
google-native:iam/v1:ServiceAccount (my-sa):
error: Preview failed: property "projectsId"/"project" not found
Example
Code that caused this error:
import*asnativefrom"@pulumi/google-native";
...
...
...
// in some cases, pulumi will create the SAif(createNewGcpServiceAccount){returnnewnative.iam.v1.ServiceAccount(name,{accountId: name,displayName: "my SA",project: args.project,},{parent: this});}else{// but most of the time now, I expect to import an existing SAreturnnewnative.iam.v1.ServiceAccount(name,{accountId: name,displayName: "my SA",project: args.project,},{parent: this,import: `projects/${project}/serviceAccounts/${serviceAccountId}`});}
...I did at one point try using native.iam.v1.getServiceAccountOuptut to get an existing service account, but the problem is I need the service account to be a proper Pulumi Resource - getServiceAccountOuptut returns an interface that has the values I need but I can't use that in dependsOn for other resources that depend on the service account.
Output of pulumi about
CLI
Version 3.115.1
Go Version go1.22.2
Go Compiler gc
Plugins
KIND NAME VERSION
resource command 0.9.2
resource gcp 7.21.0
resource gcp 7.21.0
resource gcp 7.15.0
resource google-native 0.32.0
resource google-native 0.32.0
resource google-native 0.32.0
resource kubernetes 4.11.0
resource kubernetes 4.11.0
resource kubernetes 4.9.1
resource kubernetes 3.30.2
resource kubernetes 3.30.2
language nodejs unknown
Host
OS darwin
Version 13.6.6
Arch x86_64
This project is written in nodejs: executable='/usr/local/bin/node' version='v20.3.0'
Dependencies:
NAME VERSION
@pulumi/command v0.9.2
@pulumi/gcp v7.21.0
@pulumi/google-native v0.32.0
@typescript-eslint/parser 2.34.0
eslint 6.8.0
@pulumi/kubernetes v4.11.0
@types/node 12.20.55
@typescript-eslint/eslint-plugin 2.34.0
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).
The text was updated successfully, but these errors were encountered:
Hi @solomonshorser. My best guess is that what's happening is that the preview is broken because the import doesn't run during preview and returns some malformed outputs rather than unknowns like it should. You could test this by running pulumi up --skip-preview to force it to skip ahead to the full update (as long as you are comfortable with running an actual update in this environment).
Like I mentioned on #983 I can't really promise we'll have time dig in here soon, so you may want to try moving to use pulumi-gcp instead if you are able to.
What happened?
I am trying to import an existing ServiceAccount for use in our stack. Since I know that for this stack, the SA will often exist before I use Pulumi to create any infrastructure, I tried to import the SA in code. Unfortunately, it returns an error:
Example
Code that caused this error:
...I did at one point try using
native.iam.v1.getServiceAccountOuptut
to get an existing service account, but the problem is I need the service account to be a proper Pulumi Resource -getServiceAccountOuptut
returns an interface that has the values I need but I can't use that independsOn
for other resources that depend on the service account.Output of
pulumi about
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).
The text was updated successfully, but these errors were encountered: