I'm trying to perform introspection of the AWS res...
# python
b
I'm trying to perform introspection of the AWS resources (
pulumi_aws
) so that we can dynamically define configuration templates. I'm running into the following issue:
Copy code
Traceback (most recent call last):
  File "~/Documents/workspace/ops/pulumi/pulumi-config.py", line 17, in <module>
    import pulumi_aws as aws
  File "~/.virtualenvs/pulumi/lib/python3.9/site-packages/pulumi_aws/__init__.py", line 5, in <module>
    from . import _utilities
  File "~/.virtualenvs/pulumi/lib/python3.9/site-packages/pulumi_aws/_utilities.py", line 15, in <module>
    import pulumi.runtime
ModuleNotFoundError: No module named 'pulumi.runtime'; 'pulumi' is not a package
Any ideas on how I can get
pulumi.runtime
recognized?
s
Can you show some code for context?
b
Definitely. Here's the code:
Copy code
import boto3
import docopt
import pulumi
import pulumi_aws as aws

def driver(args):
    """Main driver for the management CLI tool
    """
    obj = dir("aws.organizations.Organization")
    print(obj)

if __name__ == '__main__':
    driver(docopt.docopt(__doc__))
s
It's not clear to me what you mean by "dynamically define configuration templates". Can you explain a little more about what you're trying to build?
b
That's not the best explanation. I'm trying to build a framework for reviewing the objects with types from
pulumi_aws
in a Pulumi stack and providing users a way to what constructor parameters they'll need to enter for those objects. For example, with
aws.organizations.Organization
, I'd want to know that I'd need to set the parameters of
aws_service_access_principals
,
enabled_policy_types
,
feature_set
are available (source). We want to fill these parameters with values from a data store. So for
aws.organizations.Organization
, we should be able to retrieve the values of
aws_service_access_principals
from a document. We want to have configuration provider similar to the secrets provider that are available with Pulumi. The way that configuration is currently tied to a stack, it seems that the intended association should be environment yaml to stack. This becomes limiting when we want to deploy multiple versions of the stack (for example, multiple RDS/Aurora instances) with different configuration.
I found the issue. I have a file named pulumi.py in my directory 🤦‍♂️ the issue became immediately apparent once I started to debug with VSCode
s
Oof. That's rough.