Python import of `service_account` fails / documenation wrong
See original GitHub issueI am trying to create a Service Account on GCP with the pulumi python module according to the documentation. This fails with an import error
Following the example usage described in the documentation https://www.pulumi.com/docs/reference/pkg/gcp/serviceaccount/account/
import pulumi
import pulumi_gcp as gcp
service_account = gcp.service_account.Account("serviceAccount",
account_id="service-account-id",
display_name="Service Account")
results in this error:
File "./__main__.py", line 24, in <module>
service_account = gcp.service_account.Account(
AttributeError: module 'pulumi_gcp' has no attribute 'service_account'
I would expect this to properly create a service account
Versions: pulumi-gcp==5.3.0, pulumi version v3.2.1
Looking at the code https://github.com/pulumi/pulumi-gcp/blob/master/sdk/python/pulumi_gcp/__init__.py#L75 shows that underscores seem to be removed.
So the above code works when removing the underscore in the module as well. I am assuming this will fail for other modules as well.
I would propose to either fix the documentation or change the code to not remove the underscores
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5

Top Related StackOverflow Question
This still isn’t fixed… it’s been a year and a half since this issue was opened. All other threads point back to this one.
What would it take to make the change to the documentation? I’d be happy to make the change if someone can point me in the right direction. Seems like updating the documentation example should be a quick one liner?
~Can I make a PR for this fix? If so, where? I ran into this documentation snafu today.~
Nevermind found it 😃