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

    nutritious-shampoo-16116

    11/17/2020, 9:46 AM
    is there anybody using pytest as a test framework? anybody who is mocking stack references also? would love to have some discussion about those, we have big issues with stack references in tests as PulumiMock doesn't seem to work with it
    👍 1
  • n

    nutritious-shampoo-16116

    11/17/2020, 11:16 AM
    I made a repo with an example of what failure we have on stackreference => https://github.com/MattBlack85/pulumi_pytest any hint on this would be very much appreciated
  • p

    powerful-art-3002

    11/20/2020, 2:07 PM
    #aws how to create new stage/update old after update api gw?
    s
    b
    • 3
    • 14
  • d

    dry-engine-17210

    11/20/2020, 6:48 PM
    Hello! Newcomer to Pulumi and running into a snag. I'm running...
    pubsub_topic = pubsub.Topic(
        "{}-topic".format(PUBSUB_TOPIC_PREFIX)
    )
    and...
    logging_sink = logging.ProjectSink(
        resource_name="{}-sink".format(LOGGING_SINK_PREFIX),
        destination="<http://pubsub.googleapis.com/{}|pubsub.googleapis.com/{}>".format(pubsub_topic.id),
        filter='LOG_ID("<http://cloudaudit.googleapis.com/activity|cloudaudit.googleapis.com/activity>") OR LOG_ID("<http://externalaudit.googleapis.com/activity|externalaudit.googleapis.com/activity>") OR LOG_ID("<http://cloudaudit.googleapis.com/system_event|cloudaudit.googleapis.com/system_event>") OR LOG_ID("<http://externalaudit.googleapis.com/system_event|externalaudit.googleapis.com/system_event>") OR LOG_ID("<http://cloudaudit.googleapis.com/access_transparency|cloudaudit.googleapis.com/access_transparency>") OR LOG_ID("<http://externalaudit.googleapis.com/access_transparency|externalaudit.googleapis.com/access_transparency>")',
        opts=ResourceOptions(
                depends_on=[pubsub_topic]
            ),
    )
    Pulumi fails with:
    gcp:logging:ProjectSink (dev-sink):
        error: 1 error occurred:
            * googleapi: Error 400: Cloud Pub/Sub URL is missing projects/[PROJECT_ID], badRequest
    When I look at "details" view, I see this:
    pulumi:pulumi:Stack: (same)
        [urn=urn:pulumi:dev::infrastructure::pulumi:pulumi:Stack::infrastructure-dev]
        + gcp:logging/projectSink:ProjectSink: (create)
            [urn=urn:pulumi:dev::infrastructure::gcp:logging/projectSink:ProjectSink::dev-sink]
            [provider=urn:pulumi:dev::infrastructure::pulumi:providers:gcp::default_4_3_0::4d0f3a00-dc97-4725-b036-499ca6b7f522]
            destination         : "<http://pubsub.googleapis.com/<pulumi.output.Output|pubsub.googleapis.com/<pulumi.output.Output> object at 0x112b44640>"
            filter              : "LOG_ID(\"<http://cloudaudit.googleapis.com/activity\|cloudaudit.googleapis.com/activity\>") OR LOG_ID(\"<http://externalaudit.googleapis.com/activity\|externalaudit.googleapis.com/activity\>") OR LOG_ID(\"<http://cloudaudit.googleapis.com/system_event\|cloudaudit.googleapis.com/system_event\>") OR LOG_ID(\"<http://externalaudit.googleapis.com/system_event\|externalaudit.googleapis.com/system_event\>") OR LOG_ID(\"<http://cloudaudit.googleapis.com/access_transparency\|cloudaudit.googleapis.com/access_transparency\>") OR LOG_ID(\"<http://externalaudit.googleapis.com/access_transparency\|externalaudit.googleapis.com/access_transparency\>")"
            name                : "dev-sink-bf1e116"
            uniqueWriterIdentity: false
    When I see
    <pulumi.output.Output object at 0x112b44640>
    in the
    destination
    , it makes me think Pulumi hasn't deserialized the actual name, or there is some deferred evaluation that isn't happening? Any suggestions on how to troubleshoot?
  • d

    dry-engine-17210

    11/20/2020, 8:02 PM
    Wow, wondering if I have fallen into this pit of despair.
  • d

    dry-engine-17210

    11/20/2020, 8:39 PM
    Welp, this seemed to do the trick.
    pubsub_topic = pubsub.Topic(
        "{}-topic".format(PUBSUB_TOPIC_PREFIX)
    )
    
    pubsub_topic_url = pubsub_topic.id.apply(
        lambda id: "<http://pubsub.googleapis.com/|pubsub.googleapis.com/>" + id
    )
    
    logging_sink = logging.ProjectSink(
        resource_name="{}-sink".format(LOGGING_SINK_PREFIX),
        destination=pubsub_topic_url,
        filter='LOG_ID("<http://cloudaudit.googleapis.com/activity|cloudaudit.googleapis.com/activity>") OR LOG_ID("<http://externalaudit.googleapis.com/activity|externalaudit.googleapis.com/activity>") OR LOG_ID("<http://cloudaudit.googleapis.com/system_event|cloudaudit.googleapis.com/system_event>") OR LOG_ID("<http://externalaudit.googleapis.com/system_event|externalaudit.googleapis.com/system_event>") OR LOG_ID("<http://cloudaudit.googleapis.com/access_transparency|cloudaudit.googleapis.com/access_transparency>") OR LOG_ID("<http://externalaudit.googleapis.com/access_transparency|externalaudit.googleapis.com/access_transparency>")'
    )
  • d

    dry-engine-17210

    11/20/2020, 8:40 PM
    https://www.pulumi.com/docs/intro/concepts/programming-model/#apply basically
  • d

    dry-engine-17210

    11/20/2020, 8:40 PM
    TiL....
  • s

    salmon-honey-75627

    11/22/2020, 9:33 PM
    are there any examples or references to making a custom lambda layer with pulumi?
    b
    • 2
    • 1
  • s

    salmon-honey-75627

    11/22/2020, 9:33 PM
    it doesn’t have to be python
  • s

    salmon-honey-75627

    11/22/2020, 9:33 PM
    i just want to install a requirements.txt
  • b

    better-actor-92669

    11/24/2020, 5:13 PM
    Hello. I use pulumi_gcp and examples below are going to be GCP related. I want to add a dns record with a value of some instance's IP address. If target instance has already been created, the reference below works perfectly (I use a list of instance objects):
    #         rrdatas=[
    #           dbs_instance_pulumi_objects[item].
    #           network_interfaces[0]['networkIp'],
    #         ],
    But when you initiate the stack for the first time in a new project and all instances are yet to be created alongside DNS records, 
    networkInterfaces
     only contains this
    networkInterfaces     : [
                [0]: {
                    subnetwork: output<string>
                }
            ]
    When some instance is finally created, it becomes
    networkInterfaces
    [
      {
        "accessConfigs": [],
        "aliasIpRanges": [],
        "name": "nic0",
        "network": "<https://www.googleapis.com/compute/v1/projects/some-project/global/networks/vpc-network-default-b803ef2>",
        "networkIp": "10.122.0.3",
        "subnetwork": "<https://www.googleapis.com/compute/v1/projects/some-project/regions/europe-west1/subnetworks/vpc-subnetwork-default-bab788a>",
        "subnetworkProject": "some-subnetwork"
      }
    ]
    How can I ask pulumi to wait for the value, even though the key is not present yet? Or how should I reference it properly?
    w
    • 2
    • 6
  • b

    bitter-policeman-94135

    11/27/2020, 7:33 PM
    Hi Folks, I'm trying to use the provisioners example here, but I'm getting this error:
    Diagnostics:
      pulumi:providers:pulumi-python (default):
        error: no resource plugin 'pulumi-python' found in the workspace or on your $PATH
    Try as I might, I can't find a plugin named
    pulumi-python
    . Do any of you have any insight?
  • b

    bitter-policeman-94135

    11/27/2020, 7:52 PM
    From what I can tell, the provisioners inherit from
    dynamic.ResourceProvider
    :
    class ProvisionerProvider(dynamic.ResourceProvider):
    Then in that class's initializer it tries to initialize
    pulumi-python
    (dynamic.py:256):
    super(Resource, self).__init__("pulumi-python:dynamic:Resource", name, props, opts)
  • b

    bitter-policeman-94135

    11/27/2020, 9:27 PM
    Ok, I figured it out. My pulumi install directory wasn't in the PATH. Only the binary
    pulumi
    .
  • b

    bitter-policeman-94135

    11/27/2020, 9:27 PM
    Wow, that was hard to track down.
  • b

    bitter-policeman-94135

    11/27/2020, 9:28 PM
    It was totally my fault for assuming that all I needed was the binary
    pulumi
    . That serves me right for not following directions exactly.
  • w

    worried-queen-62794

    12/10/2020, 9:47 PM
    Once a resource has been renamed is it necessary to keep the Alias around?
    g
    • 2
    • 1
  • f

    fierce-ability-58936

    12/10/2020, 10:28 PM
    Tried to ask in #general but nobody answered. Maybe because it’s Python-specific. https://pulumi-community.slack.com/archives/C84L4E3N1/p1607374013212500 So what does “register_outputs()” actually do? I would expect it to create Output properties with the dict content. Sorry, not really clear in the docs.
    g
    r
    • 3
    • 4
  • s

    sticky-salesmen-55696

    12/15/2020, 6:28 PM
    How do we provide access to EKS cluster to a group using python?
  • p

    purple-arm-63328

    12/15/2020, 9:48 PM
    Have you guys considered having a sort of
    star_apply
    besides
    apply
    in
    Output
    ? It would work like this:
    pulumi.Output.all(a, b, c).star_apply(lambda x, y, z: ...)
    Otherwise, the lambda function must receive one argument and use it like a sequence. Any thoughts?
  • s

    shy-football-10348

    12/15/2020, 11:38 PM
    is it possible to create an empty folder in an s3 bucket with pulumi
    b
    p
    f
    • 4
    • 3
  • j

    jolly-camera-35709

    12/17/2020, 5:53 AM
    hey guys, how do you base64 encode a string for azure vm custom data?
  • j

    jolly-camera-35709

    12/17/2020, 5:54 AM
    I tried this but got error
  • j

    jolly-camera-35709

    12/17/2020, 5:54 AM
    custom_data=base64.b64encode("hahaha".encode("utf-8"))
    f
    • 2
    • 17
  • f

    fancy-river-36247

    12/23/2020, 1:48 PM
    Good morning. I'm standing up RDS in Python. I'm getting the following error but cannot trace down the source:
    File "/Users/jasonvertrees/work/infra-pulumi/venv/lib/python3.9/site-packages/pulumi/output.py", line 175, in run
            transformed: Input[U] = func(value)
        TypeError: sequence item 7: expected str instance, int found
    c
    • 2
    • 9
  • f

    fancy-river-36247

    12/23/2020, 1:49 PM
    I find debugging errors like this challenging b/c the debug output doesn't help. How do you quickly debug your projects when something like this happens?
  • e

    echoing-dawn-86996

    12/27/2020, 8:37 PM
    Hey guys! Did anyone manage to setup pycharm/idea to debug pulumi? I don't need to debug pulumi itself, I need to debug my own code...
    g
    • 2
    • 1
  • c

    clever-plumber-29709

    12/28/2020, 9:40 PM
    what's is the best way to share a custom component between different projects?
    ➕ 2
    👍 1
    w
    • 2
    • 2
  • s

    sparse-intern-71089

    01/03/2021, 6:23 PM
    This message was deleted.
    g
    f
    g
    • 4
    • 8
