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

    victorious-exabyte-70545

    12/22/2021, 3:47 PM
    My other question is how do I mock stack configurations? Thanks in advance for any tips.
  • g

    great-sunset-355

    12/24/2021, 12:32 PM
    I really do not enjoy debugging pulumi 😞 this is error says absolutely nothing
    transformed: Input[U] = func(value)
        TypeError: sequence item 6: expected str instance, NoneType found
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    👍 1
    b
    • 2
    • 3
  • v

    victorious-exabyte-70545

    12/24/2021, 6:15 PM
    Still struggling with unit test stuff
  • v

    victorious-exabyte-70545

    12/24/2021, 6:16 PM
    so id is mocked but display_name and tenant_id values are seen as None in the project.
  • v

    victorious-exabyte-70545

    12/24/2021, 6:20 PM
    if args.token == "azure:core/getSubscription:getSubscription":
                return {
                    "id": "00000000-0000-0000-0000-000000000000",
                    "display_name": "subscription",
                    "tenant_id": "11111111-1111-1111-1111-111111111111"
                }
    f
    • 2
    • 19
  • v

    victorious-exabyte-70545

    12/24/2021, 6:22 PM
    print statements from the project:
  • v

    victorious-exabyte-70545

    12/24/2021, 6:22 PM
    azure:core/getSubscription:getSubscription
    here is id of my sub
    00000000-0000-0000-0000-000000000000
    here is tenant id of my sub
    None
    here is displayname of my sub
    None
  • v

    victorious-exabyte-70545

    12/24/2021, 6:23 PM
    tenant_id and display_name are ignored for some reason.
  • v

    victorious-exabyte-70545

    12/24/2021, 6:23 PM
    @billowy-army-68599 any ideas on this?
  • v

    victorious-exabyte-70545

    12/24/2021, 6:25 PM
    subscription = azure.core.get_subscription()
    print("here is id of my sub")
    print(subscription.id)
    print("here is tenant id of my sub")
    print(subscription.tenant_id)
    print("here is displayname of my sub")
    print(subscription.display_name)
  • a

    able-honey-93860

    12/26/2021, 4:36 PM
    Does anyone know if the Okta package allows for
    deleteBeforeReplace
    ? Can't get it to work but I'm basing it off the AWS examples so maybe need a different syntax?
    b
    • 2
    • 3
  • a

    ancient-cricket-42076

    12/27/2021, 5:48 PM
    Hello, what could be preventing python from finding the pulumi_aws module? If I try to run any sort of pulumi command I face a:
    ModuleNotFoundError: No module named 'pulumi_aws'
    But browsing the packages of the enviroment it seems to be in order (I make sure it's the default env when trying to deploy, I have tried recreating the env and installing the packages again as well)
    s
    a
    c
    • 4
    • 5
  • r

    rhythmic-lamp-79430

    12/31/2021, 4:37 PM
    hey everyone, trying to get some basics right and looking to get some help… I have this code available https://gist.github.com/mirzawaqasahmed/819a32cedf73808e57fd4b0ab431d642 https://gist.github.com/mirzawaqasahmed/674abdb307906ac25e592614383d2957 and what i am trying to do is to make sure that 1. https://gist.github.com/mirzawaqasahmed/819a32cedf73808e57fd4b0ab431d642#file-__main__-py-L17 recognizes the fact that VPC isnt created yet and IPv6 block isnt available and wait for it…and only move forward with the rest of the code of creating the subnets once ipv6 cidr is available. 2. trying to store the exports from subnets creation for it to be user later on by applying a custom route table to selected subnets only based on their type Appreciate the help and thanks in advance
    b
    • 2
    • 16
  • h

    hallowed-animal-47023

    01/02/2022, 6:56 PM
    Anyone running Pulumi on M1 Mac ? Ran into this guy, curious if anyone has worked around it yet. Have been doing some research and not seeing a ton.
    python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '_CFRelease'
    b
    p
    • 3
    • 44
  • g

    great-sunset-355

    01/03/2022, 12:22 PM
    I have a problem:
    Pulumi.dev.yaml
    contains a variable
    debug: true
    I pass this to ECS Task container definition and get an error
    Error decoding JSON: json: cannot unmarshal bool into Go struct field KeyValuePair.Environment.Value of type string. Examine values at 'TaskDefinition.ContainerDefinitions'.
    This is the code:
    import json
    
    import pulumi
    
    
    def json_output(element) -> pulumi.Output:
        """Dump python object to JSON string as pulumi.Output."""
        return pulumi.Output.from_input(element).apply(json.dumps)
    
    container_definition = {
                "name": self._config.container_name,  
                "image": self._config.image_name,  
                "portMappings": [{"containerPort": self._config.application_port, "protocol": "tcp"}],
                "environment": [
                    {"name": k, "value": v} for k, v in self._config.env_vars.items()
                ],  
                "linuxParameters": {"initProcessEnabled": True},
                "logConfiguration": {
                    "logDriver": "awslogs",
                    "options": {
                        "awslogs-group": self._config.log_group_name,
                        "awslogs-region": self._config.aws_classic_provider.region,
                        "awslogs-stream-prefix": self._config.log_stream_prefix or "ecs",
                    },
                },
            }
    
            self.task_definition = classic_ecs.TaskDefinition(
                f"{self._config.name}-td",
                args=classic_ecs.TaskDefinitionArgs(
                    family=f"{self._config.name}",
                    cpu=self._config.task_cpu,
                    memory=self._config.task_memory,
                    network_mode="awsvpc",
                    requires_compatibilities=["FARGATE"],
                    execution_role_arn=self.task_exec_role.arn,
                    task_role_arn=self.task_role.arn,
                    container_definitions=json_output([container_definition]),
                    tags=self._config.tags,
                )
            )
    p
    • 2
    • 11
  • e

    enough-leather-70274

    01/06/2022, 2:24 AM
    HNY folks (particularly @red-match-15116 and @steep-sunset-89396 :)). I'm working on a generic solution to deploy database schemas (akin to this suggestion on the pulumi blog), however it appears there's a bug that prevents us from importing dynamic providers from a common module: https://github.com/pulumi/pulumi/issues/7960 I've just tested James' repro from Sept, and appears it's still an issue in the latest pulumi python release. Do we have any insight as to what's going on and if/ how we can workaround/ fix?
    s
    r
    • 3
    • 2
  • b

    busy-branch-95201

    01/11/2022, 6:15 PM
    How does pulumi mark str objects as secret when getting them from the config via require_object? Is it possible to check wether a str is marked as secret or not? I'd like to judge on that to decide if a value should go into a ConfigMap or a Secret in k8s.
    b
    p
    • 3
    • 9
  • a

    acoustic-window-73051

    01/11/2022, 7:40 PM
    is my customtimeout usage incorrect? I'm still getting timeouts at 10minutes
    auth = aws.ec2clientvpn.AuthorizationRule(auth_name,
    args=auth_args, opts=pulumi.ResourceOptions( parent=self._artifacts['endpoint'], custom_timeouts=pulumi.CustomTimeouts(create='20m'), ), )
    b
    • 2
    • 2
  • v

    victorious-exabyte-70545

    01/13/2022, 9:33 PM
    Hi guys, I am getting this error with pulumi:
    AttributeError: 'GetVirtualMachineScaleSetResult' object has no attribute 'urn'
    b
    • 2
    • 1
  • v

    victorious-exabyte-70545

    01/13/2022, 9:33 PM
    Any ideas?
  • v

    victorious-exabyte-70545

    01/13/2022, 9:36 PM
    # Pod access to elasticsearch scaleset
    es_vm_scaleset = azure.compute.get_virtual_machine_scale_set(
        resource_group_name=f"{environment}-elasticsearch",
        name=f"{environment}-elasticsearch-scaleset")
    
    azure.authorization.Assignment(
        "PodESScalesetReaderAssignment",
        scope=es_vm_scaleset.id,
        role_definition_name="Reader",
        principal_id=pod_assigned_identity.principal_id,
        opts=ResourceOptions(depends_on=[es_vm_scaleset, pod_assigned_identity])
    )
    b
    • 2
    • 7
  • v

    victorious-exabyte-70545

    01/13/2022, 9:37 PM
    does pulumi save the result of get_* as a resource in the stack?
    m
    • 2
    • 1
  • v

    victorious-exabyte-70545

    01/13/2022, 9:37 PM
    with a urn?
  • c

    crooked-postman-72907

    01/14/2022, 9:09 AM
    Hey all. Can anyone help me with translating terraform/HCL script into python?
    p
    w
    • 3
    • 17
  • a

    acoustic-continent-29968

    01/18/2022, 8:16 AM
    Hi, I have two questions, and would appreciate any help I can get! 🙂 1. I was wondering if there's a way to read config and enable falsy values instead of None, given that when you read a list the flasy value would be
    []
    or with a dict
    {}
    . Or if there's a smart way to convert pulumi config to a dictionary, without iterating over the keys and decyphering the bag name, because we have infinite number of lines that look like:
    name = config.require('name')
    vpc_id = config.require('vpc_id')
    tags = config.require('tags')
    (obviously this can be done with dict comprehension but not what I'm looking for):
    values = ['name', 'vpc_id', 'tags']
    my_dict = { value: config.require(value) for value in values }
    I'm looking for a more generic approach, what happens if a new parameter is introduced? 2. I'm looking to create layers of configuration in which I can explicitly say that a specific config should be appended or overriden. e.g: tags should be appended, configuration layer 1: physical site configuration layer 2: environment configuration layer 3: micro service
    p
    • 2
    • 12
  • g

    gorgeous-minister-41131

    01/20/2022, 1:02 AM
    Is there a way to patch in the
    pulumi.Config
    system into the unittest mocking framework?
    n
    • 2
    • 4
  • g

    gorgeous-minister-41131

    01/20/2022, 2:04 AM
    Another related test/mocking q, since I think I found the workaround for the config.. I’m trying to create a resource, and when I run the test suite, it fails, but it works if I preview…
    File "/Users/tfarvour/.local/share/virtualenvs/pulumi-Miy8VggM/lib/python3.9/site-packages/pulumi_aws/iam/get_policy_document.py", line 414, in get_policy_document
        id=__ret__.id,
    AttributeError: 'NoneType' object has no attribute 'id'
    TL;DR: anyone have any guidance other than https://www.pulumi.com/blog/unit-test-infrastructure/ this for mocking the getter methods? I’m beginning to think that is the root of the issue here…
    • 1
    • 2
  • f

    fast-arm-63150

    01/20/2022, 7:20 AM
    Would anyone know why this simple command for the python automation api fails?
    Traceback (most recent call last):
    File "main.py", line 115, in <module>
    pulumi.automation.create_stack('test-x')
    File "/home/user/x-ops/pulumi/.venv/lib/python3.8/site-packages/pulumi/automation/_local_workspace.py", line 366, in create_stack
    raise ValueError(f"unexpected args: {' '.join(args)}")
    ValueError: unexpected args: stack_name project_name program work_dir opts
    m
    • 2
    • 7
  • l

    lively-author-18255

    01/21/2022, 10:41 PM
    Hi, I am trying to use pulumi/actions but it complains about
    ModuleNotFoundError: No module named 'pulumi'
    I am trying to use pipenv and I see it should be supported. What is the proper way to set up pipenv? Any examples? Thanks!
    g
    • 2
    • 8
  • a

    acoustic-continent-29968

    01/23/2022, 6:39 AM
    Hi there, I am programmatically selecting an ALB to create an ALB rule on. The ALB is selected by tags (using the group tag api), which is fine. If no ALB is available (meaning no rule space left), it'll create the ALB and then create the rule. I have a problem with that, since the next time I'll do
    pulumi up
    effectively the stack will choose the existing ALB which was previously created will not be created since it's available and this will delete the ALB since the stack is missing the "new" ALB so-to-speak. I thought about working around this by either detaching the ALB using pulumi export then looking for the URN and removing it and then using pulumi import to edit the stack. Thought I'll pick your brain to work around this more effectively
    g
    • 2
    • 3
Powered by Linen
Title
a

acoustic-continent-29968

01/23/2022, 6:39 AM
Hi there, I am programmatically selecting an ALB to create an ALB rule on. The ALB is selected by tags (using the group tag api), which is fine. If no ALB is available (meaning no rule space left), it'll create the ALB and then create the rule. I have a problem with that, since the next time I'll do
pulumi up
effectively the stack will choose the existing ALB which was previously created will not be created since it's available and this will delete the ALB since the stack is missing the "new" ALB so-to-speak. I thought about working around this by either detaching the ALB using pulumi export then looking for the URN and removing it and then using pulumi import to edit the stack. Thought I'll pick your brain to work around this more effectively
g

great-queen-39697

01/24/2022, 8:35 PM
It might be useful to use the
get_service_quota()
function instead and examine the
value
results: https://www.pulumi.com/registry/packages/aws/api-docs/servicequotas/getservicequota/#value_python
I think there's a way to get the value and compare it to what rules are there; I'd do a comparison there and then create the resource if needed.
a

acoustic-continent-29968

01/31/2022, 9:16 AM
Hey Laura, thank you for your comment. Could you please elaborate? I don't understand how using service quotas would help in this case, and wouldn't that mean that the service quota is bound to the stack?
View count: 2