https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
python
  • h

    high-translator-22614

    07/13/2019, 6:37 PM
    in general, if you give pulumi an
    asyncio.Future
    it'll be able to use that (but it won't carry dependency information)
  • h

    high-translator-22614

    07/13/2019, 6:37 PM
    (
    Future
    comes from asyncio tasks)
  • h

    high-translator-22614

    07/13/2019, 6:38 PM
    if
    Output.apply()
    takes an async function as well, that might be the right thing? I'm not sure it can
    w
    • 2
    • 6
  • h

    high-translator-22614

    07/13/2019, 6:40 PM
    in general, the thing is going to be: 1. Wait for resource to spin up 2. Poll for IP assignment against that resource 3. Give IP to the next step
  • c

    colossal-plastic-46140

    07/16/2019, 4:01 PM
    Hi, I am trying to understand how to do two things here. 1) Take an existing iam instance profile, and get it 2) Attach an existing managed policy to the instance profile
    instance_profile = iam.get_instance_profile(name="ab-dev")
    policy = iam.get_policy(arn="*:policy/policy_test")
    iam.RolePolicyAttachment(role=instance_profile,resource_name="policy_test",policy_arn=policy)
    and it seems to be complaining about awaits and async
  • h

    high-translator-22614

    07/16/2019, 4:05 PM
    what's the exact error?
  • c

    colossal-plastic-46140

    07/16/2019, 4:10 PM
    pulumi:pulumi:Stack (test-dev):
        sys:1: RuntimeWarning: coroutine 'get_instance_profile' was never awaited
     
        error: Program failed with an unhandled exception:
        error: Traceback (most recent call last):
          File "/usr/local/bin/pulumi-language-python-exec", line 85, in <module>
            loop.run_until_complete(coro)
          File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
            return future.result()
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 38, in run_in_stack
            await RPC_MANAGER.unhandled_exeception()
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper
            result = await rpc_function(*args, **kwargs)
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/pulumi/runtime/resource.py", line 286, in do_register
            resolver = await prepare_resource(res, ty, custom, props, opts)
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/pulumi/runtime/resource.py", line 79, in prepare_resource
            serialized_props = await rpc.serialize_properties(props, property_dependencies_resources, res.translate_input_property)
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/pulumi/runtime/rpc.py", line 67, in serialize_properties
            struct[translated_name] = result
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py", line 765, in __setitem__
            _SetStructValue(self.fields[key], value)
          File "/Users/ablum/gh/pulimi/venv/lib/python3.7/site-packages/google/protobuf/internal/well_known_types.py", line 732, in _SetStructValue
            raise ValueError('Unexpected type')
        ValueError: Unexpected type
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
  • h

    high-translator-22614

    07/16/2019, 4:16 PM
    sounds like something gave the wrong type
  • h

    high-translator-22614

    07/16/2019, 4:17 PM
    i don't know pulumi well enough to say if it was your data or something internal to pulumi
  • w

    white-balloon-205

    07/16/2019, 4:18 PM
    @colossal-plastic-46140 Just to check - is this produced from code that just contains the code snippet you shared above?
  • c

    colossal-plastic-46140

    07/16/2019, 4:18 PM
    yea, I just changed some of the specifics, IE sanitized arns
    w
    • 2
    • 13
  • l

    little-river-49422

    07/28/2019, 6:25 PM
    hey, any ideas what this means?
    azure:ad:Application aks-app  error: Error ensuring Resource Providers are registered: Cannot register provider Microsoft.DBforPostgreSQL with Azure Resource Manager: resources.ProvidersClient#Register
    I dont have postgres at all in my configuration I dont even have postgres class imported in the configuration
    w
    • 2
    • 6
  • h

    high-translator-22614

    07/28/2019, 7:59 PM
    does your pulumi package version (in your venv) match your pulumi binary version?
    l
    • 2
    • 4
  • h

    high-translator-22614

    07/28/2019, 8:00 PM
    so i just did https://github.com/xonsh/prlint today. it's not as compact as the js version, but it's not bad
    • 1
    • 2
  • h

    high-translator-22614

    07/28/2019, 8:00 PM
    and significantly less magical
  • c

    clever-nest-47198

    07/31/2019, 6:36 PM
    Howdy, I'm having a awful time with coroutines in Python.
  • c

    clever-nest-47198

    07/31/2019, 6:37 PM
    I'm trying to fetch a security group using get_security_group which returns a coroutine, and if that security group exists, I set the import_ flag on ResourceOpts when creating the security group in my code. If it doesn't exist, I just wanna exit out the function.
    Untitled
  • c

    clever-nest-47198

    07/31/2019, 6:39 PM
    Coroutine has no id, I want the id of the security group, and it also hasn't been awaited.
    Untitled
  • h

    high-translator-22614

    07/31/2019, 7:05 PM
    I discuss this in https://github.com/pulumi/pulumi/issues/2901 but the short version is, you need to wrap your transformations in more coroutines, and then wrap the top-level coroutine in
    asyncio.ensure_future()
    😢 1
  • h

    high-translator-22614

    07/31/2019, 7:06 PM
    i've written utilities to clean it up, but they're not ready for release and they might get merged into pulumi
  • b

    brief-apartment-69928

    08/01/2019, 12:31 AM
    hello , i am using pulumi_gcp trying to create depends_on for a resource which depends on another
    def enable_service(self):
            service = "<http://compute.googleapis.com|compute.googleapis.com>"
               gcp.projects.Service("project_services",project=self.project_id,service=service,opts=pulumi.ResourceOptions(depends_on=self.project))
  • b

    brief-apartment-69928

    08/01/2019, 12:32 AM
    error: Program failed with an unhandled exception:
        error: Traceback (most recent call last):
          File "/root/.pulumi/bin/pulumi-language-python-exec", line 85, in <module>
            loop.run_until_complete(coro)
          File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
            return future.result()
          File "/project-factory/venv/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 34, in run_in_stack
            Stack(func)
          File "/project-factory/venv/lib/python3.7/site-packages/pulumi/runtime/stack.py", line 93, in __init__
            func()
          File "/root/.pulumi/bin/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/lib/python3.7/runpy.py", line 280, in run_path
            run_name, mod_spec, pkg_name).copy()
          File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
            exec(code, run_globals)
          File "./__main__.py", line 54, in <module>
            a.prj_create()
          File "./__main__.py", line 38, in prj_create
            self.enable_service()
          File "./__main__.py", line 49, in enable_service
            gcp.projects.Service("project_services",project=self.project_id,service=service,opts=pulumi.ResourceOptions(depends_on=self.project))
          File "/project-factory/venv/lib/python3.7/site-packages/pulumi/resource.py", line 340, in __init__
            for dep in depends_on:
        TypeError: 'Project' object is not iterable
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
  • s

    stocky-spoon-28903

    08/01/2019, 10:24 AM
    @brief-apartment-69928 put self.Project in an array
  • b

    brief-apartment-69928

    08/01/2019, 5:02 PM
    @stocky-spoon-28903 ahh ..thanks
  • b

    brief-apartment-69928

    08/01/2019, 5:03 PM
    Question how i can interface my api with commands like pulumi up , does pulumi expose these in opensource version
  • s

    stocky-spoon-28903

    08/01/2019, 6:00 PM
    It Depends (TM) on exactly what you mean by interface with
  • s

    stocky-spoon-28903

    08/01/2019, 6:00 PM
    You can automate the CLI, certainly
  • h

    high-translator-22614

    08/01/2019, 6:36 PM
    if you mean "can I run pulumi as a CD service", that's trickier
  • b

    brief-apartment-69928

    08/01/2019, 8:13 PM
    I mean i want to trigger
    pulumi up
    like commands through a internal api
  • b

    brief-apartment-69928

    08/01/2019, 8:17 PM
    One way is i use python subprocess to fire these commands , i was looking if pumuli provides these functions as library i can import
Powered by Linen
Title
b

brief-apartment-69928

08/01/2019, 8:17 PM
One way is i use python subprocess to fire these commands , i was looking if pumuli provides these functions as library i can import
View count: 1