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

    alert-raincoat-81485

    09/13/2021, 8:49 PM
    Pulumi tries to delete the existing resouces (iam role & policies) when we run
    pulumi up
    for the upgrades or refresh.
    Previewing update (d2):
         Type                             Name                                                                        Plan       Info
         pulumi:pulumi:Stack              roletest-d2                                                                            1 message
     -   ├─ aws:iam:RolePolicyAttachment  <pulumi_aws.iam.get_policy.AwaitableGetPolicyResult object at 0x106fa1f70>  delete
     -   ├─ aws:iam:RolePolicyAttachment  <pulumi_aws.iam.get_policy.AwaitableGetPolicyResult object at 0x106fa1d00>  delete
     -   ├─ aws:iam:RolePolicyAttachment  <pulumi_aws.iam.policy.Policy object at 0x106fb7130>                        delete
     -   ├─ aws:iam:RolePolicyAttachment  <pulumi_aws.iam.get_policy.AwaitableGetPolicyResult object at 0x106fb7040>  delete
     -   ├─ aws:iam:Policy                policy-as14                                                              delete
     -   └─ aws:iam:Role                  roleas14                                                                   delete
    Any suggestions?
    b
    a
    • 3
    • 15
  • b

    brainy-lion-38675

    09/17/2021, 5:30 PM
    I am trying to translate https://github.com/pulumi/templates/blob/master/azure-typescript/index.ts#L18-L20 to python:
    st_keys = pulumi.Output.all([rg.resource_group_name, st.name]).apply(
        lambda rg_name, st_name: storage.list_storage_account_keys(
            resource_group_name=rg_name,
            account_name=st_name
        )
    )
    which fails with
    File "/Users/xxx/development/xxx-pulumi-azure/venv/lib/python3.9/site-packages/pulumi/output.py", line 181, in run
            transformed: Input[U] = func(value)
        TypeError: <lambda>() missing 1 required positional argument: 'st_name'
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    What am I doing wrong?
    w
    c
    • 3
    • 5
  • g

    gorgeous-minister-41131

    09/21/2021, 7:03 PM
    Does the pulumi kubernetes library have a helper method built in for making a string “name safe” (e.g. dns-name compliant)? I can easily make my own but wasn’t sur eif the pulumi_kubernetes lib contained something like this.
    b
    • 2
    • 1
  • g

    gorgeous-minister-41131

    09/21/2021, 7:07 PM
    Just trying to avoid re-inventing the wheel if pulumi already has a validator for the pulumi_kubernetes provider 🙂
  • v

    victorious-exabyte-70545

    09/22/2021, 9:36 PM
    Hi all I am getting an error when trying to select a stack with auto
    AttributeError: 'NoneType' object has no attribute '__name__'
    
    In [27]: auto.select_stack("stackname", work_dir="/path_to_project")
  • v

    victorious-exabyte-70545

    09/22/2021, 9:36 PM
    Path and stack exist. Ideas?
  • v

    victorious-exabyte-70545

    09/22/2021, 9:36 PM
    __main__.py
  • v

    victorious-exabyte-70545

    09/22/2021, 9:36 PM
    exists in path.
  • v

    victorious-exabyte-70545

    09/22/2021, 9:36 PM
    And pulumi cli works with it.
  • v

    victorious-exabyte-70545

    09/22/2021, 10:13 PM
    AttributeError                            Traceback (most recent call last)
    ~/virtuals/sourcescrub/lib/python3.9/site-packages/IPython/core/formatters.py in __call__(self, obj)
        700                 type_pprinters=self.type_printers,
        701                 deferred_pprinters=self.deferred_printers)
    --> 702             printer.pretty(obj)
        703             printer.flush()
        704             return stream.getvalue()
    
    ~/virtuals/sourcescrub/lib/python3.9/site-packages/IPython/lib/pretty.py in pretty(self, obj)
        392                         if cls is not object \
        393                                 and callable(cls.__dict__.get('__repr__')):
    --> 394                             return _repr_pprint(obj, self, cycle)
        395
        396             return _default_pprint(obj, self, cycle)
    
    ~/virtuals/sourcescrub/lib/python3.9/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
        698     """A pprint that just redirects to the normal repr function."""
        699     # Find newlines and replace them with p.break_()
    --> 700     output = repr(obj)
        701     lines = output.splitlines()
        702     with p.group():
    
    ~/virtuals/sourcescrub/lib/python3.9/site-packages/pulumi/automation/_stack.py in __repr__(self)
        189
        190     def __repr__(self):
    --> 191         return f"Stack(stack_name={self.name!r}, workspace={self.workspace!r}, mode={self._mode!r})"
        192
        193     def __str__(self):
    
    ~/virtuals/sourcescrub/lib/python3.9/site-packages/pulumi/automation/_local_workspace.py in __repr__(self)
        102
        103     def __repr__(self):
    --> 104         return f"{self.__class__.__name__}(work_dir={self.work_dir!r}, program={self.program.__name__}, " \
        105                f"pulumi_home={self.pulumi_home!r}, env_vars={self.env_vars!r}, " \
        106                f"secrets_provider={self.secrets_provider})"
    
    AttributeError: 'NoneType' object has no attribute '__name__'
  • v

    victorious-exabyte-70545

    09/22/2021, 10:14 PM
    Looks like it expects program (callable) to be provided for local workspace but that should not be included with work_dir provided.
    r
    • 2
    • 36
  • c

    crooked-pillow-11944

    09/23/2021, 3:38 AM
    Has anybody used dictionaries or lists with Output.all...apply? https://pulumi-community.slack.com/archives/CRH5ENVDX/p1632365439151400
    r
    p
    • 3
    • 8
  • p

    purple-architect-30534

    09/23/2021, 1:41 PM
    How can I enable dynamic partitioning in aws.kinesis.FirehoseDeliveryStream?
    f
    • 2
    • 1
  • b

    billions-mechanic-26704

    09/24/2021, 12:54 PM
    Hello community. I have an existing Azure container registry which I imported and I am uising it in my pulumi code. I need to pull a docker image hosted there in order to reference it into an azure app service. Right now, I am creating the azure app service plan and the web app service. Taking as reference this docker azure app service example, they are building the image there I am just wondering whether is possible to pull an existing image as long I got the existing container registry instance. Is that possible? In this case, the
    docker.Image
    resource they use is not useful since
    build
    parameter is required. I am seeing this
    docker.RemoteImage
    resource from docker pulumi api, but not sure how to indicate it that the image should be pulled from my container registry I got previously. The code for getting my container registry is:
    container_image = "wmlab"
    
    # GETTING MY CONTAINER REGISTRY
    rhdhv_container_registry = azure_native.containerregistry.Registry(
        "rhdhvContainerRegistry",
        admin_user_enabled=True,
        location="westeurope",
        network_rule_set=azure_native.containerregistry.NetworkRuleSetArgs(
            default_action="Allow",
        ),
        registry_name="rhdhvContainerRegistry",
        resource_group_name="genericRG1",
        sku=azure_native.containerregistry.SkuArgs(
            name="Premium",
        ),
        opts=pulumi.ResourceOptions(protect=True))
    
    # OUTPUT THE CREDENTIALS TO GET THEM
    acr_credentials = pulumi.Output.all("genericRG1", rhdhv_container_registry.name).apply(
        lambda args: azure_native.containerregistry.list_registry_credentials(
            resource_group_name=args[0],
            registry_name=args[1]
        )
    )
    admin_username = acr_credentials.username
    admin_password = acr_credentials.passwords[0]["value"]
    Not sure if perhaps I have to use
    azure_native.containerregistry.Registry
    (here it is) since it has a
    get
    method when an instance of a container registry is gotten, such as is shown at the attached picture. The point is I don’t know how to use that get method I am a bit confused about how to pull an image from the existing container registry I got. Or perhaps does it need to be build and pushed from the same project? I would say should be possible to get an existing one. I need this because the build process is taking place in another repository project
  • h

    hallowed-teacher-48474

    09/28/2021, 4:38 PM
    Hello everyone!, is there any example repo with complex python unit tests, I am having some trouble trying to mock some resources when creating unit tests for ComponentResources, specially when resolving outputs inside another resource. Or if anyone can share some example, I will appreciate it 🙌
    p
    • 2
    • 2
  • w

    wonderful-action-5267

    09/29/2021, 1:08 AM
    Hey all, started using Pulumi at work for setting up our AWS infrastructure (mainly API's and lambda functions) and it's been a joy so far! We've gotten to a point where we're adding provisioned concurrency to a lambda function following the example here: https://github.com/pulumi/examples/blob/258d3bad0a00020704743e37911c51be63c06bb4/aws-py-serverless-raw/__main__.py#L94 I figured out how to actually publish the function using the publish input argument so that there's a published version for the Provisioned Concurrency Config and noticed that the versions start at 1. The lambda contains a custom python package with a SEMVER version. If I wanted to tag the lambda version to that SEMVER value instead, is there a way to feed in that value along with the
    publish
    argument? Or is this a use case for creating lambda aliases with that SEMVER value instead?
    • 1
    • 1
  • a

    able-doctor-68496

    09/30/2021, 5:15 PM
    Hi there - I’m really trying to wrap my head around the
    props
    argument to the
    ComponentResource
    constructor: https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1 My main questions about it are: • When would I want to pass something to this
    props
    argument? • What would I pass to that argument?
  • a

    able-doctor-68496

    09/30/2021, 5:19 PM
    For example, currently I’m passing a Kubernetes namespace to a “parent”
    ComponentResource
    that I’ve created. I’m passing it like so:
    def __init__(..., namespace: Namespace, ...):
      super().__init__(
        ...,
        props={'namespace': namespace},
        ...
      )
    Is that the correct way to use
    props
    ? My thinking was that this would let the Pulumi “engine” know that there is an ordering requirement between the namespace and my
    ComponentResource
    . Is that how it works? If not, then what are
    props
    for?
  • b

    billowy-church-13349

    09/30/2021, 7:40 PM
    Is there an example exists to Deploy vSphere Virtual Machine from Content Library. It seems like
    vsphere.VirtualMachine
    exists network_interfaces, and disk params, bug
    vsphere.get_content_library_item
    does not provide those info.
  • c

    crooked-pillow-11944

    10/01/2021, 1:30 PM
    Does anybody have any Python-based Pulumi stacks with working tests? I want to be able to run unit and integration tests against my stacks. GitHub search came up empty 😞
    r
    • 2
    • 1
  • a

    able-doctor-68496

    10/01/2021, 4:13 PM
    Hi there - I’m really trying to wrap my head around the 
    props
     argument to the 
    ComponentResource
     constructor: https://www.pulumi.com/docs/reference/pkg/python/pulumi/#the-pulumi-python-resource-model-1 My main questions about it are: • When would I want to pass something to this 
    props
     argument? • What would I pass to that argument? For example, currently I’m passing a Kubernetes namespace to a “parent” 
    ComponentResource
     that I’ve created. I’m passing it like so:
    def __init__(..., namespace: Namespace, ...):
      super().__init__(
        ...,
        props={'namespace': namespace},
        ...
      )
    Is that the correct way to use 
    props
    ? My thinking was that this would let the Pulumi “engine” know that there is an ordering requirement between the namespace and my 
    ComponentResource
    . Is that how it works? If not, then what are 
    props
     for?
    g
    b
    r
    • 4
    • 4
  • c

    crooked-pillow-11944

    10/04/2021, 1:03 AM
    I just wanted to share this bit of code that @billowy-army-68599 helped me on for anyone else runs into this issue
    😛artypus-8bit: 1
    ✨ 1
    • 1
    • 2
  • a

    agreeable-motherboard-1279

    10/04/2021, 9:55 AM
    Hi, anyone knows a way within an Inline Python program to detect if we are running 'preview' or 'up' ? I have some custom actions within the stack I would ideally only execute during 'up' but not during 'preview' so to NOT alter anything during 'preview'. Thx
    b
    • 2
    • 2
  • s

    shy-bird-55689

    10/04/2021, 9:28 PM
    hey ya, i'm trying to pass some resource outputs into a docker image build as build args, and keep on getting a json serialisation error as they are passing as outputs rather than the actual value. I've tried using
    apply
    and
    Output.concat
    anyone got any pointers?
    package_dash_image = Image('package-dash-image',
                                   build=DockerBuild(args={'BUCKET': "bucket_name",
                                                           'ACCESS_KEY_ID': package_dash_user_access_key.id,
                                                           'SECRET_ACCESS_KEY': package_dash_user_access_key.secret
                                                           },
                                                     context='source/services/package-dash/',
                                                     ),
                                   image_name=package_dash_image_name,
                                   registry=package_dash_repository_info,
                                   )
    b
    g
    • 3
    • 17
  • a

    alert-glass-49407

    10/06/2021, 8:22 PM
    re: above thread, something I've been trying to work my head around today is passing outputs into a jinja2 template
    ✅ 1
    r
    b
    g
    • 4
    • 11
  • n

    nutritious-shampoo-16116

    10/07/2021, 10:20 AM
    hey team, is there any possibility to wrap the python version of the automation API in a async friendly module?
    b
    • 2
    • 4
  • s

    shy-bird-55689

    10/07/2021, 8:42 PM
    hey ya, has anyone had this error before when running
    up
    ?
    aws:lambda:EventSourceMapping (md5-source-event):
        error: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:45393: connect: connection refused"
    Have it for a couple of other resources that were to be updated as well
    c
    • 2
    • 2
  • f

    fresh-actor-58531

    10/08/2021, 5:42 AM
    Hi Team,
  • f

    fresh-actor-58531

    10/08/2021, 5:43 AM
    When update the pulumi code for managed es for aws, Pulumi stack deleting and recreating
  • f

    fresh-actor-58531

    10/08/2021, 5:44 AM
    I just need to update the stack, is there any way? please help
Powered by Linen
Title
f

fresh-actor-58531

10/08/2021, 5:44 AM
I just need to update the stack, is there any way? please help
View count: 1