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

    bitter-oil-46081

    08/01/2019, 8:39 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
    We do not support this today, It is something we'd like to look into in a few months: https://github.com/pulumi/pulumi/issues/2287
  • b

    bitter-oil-46081

    08/01/2019, 8:39 PM
    Internally, we do the same subprocess dance you would do.
  • b

    brief-apartment-69928

    08/01/2019, 10:32 PM
    Thanks Matt .
  • b

    brief-apartment-69928

    08/01/2019, 10:35 PM
    I am trying to get project details
    def get_project(self):
            return gcp.organizations.get_project(project_id=self.project_name)
  • b

    brief-apartment-69928

    08/01/2019, 10:35 PM
    i get this warning
    Diagnostics:
      pulumi:pulumi:Stack (project-factory-prod):
        <coroutine object get_project at 0x7f761ffaf448>
    
        ./__main__.py:61: RuntimeWarning: coroutine 'get_project' was never awaited
          a.prj_create()
        RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    b
    h
    • 3
    • 13
  • h

    high-translator-22614

    08/06/2019, 4:59 PM
    fyi, if you're suddenly having problems with
    get*()
    functions after upgrading, burried in the changelog is "Make
    pulumi.runtime.invoke
    synchronous.", which is Pulumi coredev speak for "data sources now block and return actual values"
    w
    • 2
    • 2
  • m

    microscopic-florist-22719

    08/06/2019, 5:54 PM
    Just to make sure this also ends up in the channel:
    note that we are doing this in a non-breaking way so that data sources can be used either synchronously or asynchronously.
  • m

    microscopic-florist-22719

    08/06/2019, 5:54 PM
    Please let us know if you see breakage! We have tested the core functionality on Python 3.6 and 3.7.
  • h

    high-translator-22614

    08/06/2019, 5:54 PM
    funny you should say that...
    m
    • 2
    • 35
  • w

    white-jewelry-95626

    08/07/2019, 9:12 AM
    Hi, I am trying to create a private hosted zone, I have created a vpc as => vpc1 = ec2.Vpc(resource_name='vpc', cidr_block='24.0.0.0/16', enable_dns_hostnames=True, enable_dns_support=True, tags={'Name': 'development-igw', 'Environment': 'development'})
  • w

    white-jewelry-95626

    08/07/2019, 9:12 AM
    and then creating private_zone = route53.Zone(resource_name='development-eu-west-2.example.co.uk', tags={'Environment': 'developmenmt'}, vpcs = [vpc1])
  • w

    white-jewelry-95626

    08/07/2019, 9:12 AM
    but I keep getting aws:route53/zone:Zone resource 'development-eu-west-2.example.co.uk' has a problem: vpc.0: expected object, got string
  • w

    white-jewelry-95626

    08/07/2019, 9:13 AM
    anyone know where I am going wrong with this
  • h

    high-translator-22614

    08/07/2019, 2:04 PM
    because looking at https://www.pulumi.com/docs/reference/pkg/python/pulumi_aws/route53/#pulumi_aws.route53.Zone and following to https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/route53_zone.html.markdown#private-zone it's not expecting a list of VPC objects, it's expecting a list of VPC configuration blocks (dicts)
  • w

    white-jewelry-95626

    08/07/2019, 2:17 PM
    Thank you so much
  • w

    white-jewelry-95626

    08/07/2019, 2:17 PM
    That worked
  • s

    straight-doctor-43078

    08/19/2019, 12:50 PM
    Hello all. I went through the tutorial about adopting existing resources with Pulumi, but it is only for TS. I am totally lost how to do the same with Python. Did anybody tried to import of already deployed resources using Python? I would appreciate a help with some stupid example like
    # Resource group
    resource_group = core.ResourceGroup(...)
    Thank you in advance!
  • s

    straight-doctor-43078

    08/19/2019, 2:24 PM
    Looks like I have finally found the way:
    import pulumi
    from pulumi import ResourceOptions
    from pulumi_azure import core
    
    # Resource group
    resource_group = core.ResourceGroup("rg", name="Existing-RG", location="West US", opts=ResourceOptions(import_="/subscriptions/foo123-456-789-012/resourceGroups/Existing-RG"))
    May I ask still somebody more experienced to check it and tell me, I am not doing it wrong? Thank you
  • h

    high-translator-22614

    08/19/2019, 3:02 PM
    looking through the https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/ , that looks right
  • h

    high-translator-22614

    08/19/2019, 3:03 PM
    JS/TS's
    new Resource(name, args, opts)
    becomes Python's
    Resource(name, **args, opts=ResourceOptions(**opts))
  • s

    straight-doctor-43078

    08/19/2019, 3:41 PM
    Thank you very much for double checking. I really apreciate it, because I was using just Terraform up to this date and my knowledge of either Pulumi and Python is quite limited (I am just experimenting)
  • h

    high-translator-22614

    08/19/2019, 3:42 PM
    good luck!
  • h

    high-translator-22614

    08/19/2019, 8:22 PM
    hm, have an idea for how to tackle the "python closures" problem in a way that handles packaging, dependencies, and resources alright, without having to do things like "serialize bytecode or ASTs"
  • h

    high-translator-22614

    08/19/2019, 8:23 PM
    i'll have to write it up later
  • h

    high-translator-22614

    08/23/2019, 3:18 PM
    hey, how many people are doing lambda-type stuff with pulumi+python?
  • h

    high-translator-22614

    08/23/2019, 3:20 PM
    I'm writing a library (it's like, half feature complete, because MVPs yo) that does the build inside pulumi and at least interfaces with AWS
    • 1
    • 1
  • h

    high-translator-22614

    08/23/2019, 3:20 PM
    and i'm curious if anyone else would make use of it or would collaborate on it
    n
    • 2
    • 3
  • l

    little-river-49422

    09/06/2019, 5:06 PM
    heya folks, i'm trying out pulumi 1.0 and it appears it still doesnt report proper errors on windows? python 3.6.8
    g
    • 2
    • 5
  • l

    little-river-49422

    09/06/2019, 5:18 PM
    mhm, trying to update pulumi modules to latest doesnt work on windows 10: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 452: character maps to <undefined> (this is for pulumi azure)
    • 1
    • 3
  • c

    colossal-room-15708

    09/08/2019, 4:52 AM
    Trying to build a full demo of a containerised app. Does the python library not support building docker images yet? Seems like it can only work with existing images at the moment, but not build new ones.
    h
    w
    • 3
    • 13
