pulumi / pulumi-gcp

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

get_project_service_account fails with 'dict' object has no attribute 'email_address' #451

Closed edmondop closed 2 months ago

edmondop commented 4 years ago
Diagnostics:
  pulumi:pulumi:Stack (import-master):
    error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/pulumi/pulumi-language-python-exec", line 85, in <module>
        loop.run_until_complete(coro)
      File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
        return future.result()
      File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 83, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 35, in run_pulumi_func
        func()
      File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 83, in <lambda>
        await run_pulumi_func(lambda: Stack(func))
      File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 106, in __init__
        func()
      File "/pulumi/pulumi-language-python-exec", line 84, in <lambda>
        coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
      File "/usr/local/lib/python3.7/runpy.py", line 280, in run_path
        run_name, mod_spec, pkg_name).copy()
      File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "./__main__.py", line 88, in <module>
        opts=ResourceOptions(depends_on=[ephemeral_project.project, registry_access]),
      File "./my_service.py", line 72, in __init__
        parent=self,
      File "./pulumi_utils/storage/bucket_with_notification.py", line 57, in __init__
        opts=opts,
      File "/usr/local/lib/python3.7/site-packages/pulumi_gcp/storage/get_project_service_account.py", line 96, in get_project_service_account
        email_address=__ret__.email_address,
    AttributeError: 'dict' object has no attribute 'email_address'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
leezen commented 4 years ago

Could you please provide the versions of the packages used in producing the above?

edmondop commented 4 years ago

2.10.2 for pulumi and 3.24.0 for pulumi_gcp

justinvp commented 4 years ago

@edmondo1984, I'm unable to reproduce this.

This is my program:

import pulumi
from pulumi_gcp import storage

proj = storage.get_project_service_account()
pulumi.export("proj", proj)

It also works when specifying an explicit project, e.g.:

import pulumi
from pulumi_gcp import storage

proj = storage.get_project_service_account(project="my-proj")
pulumi.export("proj", proj)

And versions of packages:

source venv/bin/activate
python -m pip list
Package    Version
---------- -------
Arpeggio   1.9.2
attrs      20.2.0
dill       0.3.2
grpcio     1.32.0
parver     0.3.0
pip        20.1.1
protobuf   3.13.0
pulumi     2.10.2
pulumi-gcp 3.24.0
semver     2.10.2
setuptools 47.1.0
six        1.15.0

Are you still seeing the issue in a small one-off program that just calls get_project_service_account with the same inputs as your larger program?

One thing you can try to get more information is run with --logtostderr -v=9, e.g.

pulumi up --skip-preview --logtostderr -v=9

And then search the output for gcp:storage/getProjectServiceAccount:getProjectServiceAccount.

For example, I see the expected data coming back:

I0928 08:47:56.778750   54711 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0001c2b40].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: emailAddress={<redacted>}
I0928 08:47:56.778779   54711 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0001c2b40].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: id={<redacted>}
I0928 08:47:56.778792   54711 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0001c2b40].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: project={my-proj}
I0928 08:47:56.778800   54711 provider_plugin.go:1127] Provider[gcp, 0xc0001c2b40].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) success (#ret=3,#failures=0) success
edmondop commented 4 years ago

This is what I see in my logs:

I0925 10:17:02.897683      62 eventsink.go:59] Invoking function prepared: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount
I0925 10:17:02.897859      62 eventsink.go:62] eventSink::Debug(<{%reset%}>Invoking function prepared: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount<{%reset%}>)
I0925 10:17:02.898803      62 source_eval.go:322] handling default provider request for package gcp-3.24.0
I0925 10:17:02.898994      62 registry.go:146] GetProvider(urn:pulumi:master::barchart-import::pulumi:providers:gcp::default_3_24_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9)
I0925 10:17:02.899173      62 rpc.go:225] Unmarshaling property for RPC[ResourceMonitor.Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount)]: project={unopac-dev-master}
I0925 10:17:02.899339      62 source_eval.go:572] ResourceMonitor.Invoke received: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount #args=1
I0925 10:17:02.899463      62 provider_plugin.go:1083] Provider[gcp, 0xc000be3c80].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) executing (#args=1)
I0925 10:17:02.899611      62 rpc.go:71] Marshaling property for RPC[Provider[gcp, 0xc000be3c80].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).args]: project={unopac-dev-master}
I0925 10:17:02.900777      62 eventsink.go:59] Retry Transport: starting RoundTrip retry loop