Powered by Linen
Title
s

sparse-intern-71089

01/03/2021, 6:23 PM
This message was deleted.
g

green-school-95910

01/03/2021, 6:25 PM
Secret values are `Output`s in runtime while building the resource graph, since they have to carry their "secrecy" to every value derived from them.
# Start up script
r_server_startup = GITHUB_PASSWORD.apply(lambda password: f"""
#!/bin/bash
cd ~ ;
sudo apt update;
sudo apt install -y git;
sudo git clone -b {BRANCH} https://{GITHUB_USERNAME}:{password}@github.com/orgacuity/orgacuity.git;
""")
The
r_server_startup
will be a new
Output
that holds the script and is also secret, since it is derived from a secret
Output
f

full-account-26076

01/03/2021, 6:32 PM
Ah, thanks, @green-school-95910. I had something similar with
apply
before but just not in this fashion. I'll give it a run.
The good part is that the
apply
method is rendering because installs occur. Bad part is that the password isn't materializing in
r_startup_script
and the clone doesn't occur.
g

gentle-diamond-70147

01/05/2021, 12:14 AM
@full-account-26076 can you share more detail about what you're getting in the startup script? If I try the attached code (with Luiz's
.apply()
example), I see my secret in the stack output with
pulumi stack output --show-secrets
.
__main__.py
f

full-account-26076

01/05/2021, 12:49 AM
@gentle-diamond-70147 - Sorry, I got this working and it wasn't a Pulumi problem (the problem was me). Bad GitHub URL 🙄 . Thanks!
g

gentle-diamond-70147

01/05/2021, 12:49 AM
Glad you got it working!
💯 1
f

full-account-26076

01/05/2021, 12:52 AM
Honestly, smooth as butter.
View count: 1