pulumi / pulumi-gcp

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

Panic when importing a GCP service account #1783

Open guilhem-fry opened 4 months ago

guilhem-fry commented 4 months ago

What happened?

Pulumi can't import a service account because it doesn't recognise the type of the resource as suggested in the API documentation.

How to reproduce

I need to import an existing service account in my GCP infrastructure.

I follow the documentation's syntax for importing this type of resource:

pulumi import gcp:serviceaccount/account:Account default projects/{{project_id}}/serviceAccounts/{{email}}

Issue

Pulumi doesn't recognise the type although that's the one suggested in the API documentation:

     Type                           Name                         Plan       Info
     pulumi:pulumi:Stack            sde-consent-api-development             1 error
 =   └─ gcp:serviceaccount:Account  service-account              import     1 error

Diagnostics:
  gcp:serviceaccount:Account (<service-account-name>):
    error: Preview failed: Resource type 'gcp:serviceaccount/account:Account' not found.

  pulumi:pulumi:Stack (<stack-name>):
    error: preview failed

Example

CLI command so no code to run for this

Output of pulumi about

CLI
Version 3.108.1 Go Version go1.22.0 Go Compiler gc

Plugins NAME VERSION gcp 6.67.0 python unknown

Host
OS darwin Version 12.7.3 Arch x86_64

This project is written in python: executable='/Users/guilhemforey/Library/Caches/pypoetry/virtualenvs/consent-api-07kQ-glw-py3.11/bin/python3' version='3.11.4'

Backend
Name MacBook-Pro.local URL gs://pulumi-state-iac User guilhemforey Organizations
Token type personal

Dependencies: NAME VERSION black 22.12.0 consent-api 0.1.0 flake8-bugbear 22.10.27 flake8-docstrings 1.6.0 google-cloud-run 0.10.0 grpcio-status 1.56.2 httptools 0.6.0 ipython 8.10.0 isort 5.11.4 mypy 0.991 pep8-naming 0.13.2 pip 23.3.2 pre-commit 3.5.0 pulumi-gcp 6.67.0 PySocks 1.7.1 ruamel.yaml 0.17.21 types-SQLAlchemy 1.4.53.17 uvloop 0.17.0 watchfiles 0.20.0 websockets 11.0.3 wheel 0.42.0

Pulumi locates its logs in /var/folders/q3/p1431wsn2jjbc9x9xdn62_bh0000gn/T/ by default

Additional context

Self-hosting the state in a GCP bucket

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

iwahbe commented 4 months ago

Hi @guilhem-fry. Thanks for opening an issue. Can you try upgrading the provider you are using to v7? This works for me with the pulumi-gcp@v7.12.0.