And then later in the logs:

I0925 10:17:03.003428      62 provider_plugin.go:1127] Provider[gcp, 0xc000be3c80].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) success (#ret=0,#failures=0) success
I0925 10:17:03.004651      62 eventsink.go:59] resource {'access_approval_custom_endpoint': None, 'access_context_manager_custom_endpoint': None, 'access_token': None, 'active_directory_custom_endpoint': None, 'app_engine_custom_endpoint': None, 'artifact_registry_custom_endpoint': None, 'batching': None, 'big_query_custom_endpoint': None, 'bigquery_connection_custom_endpoint': None, 'bigquery_data_transfer_custom_endpoint': None, 'bigquery_reservation_custom_endpoint': None, 'bigtable_custom_endpoint': None, 'billing_custom_endpoint': None, 'billing_project': None, 'binary_authorization_custom_endpoint': None, 'cloud_asset_custom_endpoint': None, 'cloud_billing_custom_endpoint': None, 'cloud_build_custom_endpoint': None, 'cloud_functions_custom_endpoint': None, 'cloud_identity_custom_endpoint': None, 'cloud_iot_custom_endpoint': None, 'cloud_run_custom_endpoint': None, 'cloud_scheduler_custom_endpoint': None, 'cloud_tasks_custom_endpoint': None, 'composer_custom_endpoint': None, 'compute_beta_custom_endpoint': None, 'compute_custom_endpoint': None, 'container_analysis_custom_endpoint': None, 'container_beta_custom_endpoint': None, 'container_custom_endpoint': None, 'credentials': <pulumi.output.Output object at 0x7f328e168f50>, 'data_catalog_custom_endpoint': None, 'data_fusion_custom_endpoint': None, 'data_loss_prevention_custom_endpoint': None, 'dataflow_custom_endpoint': None, 'dataproc_beta_custom_endpoint': None, 'dataproc_custom_endpoint': None, 'datastore_custom_endpoint': None, 'deployment_manager_custom_endpoint': None, 'dialogflow_custom_endpoint': None, 'dns_beta_custom_endpoint': None, 'dns_custom_endpoint': None, 'filestore_custom_endpoint': None, 'firebase_custom_endpoint': None, 'firestore_custom_endpoint': None, 'game_services_custom_endpoint': None, 'healthcare_custom_endpoint': None, 'iam_credentials_custom_endpoint': None, 'iam_custom_endpoint': None, 'iap_custom_endpoint': None, 'identity_platform_custom_endpoint': None, 'kms_custom_endpoint': None, 'logging_custom_endpoint': None, 'memcache_custom_endpoint': None, 'ml_engine_custom_endpoint': None, 'monitoring_custom_endpoint': None, 'network_management_custom_endpoint': None, 'notebooks_custom_endpoint': None, 'os_config_custom_endpoint': None, 'os_login_custom_endpoint': None, 'project': None, 'pubsub_custom_endpoint': None, 'redis_custom_endpoint': None, 'region': None, 'request_timeout': None, 'resource_manager_custom_endpoint': None, 'resource_manager_v2beta1_custom_endpoint': None, 'runtime_config_custom_endpoint': None, 'runtimeconfig_custom_endpoint': None, 'scopes': None, 'secret_manager_custom_endpoint': None, 'security_center_custom_endpoint': None, 'security_scanner_custom_endpoint': None, 'service_directory_custom_endpoint': None, 'service_management_custom_endpoint': None, 'service_networking_custom_endpoint': None, 'service_usage_custom_endpoint': None, 'source_repo_custom_endpoint': None, 'spanner_custom_endpoint': None, 'sql_custom_endpoint': None, 'storage_custom_endpoint': None, 'storage_transfer_custom_endpoint': None, 'tpu_custom_endpoint': None, 'user_project_override': None, 'vpc_access_custom_endpoint': None, 'zone': None} prepared
I0925 10:17:03.008782      62 eventsink.go:62] eventSink::Debug(<{%reset%}>resource {'access_approval_custom_endpoint': None, 'access_context_manager_custom_endpoint': None, 'access_token': None, 'active_directory_custom_endpoint': None, 'app_engine_custom_endpoint': None, 'artifact_registry_custom_endpoint': None, 'batching': None, 'big_query_custom_endpoint': None, 'bigquery_connection_custom_endpoint': None, 'bigquery_data_transfer_custom_endpoint': None, 'bigquery_reservation_custom_endpoint': None, 'bigtable_custom_endpoint': None, 'billing_custom_endpoint': None, 'billing_project': None, 'binary_authorization_custom_endpoint': None, 'cloud_asset_custom_endpoint': None, 'cloud_billing_custom_endpoint': None, 'cloud_build_custom_endpoint': None, 'cloud_functions_custom_endpoint': None, 'cloud_identity_custom_endpoint': None, 'cloud_iot_custom_endpoint': None, 'cloud_run_custom_endpoint': None, 'cloud_scheduler_custom_endpoint': None, 'cloud_tasks_custom_endpoint': None, 'composer_custom_endpoint': None, 'compute_beta_custom_endpoint': None, 'compute_custom_endpoint': None, 'container_analysis_custom_endpoint': None, 'container_beta_custom_endpoint': None, 'container_custom_endpoint': None, 'credentials': <pulumi.output.Output object at 0x7f328e168f50>, 'data_catalog_custom_endpoint': None, 'data_fusion_custom_endpoint': None, 'data_loss_prevention_custom_endpoint': None, 'dataflow_custom_endpoint': None, 'dataproc_beta_custom_endpoint': None, 'dataproc_custom_endpoint': None, 'datastore_custom_endpoint': None, 'deployment_manager_custom_endpoint': None, 'dialogflow_custom_endpoint': None, 'dns_beta_custom_endpoint': None, 'dns_custom_endpoint': None, 'filestore_custom_endpoint': None, 'firebase_custom_endpoint': None, 'firestore_custom_endpoint': None, 'game_services_custom_endpoint': None, 'healthcare_custom_endpoint': None, 'iam_credentials_custom_endpoint': None, 'iam_custom_endpoint': None, 'iap_custom_endpoint': None, 'identity_platform_custom_endpoint': None, 'kms_custom_endpoint': None, 'logging_custom_endpoint': None, 'memcache_custom_endpoint': None, 'ml_engine_custom_endpoint': None, 'monitoring_custom_endpoint': None, 'network_management_custom_endpoint': None, 'notebooks_custom_endpoint': None, 'os_config_custom_endpoint': None, 'os_login_custom_endpoint': None, 'project': None, 'pubsub_custom_endpoint': None, 'redis_custom_endpoint': None, 'region': None, 'request_timeout': None, 'resource_manager_custom_endpoint': None, 'resource_manager_v2beta1_custom_endpoint': None, 'runtime_config_custom_endpoint': None, 'runtimeconfig_custom_endpoint': None, 'scopes': None, 'secret_manager_custom_endpoint': None, 'security_center_custom_endpoint': None, 'security_scanner_custom_endpoint': None, 'service_directory_custom_endpoint': None, 'service_management_custom_endpoint': None, 'service_networking_custom_endpoint': None, 'service_usage_custom_endpoint': None, 'source_repo_custom_endpoint': None, 'spanner_custom_endpoint': None, 'sql_custom_endpoint': None, 'storage_custom_endpoint': None, 'storage_transfer_custom_endpoint': None, 'tpu_custom_endpoint': None, 'user_project_override': None, 'vpc_access_custom_endpoint': None, 'zone': None} prepared<{%reset%}>)
I0925 10:17:03.009622      62 eventsink.go:59] resource registration prepared: ty=pulumi:providers:gcp, name=ephemeral-project-provider
I0925 10:17:03.009634      62 eventsink.go:62] eventSink::Debug(<{%reset%}>resource registration prepared: ty=pulumi:providers:gcp, name=ephemeral-project-provider<{%reset%}>)
I0925 10:17:03.013395      62 eventsink.go:59] Invoking function completed successfully: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount
I0925 10:17:03.013411      62 eventsink.go:62] eventSink::Debug(<{%reset%}>Invoking function completed successfully: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount<{%reset%}>)
justinvp commented 4 years ago

