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

    few-alarm-62671

    01/24/2022, 3:39 AM
    Hey all, is there a way to get if the calling commando is
    up
    ,
    destroy
    or
    preview
    during execution? Can’t sort this out and was wandering how to use
    lambda_.get_invocation
    to differ what to do in each case
    g
    m
    • 3
    • 4
  • g

    glamorous-forest-5773

    01/27/2022, 9:20 AM
    Hi all, is there a proper guide on how to use
    pulumi.input_type
    decorator to define internal datatypes. I'm trying to use Pydantic + pulumi.input_type decorator to create schemas with validation + the ability to resolve nested Output attributes. But it looks like, the decorator is tampering the attributes which results in some weird behavior for pydantic models.
    g
    g
    • 3
    • 13
  • g

    gorgeous-minister-41131

    02/02/2022, 1:49 AM
    Anyone using automation API with python? I can’t seem to get the
    color="always"
    to actually print out color when using the print() method for on_output…. is there some trick to it?
    • 1
    • 1
  • b

    brainy-window-77332

    02/02/2022, 10:21 AM
    I need to capture the ip address associated with a network interface so I can build a configuration file that is stored in an s3 bucket. However using Pulumi.Output just gives me an Output object, i've tried using apply, concat and from_input methods but can't seem to get the actual ip address.
    Output.all(net_interface.id).apply(lambda l: f"{l[0]}")
    works fine when used on the right hand side of a parameter assignment in the instance creation but not in a function that is called as the right hand side of the content parameter when creating the bucket object.
    p
    • 2
    • 5
  • g

    gorgeous-minister-41131

    02/04/2022, 12:22 AM
    https://www.pulumi.com/registry/packages/aws/api-docs/eks/identityproviderconfig/ is this the correct provider resource to use for enabling IRSA on an existing EKS cluster?
  • c

    crooked-pillow-11944

    02/06/2022, 9:47 PM
    Cross-posting: https://pulumi-community.slack.com/archives/C019YSXN04B/p1644184025558799
  • p

    prehistoric-beach-79855

    02/09/2022, 8:16 PM
    Hello all, I am trying to import a key pair resource with: key=pulumi_aws.ec2.KeyPair.get(“myKeyPairs”, id=‘key-00789edf16bef11xx’) but pulumi up is giving: “error: Preview failed: resource ‘key-00789edf16bef11xx’ does not exist”. While I can see this Key pair in console > EC2 > Key pairs, under ID column. Am I missing something?
    p
    • 2
    • 1
  • h

    hallowed-animal-47023

    02/10/2022, 12:53 PM
    Morning all - I'm imagining I'm making some sort of mistake so can use a second set of eyes.
  • h

    hallowed-animal-47023

    02/10/2022, 12:55 PM
    I am trying to build Security Group Ingress/Egress Args up to pass as a list into a Security group but keep getting an error that it's seeing an object and not a list
    c
    • 2
    • 1
  • h

    hallowed-animal-47023

    02/10/2022, 12:55 PM
    https://www.toptal.com/developers/hastebin/imuweceteb.py
  • h

    hallowed-animal-47023

    02/10/2022, 12:58 PM
    This is the rules object value:
         {'ingress_rules': [<pulumi_aws.ec2._inputs.SecurityGroupIngressArgs object at 0x11093eeb0>], 'egress_rules': [<pulumi_aws.ec2._inputs.SecurityGroupEgressArgs object at 0x1109662e0>]}
    
        This is the ingress rules value:
         [<pulumi_aws.ec2._inputs.SecurityGroupIngressArgs object at 0x11093eeb0>]
        The ingress rules type is:
         <class 'list'>
    
        This is the egress rules value:
         [<pulumi_aws.ec2._inputs.SecurityGroupEgressArgs object at 0x1109662e0>]
        The egress rules type is:
         <class 'list'>
  • s

    sparse-state-34229

    02/12/2022, 1:26 AM
    looks like you need https://www.pulumi.com/registry/packages/aws/api-docs/ec2/securitygrouprule/
    👍 1
  • s

    sparse-state-34229

    02/12/2022, 1:27 AM
    for rule in ingress_rules:
            rules_objects['ingress_rules'].append(
                ec2.SecurityGroupRule(
                    # ...
  • h

    hallowed-animal-47023

    02/12/2022, 12:42 PM
    Will give it a try later today or tomorrow, thanks!
  • g

    gorgeous-minister-41131

    02/14/2022, 11:09 PM
    Anyone have any python-specific implementations of using the ACM certificate w/ R53 + DNS validation…? https://www.pulumi.com/registry/packages/aws/api-docs/acm/certificate/
    w
    p
    • 3
    • 2
  • g

    gorgeous-minister-41131

    02/14/2022, 11:09 PM
    the recommendation is not to create resources in an apply, but there doesn’t seem to be a straight forward way to avoid iterating over the resource’s output without it…
  • g

    gorgeous-minister-41131

    02/14/2022, 11:10 PM
    https://www.pulumi.com/registry/packages/aws/api-docs/acm/certificate/#certificatedomainvalidationoption
  • g

    gorgeous-minister-41131

    02/14/2022, 11:10 PM
    TypeError: 'Output' object is not iterable, consider iterating the underlying value inside an 'apply'
  • s

    sparse-gold-10561

    02/15/2022, 5:22 PM
    Is there a way for pulumi to check the version of python is at least 3.9 and print or show a warning if the stack is performing up or preview when its not?
    m
    • 2
    • 3
  • d

    dry-answer-66872

    02/17/2022, 9:00 AM
    Is there a way we can add/remove ingress/egress of the existing security group in AWS?
    f
    • 2
    • 6
  • f

    few-pillow-1133

    02/17/2022, 9:04 AM
    For EKS, is there a way to retrieve the
    eks-cluster-sg-*
    created by the cluster? Also, by default if
    vpc_security_group_ids
    isn't specified in the launch_template, the ``eks-cluster-sg-*` get used for each worker nodes. Is there a way to specify both the cluster generated security group and a custom security group for each node during creation?
  • h

    hallowed-furniture-81921

    02/19/2022, 12:46 AM
    👋 Hey folks, this may be a trivial question but I haven't been able to find an answer or example online. Is it possible / how do I access a pulumi resources output from a different file in the same project? For example:
    ❯ ls -la
    drwxr-xr-x   9 wsheldon  staff    288 Jan 20 16:26 .
    drwxr-xr-x  10 wsheldon  staff    320 Jan 20 16:30 ..
    -rw-r--r--   1 wsheldon  staff  20709 Feb 18 15:46 __main__.py
    drwxr-xr-x   3 wsheldon  staff     96 Feb 18 15:46 __pycache__
    drwxr-xr-x   4 wsheldon  staff    128 Dec 29 08:56 docker
    -rw-r--r--   1 wsheldon  staff    978 Jan 20 16:05 ecr.py
    -rw-r--r--   1 wsheldon  staff   9516 Jan 20 16:05 iam.py
    -rw-r--r--   1 wsheldon  staff   4368 Jan 20 15:51 s3.py
    -rw-r--r--   1 wsheldon  staff   9944 Jan 20 16:05 vpc.py
    How would one access
    s3_bucket.id
    in the
    s3.py
    file, from the
    __main__.py
    file
    s
    p
    • 3
    • 2
  • f

    fierce-market-67222

    02/21/2022, 1:21 PM
    Hello i want to overwrite an env_var in a helm chart via transformations, the code is below, any ideea how can i get this done? Thank you
    def set_deployment_env_var(obj, opts):
        if obj["kind"] == "Deployment":
            obj["spec"]["template"]["spec"]["containers[0]"] = [
                {
                    "env": [
                        {
                            "name": "RELEASE_DATE",
                            "value": "....."
                        },
                    ]
                }
            ]
    p
    • 2
    • 5
  • g

    great-sunset-355

    02/22/2022, 11:32 AM
    I have questions about using
    mypy
    Code 1: How can I cast or at least tell that output is a type
    Ouput[str]
    and not
    Output[any]
    ?
    r53_zone = aws.route53.get_zone(zone_id=SHARED_STACK_REF.require_output('hosted_zone_id'))
    mypy output
    Argument "zone_id" to "get_zone" has incompatible type "Output[Any]"; expected "Optional[str]"
    Code 2 Why do I get an error and how to prevent that? It looks like that
    profile
    attribute is dynamically created, correct?
    ec1_provider = aws.Provider(
        f"{PREFIX}-{ec1_region}", profile=aws.config.profile, region=ec1_region
    )
    mypy output:
    __main__.py:27: error: Module has no attribute "profile"
    p
    • 2
    • 7
  • k

    kind-napkin-54965

    02/22/2022, 12:25 PM
    Trying to learn pulumi. Whichever package (github, gitlab, auth0) I try to import, I get the same error:
    .virtualenvs/pulumi39/lib/python3.9/site-packages/pulumi_auth0/_utilities.py", line 15, in <module>
        import pulumi.runtime
    ModuleNotFoundError: No module named 'pulumi.runtime'
    Tried both py3.10 and py3.9, same. I am clearly missing something, can't figure out what exactly. Thanks for help!
    f
    • 2
    • 3
  • w

    worried-xylophone-86184

    02/23/2022, 1:42 PM
    Hi all ! I am trying to make a POST call using the requests library which requires the value of a Kubernetes cluster name and cluster URL but it dosent seem to be working. I am aware of the fact that Pulumi returns an Output class object and using the
    apply
    and
    all
    function the individual values are supposed to be accessed. This makes sense when the values are being passed on to another Cloud resource. Function calls and traceback are in the thread. What is supposed to be done when the values are supposed to extracted from the
    Output
    object and used for a non Pulumi operation like making POST calls? I found an alternative where the output is being written to file and then being read from it. https://www.leebriggs.co.uk/blog/2021/05/09/pulumi-apply.html Is this the only workaround available?
    b
    • 2
    • 11
  • p

    proud-daybreak-22469

    02/23/2022, 11:13 PM
    Hi! I’m learning Pulumi right now. I’m trying to get
    spot_instance_id
    Output from a
    SpotInstanceRequest
    and it always is returning None in the apply method I’m calling on it. What is the proper way to access this output? I’m trying to include the ARN of that instance as a resource in an AWS policy I’m sure this question has been asked 1001 times, and I took a look at the input and output documentation but it didn’t help solve the problem.
    p
    • 2
    • 4
  • e

    eager-jordan-39489

    02/25/2022, 2:09 AM
    Hi team, I'm trying to deploy a Lambda that should be triggered by an object creation in an S3 bucket. My stack is working on AWS, and so far it has been coded in Python. I've seen this post https://www.pulumi.com/docs/guides/crosswalk/aws/lambda/, is there any analogy for 
    onObjectCreated
     in Python? I couldn't find it..
    c
    • 2
    • 2
  • h

    happy-alarm-59675

    02/25/2022, 11:23 AM
    Hi, I stumbled over a strange behavior when using the same class instances/object in the stack output: https://github.com/ederst/pulumi-in-a-pickle/tree/no-doubles-stack-output TL;DR: Same class instances do not show up twice in the output. I tried to find something about it in the docs and on GH but failed (might be lack of time on my side). Anyhow, before I file an issue I wanted to know if somebody here knows if this is the expected behavior, an already known issue, or a bug.
  • v

    victorious-exabyte-70545

    03/01/2022, 10:40 PM
    Is it possible to stack exports and imports with the pulumi SDK?
    m
    g
    • 3
    • 10
Powered by Linen
Title
v

victorious-exabyte-70545

03/01/2022, 10:40 PM
Is it possible to stack exports and imports with the pulumi SDK?
m

miniature-musician-31262

03/02/2022, 1:48 AM
I’m not sure I understand. Could you elaborate?
v

victorious-exabyte-70545

03/02/2022, 3:24 PM
pulumi stack export
pulumi stack import
can this be done with the pulumi sdk in python.
g

great-queen-39697

03/02/2022, 3:58 PM
You can export specific values with stack exports:
pulumi.export(name: str, value: Any)
If you're looking to actually dump the stack's details as you would from the CLI, then that's the Automation API with pulumi.automation.LocalWorkspace.export_stack and pulumi.automation.LocalWorkspace.import_stack
☝️ 1
v

victorious-exabyte-70545

03/02/2022, 6:12 PM
@great-queen-39697 Thank you!!!
🙇‍♀️ 1
Really, I just want to automate the cleaning of pending (failed resource creation). Not sure if there is a better way?
g

great-queen-39697

03/02/2022, 6:27 PM
Ah, we were just talking about this in #automation-api. Here's a link to the thread: https://pulumi-community.slack.com/archives/C019YSXN04B/p1646144559200289
There's some solutions in there, but the issue linked in that conversation is the one you should go vote on. We use the GitHub thumbs-up votes as part of our roadmap to know what we need to work on the most
v

victorious-exabyte-70545

03/02/2022, 6:45 PM
Thanks!
👍 1
View count: 6