Powered by Linen
Title
c

colossal-room-15708

09/08/2019, 4:52 AM
Trying to build a full demo of a containerised app. Does the python library not support building docker images yet? Seems like it can only work with existing images at the moment, but not build new ones.
h

high-translator-22614

09/09/2019, 5:11 PM
no,
pulumi_docker
does not exist for Python yet
oh, nvm, i see it in PyPI and github, but not pulumi's website
imho, don't do that anyway? Pulumi isn't meant to be a general-purpose build tool? idk, I'm doing a similar thing with lambda packages, so 🤷
🤔
now you got me wondering about that
because in my ideal world, I would have a bunch of stuff built by various pipelines and then pulled in and tied together by pulumi, but wooph that sounds like a mountain of work
also, my lambda stuff integrates with pulumi (passes resources into it, and some codegen), so what i just described is only sorta possible
c

colossal-room-15708

09/09/2019, 8:46 PM
Yeah, which is why I was wondering if I could use pulumi. It's in the TS library, but not in python yet it seems. @white-balloon-205 any idea when this might change?
w

white-balloon-205

09/09/2019, 10:21 PM
We are considering re-writing the
docker.Image
component to be a native component so that it can more easily fit into deployment lifecycle (a few of the issues in that repro are blocked on doing this before we can address them properly). Doing so would also make this available in Python. But this library is also just some convenience wrappers - you can do the same yourself if you want for targeted use cases - or port some/all of the existing library there to Python. So definitely these same scenarios are possible in Python as well - and we hope to have the exact same libraries also available in the future.
c

colossal-room-15708

09/09/2019, 10:42 PM
Cool, this is for a conference demo, I assume I can just call the docker binary from python to build and push the image inline with the rest of the code.
This wouldn't be a managed pulumi resource then, right?
w

white-balloon-205

09/09/2019, 10:51 PM
In
docker.Image
it is done inside a resource, but you don’t really have to. You could just have a function which invokes
docker build
and conditionally
docker push
only when not in preview.
c

colossal-room-15708

09/09/2019, 10:55 PM
👍 thanks Luke. What I expected.
View count: 1