Hmm, the first line of the second set of lines:

I0925 10:17:03.003428      62 provider_plugin.go:1127] Provider[gcp, 0xc000be3c80].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) success (#ret=0,#failures=0) success

Has: success (#ret=0,#failures=0), implying no results were returned.

Whereas I see: success (#ret=3,#failures=0) and the three lines before that shows the emailAddress, id, and project values.

I do wonder if you wrote a simple program that calls getProjectServiceAccount in TypeScript or another language if the problem still happens there. We can also look to see if there were any changes in 3.24.0 of the provider plugin that could cause this.

edmondop commented 4 years ago

What is your diagnosis? Is that the api is returning a 404 which Pulumi is not interpreting correctly?

Il giorno ven 2 ott 2020 alle ore 20:11 Justin Van Patten < notifications@github.com> ha scritto:

Hmm, the first line of the second set of lines:

I0925 10:17:03.003428 62 provider_plugin.go:1127] Provider[gcp, 0xc000be3c80].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) success (#ret=0,#failures=0) success

Has: success (#ret=0,#failures=0), implying no results were returned.

Whereas I see: success (#ret=3,#failures=0) and the three lines before that shows the emailAddress, id, and project values.

I do wonder if you wrote a simple program that calls getProjectServiceAccount in TypeScript or another language if the problem still happens there. We can also look to see if there were any changes in 3.24.0 of the provider plugin that could cause this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pulumi/pulumi-gcp/issues/451#issuecomment-702881592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGGOKJG3OZBL7W5PIPLRKDSIYJTLANCNFSM4RZMLMBA .

justinvp commented 4 years ago

One more thing you can try is turning on tracing in the TF provider by setting TF_LOG env variable to TRACE:

TF_LOG=TRACE pulumi up --logtostderr -v=9

With this, I see the details of the request/response in the log output:

I1013 06:18:26.182081   99296 eventsink.go:59] Google API Request Details:
I1013 06:18:26.182089   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Google API Request Details:<{%reset%}>)
I1013 06:18:26.182202   99296 eventsink.go:59] ---[ REQUEST ]---------------------------------------
I1013 06:18:26.182210   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>---[ REQUEST ]---------------------------------------<{%reset%}>)
I1013 06:18:26.182368   99296 eventsink.go:59] GET /storage/v1/projects/my-project/serviceAccount?alt=json&prettyPrint=false HTTP/1.1
I1013 06:18:26.182377   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>GET /storage/v1/projects/my-project/serviceAccount?alt=json&prettyPrint=false HTTP/1.1<{%reset%}>)
I1013 06:18:26.182523   99296 eventsink.go:59] Host: storage.googleapis.com
I1013 06:18:26.182532   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Host: storage.googleapis.com<{%reset%}>)
I1013 06:18:26.182681   99296 eventsink.go:59] User-Agent: google-api-go-client/0.5 HashiCorp Terraform/0.11+compatible (+https://www.terraform.io) Terraform Plugin SDK/1.11.0 terraform-provider-google-beta/dev
I1013 06:18:26.182694   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>User-Agent: google-api-go-client/0.5 HashiCorp Terraform/0.11+compatible (+https://www.terraform.io) Terraform Plugin SDK/1.11.0 terraform-provider-google-beta/dev<{%reset%}>)
I1013 06:18:26.182865   99296 eventsink.go:59] X-Goog-Api-Client: gl-go/1.14.8 gdcl/20200827
I1013 06:18:26.182875   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>X-Goog-Api-Client: gl-go/1.14.8 gdcl/20200827<{%reset%}>)
I1013 06:18:26.183009   99296 eventsink.go:59] Accept-Encoding: gzip
I1013 06:18:26.183016   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Accept-Encoding: gzip<{%reset%}>)
I1013 06:18:26.183139   99296 eventsink.go:59] 
I1013 06:18:26.183147   99296 eventsink.go:62] eventSink::Debug(<{%reset%}><{%reset%}>)
I1013 06:18:26.183265   99296 eventsink.go:59] 
I1013 06:18:26.183272   99296 eventsink.go:62] eventSink::Debug(<{%reset%}><{%reset%}>)
I1013 06:18:26.183395   99296 eventsink.go:59] -----------------------------------------------------
 +   pulumi:pulumi:Stack  gcpgetorg-dev  create.    
