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

    little-river-49422

    03/04/2019, 8:40 PM
    I could create a github issue*, just not yet sure how to isolate this and if this is reproduceable. does this look reasonable or not
  • i

    incalculable-sundown-82514

    03/04/2019, 8:40 PM
    oh, that’s not good - can you open an issue on github.com/pulumi/pulumi-azure?
  • l

    little-river-49422

    03/05/2019, 2:09 PM
    i'll try and see if i can repro first
  • l

    little-river-49422

    03/05/2019, 2:43 PM
    created: https://github.com/pulumi/pulumi/issues/2511
  • l

    lemon-wall-81522

    03/07/2019, 11:49 PM
    I’m wondering why this consistently fails the first time and succeeds the second time (update instead of create, but still):
    ➜ cat __main__.py
    from pulumi_aws import ec2, s3
    
    vpc = ec2.Vpc('new-vpc', cidr_block = '10.0.0.0/16'),
    bucket = s3.Bucket('new-bucket',
            tags = {'Name': 'infra bucket (front-back-multi-az)', 'Creator': 'timc'})
  • l

    lemon-wall-81522

    03/07/2019, 11:49 PM
    ➜ pulumi up -y
    [. . .]
    Updating (dev):
    
         Type                 Name                             Status                  Info
     +   pulumi:pulumi:Stack  possible-bug_s3_bucket-name-dev  created
     +   ├─ aws:ec2:Vpc       new-vpc                          created
     +   └─ aws:s3:Bucket     new-bucket                       **creating failed**     1 error
    
    Diagnostics:
      aws:s3:Bucket (new-bucket):
        error: Plan apply failed: 1 error occurred:
    
        * creating urn:pulumi:dev::possible-bug_s3_bucket-name::aws:s3/bucket:Bucket::new-bucket: "new-bucket-c0ce544": InvalidTag: The TagValue you have provided is invalid
        	status code: 400, request id: FE884245AFE0DA9D, host id: 0kjicYJx4hqgZNeKyM62RTJ1PrlKL1SGiYkC9eSF09SWa40+r2ExFgm30OIsRm4wqbtyyVS5gkQ=
  • l

    lemon-wall-81522

    03/07/2019, 11:49 PM
    ➜ pulumi up -y
    [. . .]
    Updating (dev):
    
         Type                 Name                             Status
         pulumi:pulumi:Stack  possible-bug_s3_bucket-name-dev
     ~   └─ aws:s3:Bucket     new-bucket                       updated
    
    Resources:
        ~ 1 updated
        2 unchanged
  • l

    lemon-wall-81522

    03/08/2019, 5:05 PM
    Solved. The parens in the
    Name
    tag are invalid, at least in some contexts. They’re allowed on EC2 tag names, for example. Still odd that Pulumi marks the bucket as updated. It also doesn’t add the tag. https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html
  • g

    gentle-diamond-70147

    03/08/2019, 5:19 PM
    The parens within the tag value -
    (front-back-multi-az)
    ?
    l
    • 2
    • 5
  • p

    proud-artist-4864

    03/10/2019, 4:16 AM
    Question about exposing resources that are created inside a ComponentResource. I know about register_outputs, but is there a dramatic difference between refering to, for example, a registered output “network.vpc_id” where network is the ComponentResource, versus network.vpc.id where vpc is an object attribute that is an ec2.Vpc?
    i
    • 2
    • 1
  • p

    proud-artist-4864

    03/10/2019, 10:42 AM
    lol, sorry for spamming, but yet another issue with get_x, this time get_route_tables (note plural). I want to add a route to a number of route tables that already exist. So I want to do something like: for t in get_route_tables(vpc_id = vpc.id): ec2.Route(… route_table_id = t.id, … )
  • p

    proud-artist-4864

    03/10/2019, 10:43 AM
    but of course, I can’t iterate over get_route_tables (or if I encapsulate it inside another async def) because it’s a co-routine
    i
    • 2
    • 4
  • l

    little-river-49422

    03/10/2019, 12:26 PM
    hey folks, are you interested in pulumi + aks + flux example\docs article?
    i
    • 2
    • 2
  • l

    lemon-wall-81522

    03/13/2019, 4:41 PM
    I’ve created an AWS launch template, but the autoscaling group can’t find it. Running this script as written fails to create either resource. I had to comment out the
    asg
    configuration, create the launch template separately, then go back and run the whole thing.
    ➜ cat __main__.py
    import pulumi
    
    from pulumi_aws import autoscaling, ec2
    
    lt = ec2.LaunchTemplate('launch-template',
            image_id = 'ami-032509850cf9ee54e',
            instance_type = 't2.micro',
            )
    
    asg = autoscaling.Group('autoscaling-group',
            launch_template = {'name': lt.id},
            min_size = 1,
            max_size = 4,
            )
    
    pulumi.export('launch-template', lt.id),
    pulumi.export('autoscaling group', asg.id),
    After creating it separately, the launch template is available
    ➜ pulumi stack output launch-template
    lt-01a8e3b45e7100203
    But not to the autoscaling group apparently
    ➜ pulumi up -y
    [...]
    
    Updating (dev):
    
         Type                      Name                                                 Status                  Info
         pulumi:pulumi:Stack       possible-bug_asg_launch-template-does-not-exist-dev
     +   └─ aws:autoscaling:Group  autoscaling-group                                    **creating failed**     1 error
    
    Diagnostics:
      aws:autoscaling:Group (autoscaling-group):
        error: Plan apply failed: Error creating AutoScaling Group: ValidationError: The specified launch template, with template name lt-01a8e3b45e7100203, does not exist.
            status code: 400, request id: cd425ae2-45ac-11e9-bd93-5791f9b27b8e
  • a

    alert-monitor-28534

    03/14/2019, 9:31 AM
    Found the right channel for this...
  • l

    little-river-49422

    03/14/2019, 10:07 AM
    apply function?
    a
    w
    • 3
    • 6
  • l

    little-river-49422

    03/14/2019, 10:07 AM
    how do you pass it to output function?
  • p

    proud-artist-4864

    03/15/2019, 3:42 AM
    The way the pulumi engine works from my experience is that Outputs don’t get resolved until the engine is running and are resolved asynchronously. So the only way to get the values is to also have an asynchronous function access the value. I still haven’t worked out how to get my own async function to operate as part of the same async loop as the engine. The “apply” function basically formats an output as yet another output. You can’t get the “value” of that output though to use in a general Python function, it has to be part of the async chain.
  • l

    little-river-49422

    03/15/2019, 1:53 PM
    yeah, but if its a part of the async thing, you can use it:
    async def get_aks_credentials():
        result = await get_kubernetes_cluster(name=gen_name('aks'),
                                              resource_group_name=gen_name('rg')
                                              )
        return result.kube_config_raw
    and I just call get_aks_credentials() as an input to the resource, or in another resource I use apply function to create a string, that string gets passed to a dictionary and that dictionary gets passed to the resource
  • p

    proud-artist-4864

    03/16/2019, 6:35 AM
    yes you can pass outputs to other resources as inputs, but you can’t use outputs outside of that. For example, I want to get a list of subnets to associate a route table to, but I can’t iterate them.
  • p

    proud-artist-4864

    03/16/2019, 6:38 AM
    I must admit, my experience with Python 3 async is limited, so maybe there’s a way to do it easily, but I haven’t found it yet 😄
  • l

    little-river-49422

    03/16/2019, 6:43 AM
    why, like I said I pass output to a dictionary, its being used as one of the values for the dictionary
  • p

    proud-artist-4864

    03/16/2019, 6:47 AM
    Not quite sure I understand 😞
  • p

    proud-artist-4864

    03/16/2019, 6:48 AM
    So if I call get_subnets like this: async def get_my_subnets(subnet_type): result = await ec2.get_subnets(tags={“Type”:subnet_type}) return result.ids
  • p

    proud-artist-4864

    03/16/2019, 6:48 AM
    How do I iterate the result to call ec2.RouteTableAssociation on each ID?
  • p

    proud-artist-4864

    03/16/2019, 6:49 AM
    If it wasn’t async, it’d be: for s in get_my_subnets(“private”): ec2.RouteTableAssociation(subnet_id=s, route_table_id = private.id)
  • p

    proud-artist-4864

    03/16/2019, 6:55 AM
    get_my_subnets returns a coroutine, not an iterable
  • p

    proud-artist-4864

    03/16/2019, 6:58 AM
    If I called apply on results.ids, returning a list of outputs, would that be what you mean?
  • p

    proud-artist-4864

    03/16/2019, 7:06 AM
    or do you mean that instead of returning result.ids, I return: result.ids.apply(lambda l: [s for s in l])
  • l

    little-river-49422

    03/16/2019, 7:38 AM
    not sure with iteration, never tried, but apply function returns a proper string for me, so i do something like:
Powered by Linen
Title
l

little-river-49422

03/16/2019, 7:38 AM
not sure with iteration, never tried, but apply function returns a proper string for me, so i do something like:
View count: 1