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
  • g

    gorgeous-minister-41131

    10/28/2021, 9:50 PM
    https://www.pulumi.com/registry/packages/aws/api-docs/kms/key/#look-up is there a way to lookup keys’ by tags? similar to the ec2.get_subnets() or vpcs awaitable?
    f
    • 2
    • 2
  • g

    gorgeous-minister-41131

    10/28/2021, 9:51 PM
    I may not know the “key ID” but I know tags
  • s

    sparse-state-34229

    10/29/2021, 1:54 AM
    is it possible to handle the
    KeyError
    on an invalid
    require_output
    ? if I do this:
    try:
        foo = stack_output.require_output("doesnt_exist")
    except KeyError:
        # whatever
    the key error seems to be unhandled:
    value = Output.all(Output.from_input(name), self.outputs).apply(lambda l: l[1][l[0]]) # type: ignore
        KeyError: 'doesnt_exist'
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    r
    • 2
    • 3
  • m

    many-salesmen-89069

    10/29/2021, 1:14 PM
    Am I correct in assuming that there is no Python equivalent for
    pulumi.registerStackTransformation
    ? https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/#registerResourcePackage
    • 1
    • 1
  • s

    salmon-raincoat-19475

    11/02/2021, 1:40 PM
    Hi all! Just joined this community, and learned about Pulumi a couple weeks ago. I'm looking to add some capabilities to our Python/K8s Pulumi build, and noticed that relative imports and custom, non-Pulumi packages are not supported. For this reason, I was looking to make a custom Pulumi package to support some generic creation handling for our team....I saw the https://github.com/pulumi/pulumi-component-provider-py-boilerplate Is there a (more) simple provider example - more simplistic than the eks one?
    p
    b
    • 3
    • 11
  • f

    fancy-eve-82724

    11/05/2021, 1:51 PM
    Hi all, got a question about an error I'm getting with a custom DynamicResource in Python. I've based my code on the aws-py-ec2-provisioners example (https://github.com/pulumi/examples/tree/master/aws-py-ec2-provisioners)
  • f

    fancy-eve-82724

    11/05/2021, 1:51 PM
    I've got this working with one region, but as I've tried to extend it to multiple regions, I'm getting this error during 'pulumi up':
  • f

    fancy-eve-82724

    11/05/2021, 1:52 PM
    pulumi-python:dynamic:Resource (software-admin-london-z0):
        error: Exception calling application: Object of type 'Unknown' is not JSON serializable
  • f

    fancy-eve-82724

    11/05/2021, 1:52 PM
    Wondering if there were any tips on how to determine which object/field it's failing on?
  • f

    fancy-eve-82724

    11/05/2021, 1:53 PM
    Specifically, it's a RemoteExec operation using the RemoteExecProvider from the above example repo
  • f

    fancy-eve-82724

    11/05/2021, 7:11 PM
    Never mind, appears to be due to an issue with one of the dependencies of the RemoteExec resource. Problem is gone.
  • f

    fancy-eve-82724

    11/09/2021, 1:18 PM
    Is there a way to override the path to python3 in Pulumi.yaml? I'm working on CentOS 8 which has a default python 3.6. I've installed python 3.8 as a separate package. I can swap the default python3 interpreter using
    alternatives
    but I may prefer to leave that be, and just use python 3.8 with Pulumi. There's the directive in Pulumi.yaml to specify the virtualenv directory, but is there are directive for specifying which interpreter to use?
    2 runtime:
      3   name: python
      4   options:
      5     virtualenv: venv
    g
    • 2
    • 1
  • f

    fancy-eve-82724

    11/09/2021, 1:29 PM
    Aha, the
    PULUMI_PYTHON_CMD
    environment variable will do
  • c

    cold-minister-39214

    11/09/2021, 8:38 PM
    Is there a way to use
    config.require_secret
    on a structured object? i.e. if I use
    pulumi config set --secret --path things.thing1.token secret_value
    is there a way to do
    config.require_secret('things.thing1.token')
    ? When I do that a “Missing required configuration variable” error. My searches in the docs and in code on github have come up with nothing. Figured I’d ask before diving into SDK source code.
    l
    • 2
    • 2
  • s

    sticky-bear-14421

    11/10/2021, 2:49 PM
    Maybe not Python specific, but I've got a question about importing a resource into the state. My particular problem is, I have two AWS accounts and my code uses a provider to configure resources in the second account. I cannot delete and recreate them easily, thus I have to import these, but how do I import resources located in a second account?
    p
    • 2
    • 15
  • a

    abundant-book-94104

    11/12/2021, 1:44 AM
    It looks like I may have broken my python installation with a clash of azure libraries for key vault. Is there an easy way to recreate the virtual env. Is it ok to delete and create again somehow? This is a WSL2 on Win10 environment
    r
    p
    • 3
    • 6
  • f

    fresh-actor-58531

    11/17/2021, 6:46 AM
    Hi Team, Can anyone help me how to get the config value for aws:profile as dev in pulumi code?
  • f

    fresh-actor-58531

    11/17/2021, 6:50 AM
    to differentiate the functionality on environment values
    p
    m
    • 3
    • 9
  • i

    important-magician-41327

    11/17/2021, 9:27 AM
    I have been working with Terrraform as IaC and using Pyhton to dynamically create terraform scripts and run them inside Pyhton. Now I came across Pulumi and think it would be a better solution. However, I haven’t seen the way to bring up the infrastructure directly from a Python script. Question: Is there a way to execute the CLI commands like “Pulumi up, destroy”?
    f
    • 2
    • 2
  • i

    important-magician-41327

    11/18/2021, 9:50 AM
    Dear Experts, is there a Python example, how to use *multi-region deploymen*t to deploy VPC, EC2 or something else? My goal would be to use a for loop to provision resources in different regions. I found the “*AWS Classic / Provider*”, but there is now example how to use in in Python.
    p
    g
    • 3
    • 52
  • f

    fierce-market-67222

    11/19/2021, 7:01 AM
    Hello All, after updating to 3.18.0 on running pulumi up ( that also worked) i got an error message at the end, this is strange as my code did not change, on a rollback to 3.17.1 the Issue disappeared.
    Failed to resolve python version command: fork/exec bin/python: no such fie or directory
    b
    b
    • 3
    • 7
  • f

    full-sugar-56177

    11/19/2021, 11:47 AM
    I am trying to create a security group with CIDR another security group using its ID but I am getting the following error has a problem: "sg-12345678" is not a valid CIDR block: invalid CIDR address: sg-12345678. Examine values at 'SecurityGroup.Ingresses'. My code:
    lb_sg = aws.ec2.get_security_group(                        
        tags={"Name": "my-lb"}"
    )                                                          
    
    sg = aws.ec2.SecurityGroup(                                  
        "web-lb",                                            
        vpc_id=vpc_id,                                           
        description="Enable HTTP access from Load Balancer",     
        ingress=[                                                
            aws.ec2.SecurityGroupIngressArgs(                    
                protocol="tcp",                                  
                from_port=args.port,                             
                to_port=args.port,                               
                cidr_blocks=[lb_sg.id)],                     
            )                                                    
        ],                                                       
        egress=[                                                 
            aws.ec2.SecurityGroupEgressArgs(                     
                protocol="-1",                                   
                from_port=0,                                     
                to_port=0,                                       
                cidr_blocks=["0.0.0.0/0"],                       
            )                                                    
        ],                                                       
    )
    p
    • 2
    • 4
  • i

    important-magician-41327

    11/22/2021, 11:22 AM
    I really have a basic question: In the documentation for a resource, I can see this
    import pulumi
    import pulumi_aws as aws
    
    main = aws.ec2.Subnet("main",
        vpc_id=aws_vpc["main"]["id"],
        cidr_block="10.0.1.0/24",
        tags={
            "Name": "Main",
        })
    Unfortunately specify the name of the resource does not work in my case, what Do I miss?
    #Create VPC
    vpc = aws.ec2.Vpc("vpc_1", 
                        cidr_block="10.0.1.0/24", 
                        )       
    
    vpc = aws.ec2.Vpc("vpc_2", 
                        cidr_block="10.0.2.0/24", 
                        )       
    
        #create WANem subnet
    subnet_vpc1 = aws.ec2.Subnet("vpc_1",
        vpc_id=vpc["vpc_1"].id,
        cidr_block="10.0.1.0/24",
        availability_zone=available.names[0],
        )
    
        #create WANem subnet
    subnet_vpc2 = aws.ec2.Subnet("vpc_2",
        vpc_id=vpc["vpc_2"].id,
        cidr_block="10.0.2.0/24",
        availability_zone=available.names[0],
        )
    My goal is to reference the VPC by the name, not by object. How can I do this?
    p
    • 2
    • 16
  • i

    important-magician-41327

    11/23/2021, 7:51 AM
    Dear experts! I really like Pulumi for my use-case. However I miss an important Terraform Provider (https://github.com/adeleporte/terraform-provider-velocloud), which is not available for Pulumi. Question: What is the best practice to “import” the Terraform provider into Pulumi? Since the provider is developed in Go, maybe there is a “tool” to use it with Pulumi??
    m
    • 2
    • 3
  • b

    bulky-policeman-29913

    11/24/2021, 4:16 PM
    Hello I have a lambda written in python I am trying to deploy that was originally written in Serverless framework. There was a plugin that did a few things for me 1) Dockerized pip cause I am on a Mac and therefore dependency differences if deployed to lambda would cause issues and 2) ran pip to install dependencies 3) bundled dependencies with my code. I am trying to figure out how to accomplish this with pulumi now and not finding a lot of assistance. Can anyone provide some clarity?
    s
    • 2
    • 17
  • b

    bulky-policeman-29913

    11/24/2021, 4:18 PM
    In theory it shouldnt matter but I am doing infra code in typescript trying to deploy python logic
  • n

    nutritious-shampoo-16116

    11/25/2021, 3:09 PM
    hello friends, after a while I started to see again random error failure in tests:
    RuntimeError: Task <Task pending name='Task-63' coro=<run_pulumi_func() running at /home/$USER/.local/share/virtualenvs/cmw2Vtk-i/lib/python3.9/site-packages/pulumi/runtime/stack.py:45> cb=[_run_until_complete_cb() at /usr/lib/python3.9/asyncio/base_events.py:184]> got Future <Task pending name='Task-760' coro=<get_resource.<locals>.do_get() running at /home/$USER/.local/share/virtualenvs/cmw2Vtk-i/lib/python3.9/site-packages/pulumi/runtime/resource.py:231> cb=[<TaskWakeupMethWrapper object at 0x7f8f73b7fdc0>()]> attached to a different loop
    any idea?
    r
    • 2
    • 2
  • n

    nutritious-shampoo-16116

    11/25/2021, 3:11 PM
    these are totally random failures, sometimes tests pass, sometimes 1 fail, sometimes all
  • n

    nutritious-shampoo-16116

    11/25/2021, 3:38 PM
    this is the errors I get:
    self = <pulumi.runtime.mocks.MockMonitor object at 0x7f0727a5ee80>
    request = tok: "pulumi:pulumi:getResource"
    args {
      fields {
        key: "urn"
        value {
          string_value: "urn:pulumi:dev::totoro::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::dvusea1-totoro-priv-route-table"
        }
      }
    }
    
    
        def Invoke(self, request):
            # Ensure we have an event loop on this thread because it's needed when deserializing resource references.
            _ensure_event_loop()
        
            args = rpc.deserialize_properties(request.args)
        
            if request.tok == "pulumi:pulumi:getResource":
                registered_resource = self.resources.get(args["urn"])
                if registered_resource is None:
    >               raise Exception(f"unknown resource {args['urn']}")
    E               Exception: unknown resource urn:pulumi:dev::totoro::aws:ec2/vpc:Vpc$aws:ec2/routeTable:RouteTable::dvusea1-totoro-priv-route-table
    this the exception I am seeing
  • n

    nutritious-shampoo-16116

    11/25/2021, 3:40 PM
    a mix of both errors
    f
    • 2
    • 3
Powered by Linen
Title
n

nutritious-shampoo-16116

11/25/2021, 3:40 PM
a mix of both errors
f

freezing-van-87649

11/25/2021, 4:59 PM
I think you’ve got an async test that’s being executed synchronously. Sometime the async call happens to complete, sometimes it doesn’t, which explains the flakiness
n

nutritious-shampoo-16116

11/25/2021, 5:12 PM
I do not have any coroutines in my tests, all of them are wrapped with pulumi.runtime.tests would it be still the case?
also, the funny thing it seems it fails always on the same missing resource, a private route table
View count: 1