I1013 06:18:26.635373   99296 eventsink.go:59] Google API Response Details:
I1013 06:18:26.635398   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Google API Response Details:<{%reset%}>)
I1013 06:18:26.635625   99296 eventsink.go:59] ---[ RESPONSE ]--------------------------------------
I1013 06:18:26.635636   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>---[ RESPONSE ]--------------------------------------<{%reset%}>)
I1013 06:18:26.635812   99296 eventsink.go:59] HTTP/1.1 200 OK
I1013 06:18:26.635821   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>HTTP/1.1 200 OK<{%reset%}>)
I1013 06:18:26.635965   99296 eventsink.go:59] Connection: close
I1013 06:18:26.635974   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Connection: close<{%reset%}>)
I1013 06:18:26.636149   99296 eventsink.go:59] Content-Length: 116
I1013 06:18:26.636158   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Content-Length: 116<{%reset%}>)
I1013 06:18:26.636333   99296 eventsink.go:59] Alt-Svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
I1013 06:18:26.636370   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Alt-Svc: h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"<{%reset%}>)
I1013 06:18:26.636550   99296 eventsink.go:59] Cache-Control: private, max-age=0, must-revalidate, no-transform
I1013 06:18:26.636560   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Cache-Control: private, max-age=0, must-revalidate, no-transform<{%reset%}>)
I1013 06:18:26.636697   99296 eventsink.go:59] Content-Type: application/json; charset=UTF-8
I1013 06:18:26.636710   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Content-Type: application/json; charset=UTF-8<{%reset%}>)
I1013 06:18:26.636879   99296 eventsink.go:59] Date: Tue, 13 Oct 2020 13:18:26 GMT
I1013 06:18:26.636902   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Date: Tue, 13 Oct 2020 13:18:26 GMT<{%reset%}>)
I1013 06:18:26.637113   99296 eventsink.go:59] Expires: Tue, 13 Oct 2020 13:18:26 GMT
I1013 06:18:26.637123   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Expires: Tue, 13 Oct 2020 13:18:26 GMT<{%reset%}>)
I1013 06:18:26.637291   99296 eventsink.go:59] Server: UploadServer
I1013 06:18:26.637299   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Server: UploadServer<{%reset%}>)
I1013 06:18:26.637453   99296 eventsink.go:59] Vary: Origin
I1013 06:18:26.637472   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Vary: Origin<{%reset%}>)
I1013 06:18:26.637641   99296 eventsink.go:59] Vary: X-Origin
I1013 06:18:26.637649   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Vary: X-Origin<{%reset%}>)
I1013 06:18:26.637813   99296 eventsink.go:59] X-Guploader-Uploadid: ABg5-UzUF9G2RdVVQTdukV3XCvJnP_4C_dHw4p2Zcs6Y-6hAK4jNb3EaqJZccj8j8gveyC4OzScb8WdXXA2twCWSVyNcGv59Tg
I1013 06:18:26.637825   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>X-Guploader-Uploadid: ABg5-UzUF9G2RdVVQTdukV3XCvJnP_4C_dHw4p2Zcs6Y-6hAK4jNb3EaqJZccj8j8gveyC4OzScb8WdXXA2twCWSVyNcGv59Tg<{%reset%}>)
I1013 06:18:26.637982   99296 eventsink.go:59] 
I1013 06:18:26.637991   99296 eventsink.go:62] eventSink::Debug(<{%reset%}><{%reset%}>)
I1013 06:18:26.638136   99296 eventsink.go:59] {
I1013 06:18:26.638159   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>{<{%reset%}>)
I1013 06:18:26.638344   99296 eventsink.go:59]  "kind": "storage#serviceAccount",
I1013 06:18:26.638352   99296 eventsink.go:62] eventSink::Debug(<{%reset%}> "kind": "storage#serviceAccount",<{%reset%}>)
I1013 06:18:26.638503   99296 eventsink.go:59]  "email_address": "service-123456789012@gs-project-accounts.iam.gserviceaccount.com"
I1013 06:18:26.638512   99296 eventsink.go:62] eventSink::Debug(<{%reset%}> "email_address": "service-123456789012@gs-project-accounts.iam.gserviceaccount.com"<{%reset%}>)
I1013 06:18:26.638711   99296 eventsink.go:59] }
I1013 06:18:26.638722   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>}<{%reset%}>)
I1013 06:18:26.638874   99296 eventsink.go:59] -----------------------------------------------------
I1013 06:18:26.638887   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>-----------------------------------------------------<{%reset%}>)
I1013 06:18:26.639091   99296 eventsink.go:59] Retry Transport: Stopping retries, last request was successful
I1013 06:18:26.639108   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Retry Transport: Stopping retries, last request was successful<{%reset%}>)
I1013 06:18:26.639280   99296 eventsink.go:59] Retry Transport: Returning after 1 attempts
I1013 06:18:26.639291   99296 eventsink.go:62] eventSink::Debug(<{%reset%}>Retry Transport: Returning after 1 attempts<{%reset%}>)
I1013 06:18:26.639667   99296 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0012bc720].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: emailAddress={service-123456789012@gs-project-accounts.iam.gserviceaccount.com}
I1013 06:18:26.639679   99296 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0012bc720].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: id={service-123456789012@gs-project-accounts.iam.gserviceaccount.com}
I1013 06:18:26.639688   99296 rpc.go:225] Unmarshaling property for RPC[Provider[gcp, 0xc0012bc720].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount).returns]: project={my-project}
I1013 06:18:26.639693   99296 provider_plugin.go:1150] Provider[gcp, 0xc0012bc720].Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount) success (#ret=3,#failures=0) success
I1013 06:18:26.639701   99296 rpc.go:71] Marshaling property for RPC[ResourceMonitor.Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount)]: emailAddress={service-123456789012@gs-project-accounts.iam.gserviceaccount.com}
I1013 06:18:26.639706   99296 rpc.go:71] Marshaling property for RPC[ResourceMonitor.Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount)]: id={service-123456789012@gs-project-accounts.iam.gserviceaccount.com}
I1013 06:18:26.639710   99296 rpc.go:71] Marshaling property for RPC[ResourceMonitor.Invoke(gcp:storage/getProjectServiceAccount:getProjectServiceAccount)]: project={my-project}
I1013 06:18:26.640213   99296 eventsink.go:59] Invoking function completed successfully: tok=gcp:storage/getProjectServiceAccount:getProjectServiceAccount
Bharathkumarraju commented 3 years ago

