https://pulumi.com logo
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

    bright-refrigerator-27211

    03/11/2020, 1:55 PM
    in this case : https://github.com/terraform-providers/terraform-provider-aws/blob/master/website/docs/r/iam_policy.html.markdown
  • n

    nutritious-shampoo-16116

    03/11/2020, 2:10 PM
    oh
  • n

    nutritious-shampoo-16116

    03/11/2020, 2:10 PM
    apparently we have to pass a dict from python
    b
    • 2
    • 1
  • p

    polite-iron-99873

    03/11/2020, 2:39 PM
    Anyone know how to create an iam.RolePolicy that includes an Output from another resource? The following fails because vpc.id is an 'output', and policy requires a 'str'
    policy=
            {
                "Version": "2012-10-17",
                "Statement": [{
                    "Action": [
                        "logs:PutLogEvents",
                        "logs:CreateLogStream",
                        "logs:DescribeLogGroups",
                        "logs:DescribeLogStreams"
                    ],
                    "Effect": "Allow",
                    "Resource": 'arn:aws:logs:us-east-1:xxxxxxxxx:log-group:/aws/vpc/' + vpc.id + '/flows/*'
                }]
            })
    n
    • 2
    • 6
  • b

    bright-refrigerator-27211

    03/11/2020, 10:59 PM
    does someone use stackReference with local backend ?
  • b

    bright-refrigerator-27211

    03/11/2020, 10:59 PM
    it look like all my stack override ~/.pulumi/stacks/dev.json file
  • b

    bright-refrigerator-27211

    03/11/2020, 11:01 PM
    i’am trying to use this : https://github.com/pulumi/examples/tree/master/aws-py-stackreference
    • 1
    • 2
  • e

    echoing-breakfast-73834

    03/12/2020, 3:47 PM
    What design patterns is everybody using for passing things like AWS region to dynamic providers? I'm using boto3 to stand up some resources not covered by the TF provider and need to make sure they're using the right region. Things I've considered: • Set the environment variable boto3 pulls from to set default region (
    AWS_REGION
    ) • Pull from the stack config • Set a global variable • Add a 'region' parameter to every dynamic provider • Extend ResourceOptions, adding a 'region' parameter, and passing it to my provider in my resource constructor Unfortunately all of these are either have a lot of coupling or add a decent amount of boilerplate code to each provider.
  • f

    flat-advantage-89110

    03/12/2020, 7:46 PM
    not sure if this is the right room but I’m having issues getting the postgresql provider working (I’m converting from terraform). I’ve got something like this currently (disclaimer: I don’t know postgres very well) :
    devRole = pulumi_postgresql.role.Role(f'developers-{i}',
                    connection_limit=100,
                    create_database=True,
                    login=True,
                    name=userlist[i],
                    password='password',
                    skip_reassign_owned=True,
                    opts=ResourceOptions(provider=postgresProvider, depends_on=[postgresProvider]))
    running results in a
    PostgreSQL version: dial tcp :5432: connect: connection refused
    So I assumed it was because
    tf2pulumi
    didn’t handle
    provider "postgresql"
    , so I added that and set the provider but I’m still getting the same error. is there somewhere I can find a python example of how to use postgres with pulumi?
  • f

    flat-advantage-89110

    03/12/2020, 7:57 PM
    ^^^ ignore the above, I unblocked myself and made some progress. rather than pass the address from the rds I created I just request the rds instance again and use that address
    g
    • 2
    • 2
  • w

    worried-plastic-45846

    03/13/2020, 4:27 PM
    I have a configuration file in which I want to replace
    <BUCKET>
    with a
    bucket.id
    .
    userScript.replace('<BUCKET_NAME>', bucket.id)
    causes the error
    "Expected type 'str', got 'Output[str]' instead"
    , which makes perfect sense. Could someone please tell me how I can tell Pulumi to execute this replacement only after the bucket resource has been created? (similar to what I usually
    pulumi.Output.concat()
    ).
    • 1
    • 1
  • v

    victorious-helmet-11068

    03/14/2020, 8:36 AM
    hi there. I would like to write an Output to a string. I’m in the “convert Output to str” trip. I’ve seen Output.all, concat and apply but In can’t understand how
  • v

    victorious-helmet-11068

    03/14/2020, 8:36 AM
    I would like to write in a file that output
  • f

    faint-table-42725

    03/14/2020, 5:09 PM
    You’re on the right track with Output.apply — you can pass a function to the apply to write to the file. One thing to be aware of is https://github.com/pulumi/pulumi/issues/3991 — so you’ll probably want to export whatever it is you’re writing to the file so that the program properly waits for the resource.
  • v

    victorious-helmet-11068

    03/14/2020, 5:22 PM
    Thanks @faint-table-42725 I found. Thanks for pointing to me the issue
  • w

    wonderful-plastic-88586

    03/14/2020, 11:41 PM
    Hi All , I am new to Pulumi. I am trying to use python to deploy my infrastructure on AWS. How do I mention resource dependencies . For example , I create a role named myLambdaRole and wanted to refer this role when i deploy my lambda. How do I say that , my lambda is dependent on this role.
    b
    • 2
    • 2
  • f

    famous-salesmen-28835

    03/18/2020, 3:55 AM
    Hi team I have created deb package of my code where I am using all dependency but still I am getting this error
    Previewing update (pulumi-test): 
     
        pulumi:pulumi:Stack pulumi-test-pulumi-test  Traceback (most recent call last): 
        pulumi:pulumi:Stack pulumi-test-pulumi-test    File \"/root/.pulumi/bin/pulumi-language-python-exec\", line 14, in <module> 
        pulumi:pulumi:Stack pulumi-test-pulumi-test      import pulumi 
        pulumi:pulumi:Stack pulumi-test-pulumi-test  ImportError: No module named 'pulumi' 
        pulumi:pulumi:Stack pulumi-test-pulumi-test  It looks like the Pulumi SDK has not been installed. Have you run pip install? 
        pulumi:pulumi:Stack pulumi-test-pulumi-test  If you are running in a virtualenv, you must run pip install -r requirements.txt from inside the virtualenv. 
        pulumi:pulumi:Stack pulumi-test-pulumi-test  error: an unhandled error occurred: Program exited with non-zero exit code: 1 
        pulumi:pulumi:Stack pulumi-test-pulumi-test  1 error; 6 messages 
      
    Diagnostics: 
      pulumi:pulumi:Stack (pulumi-test-pulumi-test): 
        Traceback (most recent call last): 
          File \"/root/.pulumi/bin/pulumi-language-python-exec\", line 14, in <module> 
            import pulumi 
        ImportError: No module named 'pulumi' 
        It looks like the Pulumi SDK has not been installed. Have you run pip install? 
        If you are running in a virtualenv, you must run pip install -r requirements.txt from inside the virtualenv. 
      
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    If I go and check my python env then I am not getting any import error
    root@b43ba04ea07e:/# /opt/ns/python-apps/resourcecreation/app-env/bin/python                                                                                                  
    Python 3.7.4 (default, Sep  2 2019, 20:44:09) 
    [GCC 5.4.0 20160609] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pulumi
    >>>
    In this I am not getting this error but I have created API which will call the CLI so I am executing my code on my machine
    /opt/ns/python-apps/resourcecreation/app-env/bin/python /opt/ns/python-apps/resourcecreation/app-env/lib/python3.7/site-packages/resourcecreation/app.py
    Then I am getting error So Can any one tell me is it any way that while calling pulumi commands I point my python binary instead of taking machine default binary?
  • l

    loud-oyster-36834

    03/18/2020, 1:28 PM
    Hi all, not sure if this is a python sdk specific problem, but my hope is that you have some good input for me on this one. I have wrestled for a while to get my SQL database to scale properly in Azure by change the DTU or pricing tier using the
    requested_service_objective_name
    param with the
    sql.Database
    resource. However, it seems like the
    import_
    param mess things up by try to re-import/create the database again, even if it already exists.
    sql.DatabasesClient#CreateImportOperation: Failure sending request: StatusCode=400 -- Original Error: Code="Failed" Message="The async operation failed." InnerError={"unmarshalError":"json: cannot unmarshal array into Go struct field serviceError2.details of type map[string]interface {}"} AdditionalInfo=[{"code":"0","details":[{"code":"0","message":"There was an error that occurred during this operation : '\u003cstring xmlns=\"<http://schemas.microsoft.com/2003/10/Serialization/>\"\u003eError encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Target database is not empty. The import operation can only be performed on an empty database.; \u003c/string\u003e'","severity":"16","target":null}],"innererror":[],"message":"There was an error that occurred during this operation : '\u003cstring xmlns=\"<http://schemas.microsoft.com/2003/10/Serialization/>\"\u003eError encountered during the service operation. ; Exception Microsoft.SqlServer.Management.Dac.Services.ServiceException:Target database is not empty. The import operation can only be performed on an empty database.; \u003c/string\u003e'","target":null}]
    The change of the price tier and DTU works fine behind the scenes. After refreshing the resources everything works as expected. Am I doing something wrong here, or is there some way of ignoring the import during resource updates?
    database = sql.Database(
            resource_name="my_database",
            name="my_database",
            resource_group_name=resource_group.name,
            server_name=sql_server.name,
            requested_service_objective_name=config.get('database.service_objective') or "S0", 
            import_={
                     "administrator_login":sqlserver_username,
                     "administrator_login_password": sqlserver_random_password.result,
                     "operation_mode":"Import",
                     "authentication_type":"SQL",
                     "storage_key":storage_account_bacpac.primary_access_key,
                     "storage_key_type":"StorageAccessKey",
                     "storage_uri":storage_blob_uri
             })
    My initial thought was to check if the database already exists with
    sql.get_database
    and change the import block based on the result, but that seems like a messy solution?
  • v

    victorious-helmet-11068

    03/20/2020, 2:38 PM
    Hi all. I would like to run test (unit test) or functional ones. I don’t find a lot of articles on that. May you suggest me something?
    b
    w
    t
    • 4
    • 3
  • v

    victorious-helmet-11068

    03/20/2020, 2:38 PM
    specific of pulumi/python
  • e

    enough-oil-63049

    03/23/2020, 3:53 AM
    Hi all. I've contributed the first cut of an Azure example but there was a Travis build error - anything I need to do? https://github.com/pulumi/examples/pull/611
    t
    • 2
    • 2
  • m

    miniature-art-58368

    03/24/2020, 7:59 PM
    I am using aws_python how to I get the ipv6_cidr_block of my vpc and pass it into my ipv6_cidr_block for my Subnet?
    g
    • 2
    • 1
  • b

    billions-ability-33213

    03/27/2020, 5:28 PM
    Hi there! Im struggling for creating same
    iam
    roles that gonna be used for multiple resources (example : group of lambdas that use the same role). The problem is that the lambdas are created in a
    for
    loop . If I put the creation of the iam role inside as
    role.arn
    I get duplicates URN... Any advise/example how I should do this ?
    g
    • 2
    • 6
  • c

    colossal-room-15708

    03/31/2020, 12:06 AM
    Anybody got a good approach to replace terraform's
    cidrsubnet
    in pulumi?
    g
    • 2
    • 1
  • n

    nutritious-shampoo-16116

    03/31/2020, 1:47 PM
    how I can wait explicitly for an output if it's not a straight dependency o a resource? https://gist.github.com/MattBlack85/8fc884341cbc85d9dc0252286fb3c938 at line 37 I need the elastic IP value that I have to inject into the instance init script
    f
    • 2
    • 1
  • n

    nutritious-shampoo-16116

    03/31/2020, 1:48 PM
    but the only thing I get is a rendered
    aws ec2 associate-address --instance-id $INSTANCE_ID --allocation-id <pulumi.output.Output object at 0x7f9fb51fd700>\n--==BOUNDARY==--\n"
  • c

    colossal-room-15708

    03/31/2020, 11:00 PM
    What's the best way to achieve this
    for
    loop here?
    vnet = network.VirtualNetwork('ssvc-vnet',
      resource_group_name=resource_group.name,
      name="ssvc-vnet-{0}".format(stack_name),
      address_spaces=[ssvc_vnet_space],
      subnets= [
        for subnet in subnet_config:
          {
            name=subnet[0],
            address_prefix=subnet[1],
            virtual_network_name=vnet.name
          )
          },
      ]
    )
    It's syntactically incorrect, so I'm wondering what the best way to get this done anyways might be.
    n
    • 2
    • 4
  • n

    nutritious-shampoo-16116

    04/01/2020, 10:46 AM
    is there any way to get the AWS region out of pulumi.Config()
  • n

    nutritious-shampoo-16116

    04/01/2020, 10:46 AM
    ?
  • n

    nutritious-shampoo-16116

    04/01/2020, 10:49 AM
    config.get('aws:region') does not work
Powered by Linen
Title
n

nutritious-shampoo-16116

04/01/2020, 10:49 AM
config.get('aws:region') does not work
View count: 1