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

    incalculable-sundown-82514

    10/23/2018, 6:35 PM
    I can’t say for sure whether or not we’ll be able to deliver by that date, but it is currently on my plate and I’m trying to find the time to tackle it now.
  • i

    incalculable-sundown-82514

    10/23/2018, 6:36 PM
    The task is a little daunting since it’s looking like it may be a near-total rewrite of the Python SDK to bring it to idiomatic Python 3.6+.
  • m

    many-twilight-55994

    10/24/2018, 8:40 PM
    I figured it was a big task and I have plenty of other things I can do in the meantime. I was just curious if it was going to occur at some point more than anything. I'm really looking forward to being able to use it since Python 3 is my go to language. I'll be keeping a close eye on the progress!
  • e

    early-musician-41645

    10/24/2018, 10:44 PM
    Hi folks, x-posting here: when doing a
    pulumi new
    I get this eror:
    $ pulumi new aws-python --dir vnext-cluster-poc
    This command will walk you through creating a new Pulumi project.
    
    Enter a value or leave blank to accept the default, and press <ENTER>.
    Press ^C at any time to quit.
    project name: (vnext-cluster-poc)
    project description: (A minimal AWS Python Pulumi program)
    Created project 'vnext-cluster-poc'.
    stack name: (vnext-cluster-poc-dev)
    Created stack 'vnext-cluster-poc-dev'
    aws:region: The AWS region to deploy into: (us-east-1) us-west-2
    Installing dependencies...
    Your new project is configured and ready to go!
    Previewing update (vnext-cluster-poc-dev):
    
         Type                     Name                                     Plan       Info
     +   pulumi:pulumi:Stack      vnext-cluster-poc-vnext-cluster-poc-dev  create
         └─ pulumi:providers:aws  default                                             1 error
    
    Diagnostics:
      pulumi:providers:aws (default):
        error: no resource plugin 'aws' found in the workspace or on your $PATH
    
    error: an error occurred while advancing the preview
    What's up with that? What am I missing?
  • e

    early-musician-41645

    10/24/2018, 10:47 PM
    also errors on this:
    $ pulumi stack init vnext-poc
    error: could not create stack: error determining initial tags: open /home/tsi.lan: permission denied
  • e

    early-musician-41645

    10/24/2018, 10:51 PM
    Got past that error by updating permissions, but still seeing this:
    error: no resource plugin 'aws' found in the workspace or on your $PATH
    i
    • 2
    • 1
  • i

    incalculable-sundown-82514

    10/24/2018, 11:41 PM
    @early-musician-41645 did that get you unblocked?
  • e

    early-musician-41645

    10/25/2018, 4:45 PM
    I did, thanks!
  • e

    early-musician-41645

    10/25/2018, 4:46 PM
    New question: Where can I find the full python reference for pulumi-aws. E.g. how do I use the s3.BucketObject?
    b
    • 2
    • 5
  • i

    incalculable-sundown-82514

    10/25/2018, 4:47 PM
    Unfortunately we don’t have any website-based documentation for our Python packages yet, but we do have some examples in this repo: https://github.com/pulumi/examples
  • i

    incalculable-sundown-82514

    10/25/2018, 4:48 PM
    In general though our Python code will closely mirror our TypeScript code, so you can use the docs like this to see the general shapes of types: https://pulumi.io/reference/pkg/nodejs/@pulumi/aws/s3/#BucketObject
  • i

    incalculable-sundown-82514

    10/25/2018, 4:49 PM
    In particular here’s an example that creates an EC2 instance - you can create s3 BucketObjects in pretty much the same way https://github.com/pulumi/examples/blob/master/aws-py-webserver/__main__.py
  • e

    early-musician-41645

    10/25/2018, 4:51 PM
    this is failing:
    bucketObject = s3.BucketObject("some/foo/path/my-bucket-object", { bucket: bucket.bucket, content: "hello foo world" })
    bucketObject = s3.BucketObject("some/foo/path/my-bucket-object", { bucket: bucket.bucket, content: "hello foo world" })
        NameError: name 'content' is not defined
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    I'm just looking for the actual arguments that go in the constructor. The doc you posted says this:
    new BucketObject(name: string, args: BucketObjectArgs, opts?: pulumi.CustomResourceOptions)
    Create a BucketObject resource with the given unique name, arguments, and options.
    
    name The unique name of the resource.
    args The arguments to use to populate this resource's properties.
    opts A bag of options that control this resource's behavior.
    But I'm not sure what the args or opts are supposed to be
  • e

    early-musician-41645

    10/25/2018, 4:52 PM
    Specifically, the
    BucketObjectArgs
    says it has this field:
    property content 
    content?: pulumi.Input<string>;
  • e

    early-musician-41645

    10/25/2018, 4:52 PM
    So why the error about "content" not being defined?
  • i

    incalculable-sundown-82514

    10/25/2018, 4:54 PM
    Python dictionaries don’t have the same syntax as JavaScript ones - you can’t use bare identifiers as keys in Python maps. In this case, though, we generally project property bags like this one as keyword arguments in Python - if you look at the aws-py-webserver example, you can see that we’re passing property arguments as keyword arguments to resource constructors (like
    ec2.Instance
    )
  • i

    incalculable-sundown-82514

    10/25/2018, 4:55 PM
    (well, you can use bare identifiers, but they are parsed as variable references and not literals)
  • e

    early-musician-41645

    10/25/2018, 4:58 PM
    ah, yeah, my syntax was off, thanks! this works:
    bucketObject = s3.BucketObject("some/foo/path/my-bucket-object",
      bucket=bucket.bucket,
      content="hello foo world")
  • e

    early-musician-41645

    10/25/2018, 5:01 PM
    Another question: Is there a reference to best practice for how to structure pulumi code? E.g. My team runs several (dozens) environments, e.g. 30 sandbox environments for various feature teams, a few staging environments, a dozen production envs. In Terraform I have two top-level folders for
    modules
    and
    environments
    , and then I put everything environment-specific into a
    terraform.tfvars
    , and I write lots of modules such as
    eks-cluster
    ,
    eks-workers
    ,
    auth-map
    , etc.
  • e

    early-musician-41645

    10/25/2018, 5:01 PM
    Is there some structure that works well for pulumi for this use case?
  • e

    early-musician-41645

    10/25/2018, 5:01 PM
    Or maybe some feature that I'm unaware of?
    • 1
    • 1
  • e

    early-musician-41645

    10/25/2018, 5:04 PM
    @big-piano-35669 this is one use case we discussed re: Tableau's PoC
  • i

    incalculable-sundown-82514

    10/25/2018, 5:45 PM
    Hey, sorry, I was just in a meeting
  • i

    incalculable-sundown-82514

    10/25/2018, 5:46 PM
    We use what we call “component resources” pretty heavily for this sort of thing. You can write normal Python modules that export classes that inherit from
    pulumi.ComponentResource
    and in the
    __init__
    of that class, you can create other resources. Sort of like this: https://github.com/pulumi/pulumi-aws-infra/blob/0f78af2ecd231e10dcc63f46ca07b8fa972ac6b1/python/pulumi_aws_infra/network.py#L25
  • i

    incalculable-sundown-82514

    10/25/2018, 5:47 PM
    We use these pretty heavily - it’s a great way to group things into reusable modules in the same manner as Terraform modules, but it’s all encapsulated in code and can be shared using normal Python module semantics
  • i

    incalculable-sundown-82514

    10/25/2018, 5:47 PM
    (e.g. import)
  • i

    incalculable-sundown-82514

    10/25/2018, 7:00 PM
    Hi all! We’ve decided today that the next version of the Pulumi Python SDK is going to be Python 3 only. We’ll be heavily upgrading the existing SDK over the next few weeks. The current minimum version that we’re thinking about is Python 3.6. If you don’t like that, please let me know (DM me or @ me). I’ll be tracking the Python 3 effort with this issue: https://github.com/pulumi/pulumi/issues/1535. It is currently not up-to-date but I will bring it up to date by the end of the day today.
    👍 1
  • e

    early-musician-41645

    10/25/2018, 7:03 PM
    What's wrong with this syntax?
    eks_cluster_security_group = ec2.SecurityGroup(environment+"-eks-cluster-sg",
        description="EKS cluster communication with worker nodes"
        egress=[
            { 'protocol': '-1', 'from_port': 0, 'to_port': 0, 'cidr_blocks': ['0.0.0.0/0'] }
        ])
    File "/home/tsi.lan/eshamay/git/mustang/sdp-mustang-terraform/pulumi/vnext-poc/__main__.py", line 33
            egress=[
                 ^
        SyntaxError: invalid syntax
    i
    • 2
    • 5
  • e

    early-musician-41645

    10/25/2018, 7:13 PM
    Are there any examples for using
    eks.Cluster
    ?
  • e

    early-musician-41645

    10/25/2018, 7:13 PM
    specifically, I'm looking for how to do the vpc_config args
Powered by Linen
Title
e

early-musician-41645

10/25/2018, 7:13 PM
specifically, I'm looking for how to do the vpc_config args
View count: 1