I get same error when i try to create service account with pulumi like below


"""A Google Cloud Python Pulumi program"""
import pulumi
import pulumi_gcp as gcp

service_account = gcp.service_account.Account("serviceAccount",
    account_id="pulumiautomation",
    display_name="pulumi-automation")

and the error is

bharathdasaraju@MacBook-Pro pulumi-test $ pulumi preview
Previewing update (bksa)

View Live: https://app.pulumi.com/Bharathkumarraju/bharathtests/bksa/previews/e7e92e87-63ab-413a-8157-acc57080fee5

     Type                 Name               Plan       Info
 +   pulumi:pulumi:Stack  bharathtests-bksa  create     3 errors

Diagnostics:
  pulumi:pulumi:Stack (bharathtests-bksa):
    error: Program failed with an unhandled exception:
    error: Traceback (most recent call last):
      File "/usr/local/bin/pulumi-language-python-exec", line 92, in <module>
        loop.run_until_complete(coro)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
        return future.result()
      File "/Users/bharathdasaraju/git/pulumi-test/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 110, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/Users/bharathdasaraju/git/pulumi-test/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 43, in run_pulumi_func
        func()
      File "/Users/bharathdasaraju/git/pulumi-test/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 110, in <lambda>
        await run_pulumi_func(lambda: Stack(func))
      File "/Users/bharathdasaraju/git/pulumi-test/venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 133, in __init__
        func()
      File "/usr/local/bin/pulumi-language-python-exec", line 91, in <lambda>
        coro = pulumi.runtime.run_in_stack(lambda: runpy.run_path(args.PROGRAM, run_name='__main__'))
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 285, in run_path
        return _run_code(code, mod_globals, init_globals,
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "/Users/bharathdasaraju/git/pulumi-test/./__main__.py", line 5, in <module>
        service_account = gcp.service_account.Account("serviceAccount",
    AttributeError: module 'pulumi_gcp' has no attribute 'service_account'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1

bharathdasaraju@MacBook-Pro pulumi-test $
justinvp commented 3 years ago

@Bharathkumarraju, I think you want to use gcp.serviceaccount not gcp.service_account:

import pulumi
import pulumi_gcp as gcp

service_account = gcp.serviceaccount.Account("serviceAccount",
    account_id="pulumiautomation",
    display_name="pulumi-automation")
edmondop commented 3 years ago

@Bharathkumarraju my problem was caused by using directly a pulumi.Output from another component, without a map statement in the middle

Bharathkumarraju commented 3 years ago

Thanks @justinvp and yes @edmondo1984 thanks for the reply. I see service_account name has some regex for pulumi upon the GCP one right?

mjeffryes commented 2 months ago

looks like this issue was resolved a while ago