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

    bland-pharmacist-96854

    01/24/2023, 12:36 PM
    image.png
  • b

    bland-pharmacist-96854

    01/24/2023, 12:38 PM
    basically, I'm trying to use
    pulumi.Output.concat()
    or
    pulumi.Output.format()
    for a key
  • b

    bland-pharmacist-96854

    01/24/2023, 12:38 PM
    this works well for values, but not for keys 😕
    e
    g
    • 3
    • 11
  • e

    early-cat-34152

    01/26/2023, 9:35 AM
    How can I debug
    pulumi_command.local.Command
    ? For some reason, after altering the command and adding an
    asset_paths
    argument, creating (and updating) this Resource fails all the time. When I run the command outside of Pulumi it works fine and has a zero exit status. I want to find out which exit status is returned then, and if it's a Pulumi-internal error (I suspect so), I want to know which one.
    e
    d
    • 3
    • 16
  • k

    kind-jelly-61624

    01/26/2023, 9:05 PM
    Cross-Posting from general for vis https://pulumi-community.slack.com/archives/C84L4E3N1/p1674765729597779
  • s

    strong-helmet-83704

    01/27/2023, 2:41 AM
    Is there any guarantee to how my pulumi objects get mapped to values of a dictionary during creation? This seems to be consistent during development but when purging python cache i notice already created resource objects are re-ordered in the dictionary randomly sometimes causing resource changes. Using Python > 3.9
    e
    c
    • 3
    • 36
  • g

    great-sunset-355

    01/31/2023, 12:33 PM
    Is this a reliable pattern for conditional resources that may already exist in AWS but not in pulumi and if not then create it?
    def conditional_role_not_exists():
        try:
            result = aws.iam.get_role("conditional_role_not_exists")
            if result.id:
                return
        except:
            pass
        # create if it does not exist
        aws.iam.Role("conditional_role_not_exists", args=aws.iam.RoleArgs(assume_role_policy="{}"))
    
    conditional_role_not_exists()
    e
    • 2
    • 10
  • q

    quaint-hydrogen-7228

    01/31/2023, 2:13 PM
    Not really, if you do not execute the Role declaration in the code, the role will be deleted instead when , if it managed by Pulumi from a previous update. Pulumi and many other tools generate a declarative model of the resources, even though the code may look imperative. If you have a resource that that already exists but is not managed by Pulumi, import it into the stack instead. This is a one-time operation. You code just includes the part that declare the role (aws.iam.Role(.....) ).
  • b

    bland-pharmacist-96854

    01/31/2023, 3:26 PM
    How I can create a file in the current directory with the contents of an output?
  • b

    bland-pharmacist-96854

    01/31/2023, 3:26 PM
    I'm trying something like this
    Untitled.py
    b
    e
    • 3
    • 3
  • b

    broad-holiday-50009

    01/31/2023, 11:07 PM
    I'm coming to the end of writing my first vpc in pulumi and doing it without crosswalk. Someone helped me write a for loop to sort out my subnets into route table associations and I'm getting the error
    error: Duplicate resource URN 'urn:pulumi:dev::HNO1::aws:ec2/routeTableAssociation:RouteTableAssociation::rta-Calling __str__ on an Output[T] is not supported.
        
        To get the value of an Output[T] as an Output[str] consider:
        1. o.apply(lambda v: f"prefix{v}suffix")
        
        See <https://pulumi.io/help/outputs> for more details.
        This function may throw in a future version of Pulumi.-public'; try giving it a unique name
    This is the code that is producing the error, I think I know what has caused it but I don't know how to fix it.
    pub_rtas = []
    
    for pub_subnet in pub_subnets:
        rta_name = f"rta-{pub_subnet.id}-public"
        pub_rtas.append(rta_name)
    
        ec2.RouteTableAssociation(
    	    rta_name,
    	    subnet_id = pub_subnet.id,
    	    gateway_id = igw.id,
    	    route_table_id="HNO-route-table-public",
    	)
    b
    • 2
    • 7
  • a

    acoustic-helmet-58862

    02/07/2023, 12:02 PM
    Hello, Im trying to run my script but this error keeps poping up. When i try to visit this page i just get a message ‘This XML file does not appear to have any style information associated with it. The document tree is shown below.’
    e
    • 2
    • 3
  • t

    thankful-stone-34269

    02/07/2023, 10:54 PM
    When I check out a colleague's pulumi code that I haven't worked on before, how do I get pulumi to rebuild the
    venv
    directory for me?
    c
    e
    • 3
    • 6
  • a

    adamant-author-732

    02/08/2023, 10:53 AM
    I have a Pulumi resource (A) that emits an
    Output[str | None]
    and another one (B) that expects an input of
    Input[str] | None
    . The only way I can think to pass this data from
    A
    to
    B
    is via
    A.attribute.apply(B(… some arguments here…))
    . However, I know that Pulumi discourages creating resources inside an
    apply()
    . Is there another way to convert
    Output[str | None]
    to
    Input[str] | None
    ?
    e
    • 2
    • 4
  • a

    acoustic-helmet-58862

    02/08/2023, 11:04 AM
    How to reset a corrupt pulumi state in s3?
    w
    s
    • 3
    • 3
  • t

    thankful-stone-34269

    02/08/2023, 11:37 PM
    TIL:
    pulumi import
    doesn't just create code for an existing resource, it also imports that existing physical resource into your current stack. So if you are trying to use
    import
    to learn how to make a similar resources, beware. Because your dev stack will get a reference to the actual real infra that's in use. And if you're like me you won't understand why your dev stack has this thing you never created with
    pulumi up
    and when you finally succeed in getting it out of your stack, you take down the system. :(
    e
    • 2
    • 3
  • a

    acoustic-helmet-58862

    02/09/2023, 12:01 PM
    Creating a ALB using awsx doesen’t work for me but it worked in the past, I have deleted my whole stack but I still get this error.
  • t

    thankful-stone-34269

    02/14/2023, 2:04 AM
    What's the difference between
    pulumi_eks.eks.Cluster
    and
    pulumi_aws.eks.Cluster
    ?
  • w

    wide-cat-87818

    02/14/2023, 9:00 AM
    Hi together, I try to get the the AWS caller identity with Pulumi by using the following line: _AWS_ACCOUNT_ID = pulumi_aws.get_caller_identity().account_id_ But there is a problem with InvokeOptions:
    File "/home/marcel/.cache/pypoetry/virtualenvs/moneymeets-pulumi-2nIJVDlj-py3.11/lib/python3.11/site-packages/pulumi_aws/get_caller_identity.py", line 100, in get_caller_identity
            opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
        AttributeError: type object 'InvokeOptions' has no attribute 'merge'
    It was working with older versions. I’ve upgraded all my packages and it is not working anymore. I’m using the following versions: • Python 3.11 • Pulumi 3.54.0 • pulumi_aws 5.29.1 Problematic line: https://github.com/pulumi/pulumi-aws/blob/master/sdk/python/pulumi_aws/get_caller_identity.py#L100 Perhaps it is enough to update to provider? https://github.com/pulumi/pulumi-aws/issues/2361 Any ideas?
    e
    • 2
    • 5
  • d

    dry-keyboard-94795

    02/14/2023, 1:33 PM
    Couple of questions around the new
    StackReference.get_output_details
    • How do we call it in our stacks? The method is async. • How come our code needs to care if an output is secret or not? (interface has both
    value
    and
    secret_value
    e
    • 2
    • 8
  • a

    adorable-garden-93195

    02/14/2023, 5:12 PM
    Hello everyone, since I don't see a dedicated openstack channel but I use python to deploy my resources, I figured I'd post my question here first.
    ...
    
        port = openstack.networking.Port(
            port_name,
            name=port_name,
            network_id=net_objects[net_name]["network"],
            port_security_enabled=False,
            fixed_ips=[
                {
                    "subnet_id": net_objects[net_name]["subnet"],
                    "ip_address": net_port["ip"],
                }
            ],
        )
        ports_list.append(port)
        port_names.append(port_name)
    
    if net_port["is_float"] is True:
    
        # If the port has a floating point IP assigned to it, then
        # create the relevant resources
        float_ip = openstack.networking.FloatingIp(
            f"{port_name}_float",
            pool="public",
        )
        float_ip_assoc = openstack.networking.FloatingIpAssociate(
            f"{port_name}_float_assoc",
            floating_ip=float_ip.address,
            port_id=port.id,
        )
        pulumi.export(f"float_ip_{port_name}", float_ip.address)
    On initial stack deploy, I create reference a library that has the relevant port info, and it build sthe port and float resources without issue. When I change the IP of a port in the library (seperate yaml file) and run
    pulumi up
    again, it DOES update the IP, but doesn't re-associate a new floating IP. (The existing floating IP resource still exists in Openstack and is mapped to the old IP). I'm just not sure how to delete the old association so I can create the new one in the python program. Hopefully that makes sense, thanks for the help.
  • g

    gorgeous-minister-41131

    02/16/2023, 12:42 AM
    What is the best/recommended way to compute a simple sha256 hash of a dictionary whose keys a a type
    str
    , and their values could be
    pulumi.Output[str]
    ?
    g
    e
    • 3
    • 7
  • f

    future-eve-16214

    02/16/2023, 10:48 PM
    How can I run an async function in my pulumi script? I have an async function that gets secret values from Azure Key Vault. I tried using
    asyncio.run
    but I get
    RuntimeError: asyncio.run() cannot be called from a running event loop
    • 1
    • 1
  • r

    rhythmic-branch-12845

    02/20/2023, 7:16 AM
    is there any reason why we have to resort to such long names in Python (and in other languages too, apparently), as opposed to TypeScript? see https://www.pulumi.com/registry/packages/aws/api-docs/networkfirewall/rulegroup/#aws-networkfirewall-rulegroup for example: By the time you get down to the
    rules_source_list
    argument, you have to assign it to a `
    aws.networkfirewall.RuleGroupRuleGroupRulesSourceRulesSourceListArgs(...
    function call
    g
    b
    • 3
    • 6
  • w

    white-forest-65475

    02/20/2023, 4:23 PM
    I’m trying to extract the underlying IP of a kubernetes service that is managed by a python-pulumi app which finishes with these important lines:
    # Apply the Argo CD installation manifest from a URL
    argocd_install_manifest = k8s.yaml.ConfigGroup(
        "argocd-install-manifest",
        files=["<https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/install.yaml>"],
        transformations=[set_namespace],
        opts=opts,
    )
    
    # Extract the argocd-server Service and register it's IP address as an output.
    argocd_service = argocd_install_manifest.get_resource("service", "argocd-server")
    argocd_service_ip = argocd_service.status.loadBalancer.ingress[0].ip
    pulumi.export("argocd-service-ip", argocd_service_ip)
    This code fails with an error saying that it can’t find a service by that name. I’ve also tried calling k8s.core.v1.Service.get(“argocd-server”, None, opts) but the second argument, ‘id’, it’s not clear to me what I should supply it an None does not work. The service definitely does exist, although to be fair I think it is currently a ClusterIP service, but the error seems to be directly related to service not being found as
    pulumi up
    errors out with this final stack frame:
    File "/Users/erich/Library/Caches/pypoetry/virtualenvs/blumeops-yejfY_2Q-py3.11/lib/python3.11/site-packages/pulumi/output.py", line 263, in lift
            return UNKNOWN if isinstance(v, Unknown) else cast(Any, v)[key]
                                                          ~~~~~~~~~~~~^^^^^
        KeyError: 'service:argocd-server'
    Can anyone help me figure out how to extract this service’s IP?
    b
    • 2
    • 12
  • w

    white-forest-65475

    02/20/2023, 9:26 PM
    Related to the above - I’m still trying to extract the IP address of this LoadBalancer, and I keep getting an error during the preview phase of `pulumi up`:
    Diagnostics:
      kubernetes:core/v1:Service (argocd-server):
        error: Preview failed: resource 'blumeops-de4233d6/argocd-server' does not exist
    This is the minimal amount of code I’m using which will generate the error… recall from above that argocd_install_manifest is derived from a yaml manifest file ingested by a
    k8s.yaml.ConfigGroup
    .
    argocd_service = k8s.core.v1.Service.get(
        "argocd-server",
        pulumi.Output.concat(namespace.metadata.name, "/argocd-server"),
        opts=pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(depends_on=argocd_install_manifest)),
    )
    Am I missing something here? How can I tell pulumi that it’s OK if the service doesn’t exist yet… it should just wait until the manifest is ready?
    b
    • 2
    • 11
  • s

    sparse-fountain-4597

    02/22/2023, 4:53 PM
    Hey Guys, I'm just wondering if you have any experience of using pulumi with poetry. The installation of pulumi-azure-native is taking about 10m on a fresh build on CI with nothing to slow-down the process such as antivirus or anti-malware monitoring tools.
    b
    e
    • 3
    • 3
  • g

    gorgeous-minister-41131

    02/24/2023, 12:53 AM
    Question about provider/Python wheels: I'm using pipenv to install some dependencies... I noticed the slowest part when installing a venv is the grpcio wheel and other pulumi provider wheels... at least on my m1 mac.. I was wondering if anyone else noticed this, if this is normal, since there might be no published wheels for grpcio and the providers depend on it?
    f
    b
    • 3
    • 8
  • v

    victorious-exabyte-70545

    02/24/2023, 8:20 PM
    Hi all. I have a question about getting information on a resource using get_? but only after the resource has been created. I have an issue where outputs for a resources (that are documented) are not a part of the resource object that I have created (another issue). For example, if I create a private endpoint resource, and use get_private_endpoint, I only want that to run after the private endpoint has been created. Is that possible?
    b
    • 2
    • 12
  • f

    fresh-spring-82225

    02/25/2023, 12:56 AM
    Anyone know if there’s a way to schedule serverless events in aws using python?
    • 1
    • 1
Powered by Linen
Title
f

fresh-spring-82225

02/25/2023, 12:56 AM
Anyone know if there’s a way to schedule serverless events in aws using python?
answering my own question: it doesn’t appear that there’s a python equivalent to eventRuleEventSubscription, but it’s pretty straightforward to port it
View count: 1