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

    average-school-38756

    02/11/2021, 4:05 PM
    Am i misunderstanding aliases? A resource with
    name="my-name"
    shows no changes detected for
    pulumi up
    , yet that same resource with
    opts=ResourceOptions(aliases=[Alias(name="my-name")]}
    instead wants to do a "replace" based on a detected name change
    r
    • 2
    • 10
  • r

    red-match-15116

    02/11/2021, 9:56 PM
    Any Jupyter Notebook fans out here? I just created an example that embeds Pulumi into a Jupyter notebook, allowing interactive development/deployment of infrastructure resources alongside the code that uses it. https://github.com/pulumi/automation-api-examples/tree/main/python/pulumi_via_jupyter
    🙌 3
    👍 1
  • n

    numerous-barista-36019

    02/13/2021, 12:32 AM
    Hi, I have some question about AWS ELB-EC2-RDS 3-tier architecture in VPC. I’m first at IaC, not good at aws, and my code should be refactored, but I need some helps and comprehensions about why my ELB(or VPC, or Web Server) is not working. https://github.com/SeongIkKim/pulumi-aws-3-tier/blob/master/__main__.py This is my code, and my ALB is not successful for health check and routing for my EC2 servers. When I get into ALB public dns, I see 502 BadGateway Error. I know that this question is quietly broad, but I can’t get it anyway. In my suspicion, there are some points. 1. ec2, LB security group. I don’t know how to attach my LB sg to ec2. (It was easy in console, but…) 2. VPC subnet is not well-structured, so My ALB is pointing some useless route..? 3. EC2 user data(simplehttp WAS setting) is not made. In 3rd, however, I can’t get logs because pulumi provises the instance without keypair. I’ve tried to get in ec2 with bastion host, but there is no public key in instance.
    b
    • 2
    • 13
  • b

    better-actor-92669

    02/15/2021, 10:30 AM
    Hello! I've installed this specific Helm chart https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack using Pulumi.
    SDK - python
    Kubernetes - GKE
    pulumi v2.20.0
    pulumi-kubernetes==2.8.0
    Pulumi installs 146 resources from that chart. After the installation every
    pulumi preview
    takes around 60-70 seconds. With the same resources, but without a helm chart it was around 10-13 seconds
    gtime pulumi preview
    
    61.36user 6.89system 1:05.35elapsed 104%CPU (0avgtext+0avgdata 389900maxresident)k
    0inputs+0outputs (416major+501237minor)pagefaults 0swaps
    
    gtime pulumi preview
    
    13.97user 3.60system 0:16.07elapsed 109%CPU (0avgtext+0avgdata 132092maxresident)k
    0inputs+0outputs (379major+404976minor)pagefaults 0swaps
    I tried to analyse the debug log with max verbosity, but obviously I lack knowledge to identify what's wrong. Has anyone experienced performance degradation after installing helm charts? I need help identifying what's wrong, because now it is quite frustrating to wait for a while during each preview + update.
    • 1
    • 1
  • m

    mysterious-area-77666

    02/17/2021, 2:13 PM
    Hello! Does anyone know whether this is something being worked on or is on the roadmap anywhere? https://github.com/pulumi/pulumi-vault/issues/10
    b
    • 2
    • 3
  • c

    creamy-knife-53051

    02/18/2021, 1:25 PM
    HI! i think there's a problem with pulumi-python v2.21
    File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/resource.py", line 358, in do_register
            resolver = await prepare_resource(res, ty, custom, props, opts)
          File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/resource.py", line 86, in prepare_resource
            serialized_props = await rpc.serialize_properties(props, property_dependencies_resources, res.translate_input_property)
          File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/rpc.py", line 78, in serialize_properties
            result = await serialize_property(v, deps, input_transformer)
          File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/rpc.py", line 199, in serialize_property
            value = await serialize_property(output.future(), deps, input_transformer)
          File "/usr/local/lib/python3.7/site-packages/pulumi/runtime/rpc.py", line 185, in serialize_property
            future_return = await asyncio.ensure_future(awaitable)
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 116, in get_value
            val = await self._future
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 116, in get_value
            val = await self._future
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 116, in get_value
            val = await self._future
          [Previous line repeated 1 more time]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 157, in run
            value = await self._future
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 382, in gather_futures
            return await asyncio.gather(*value_futures_list)
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 116, in get_value
            val = await self._future
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 178, in run
            transformed: Input[U] = func(value)
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 266, in from_input
            dict_items = [[k, Output.from_input(v)] for k, v in val.items()]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 266, in <listcomp>
            dict_items = [[k, Output.from_input(v)] for k, v in val.items()]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 272, in from_input
            list_items: List[Union[Any, Awaitable[Any], Output[Any]]] = [Output.from_input(v) for v in val]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 272, in <listcomp>
            list_items: List[Union[Any, Awaitable[Any], Output[Any]]] = [Output.from_input(v) for v in val]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 266, in from_input
            dict_items = [[k, Output.from_input(v)] for k, v in val.items()]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 266, in <listcomp>
            dict_items = [[k, Output.from_input(v)] for k, v in val.items()]
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 274, in from_input
            output: Output[T] = cast(Output[T], Output.all(*list(list_items))) # type: ignore
          File "/usr/local/lib/python3.7/site-packages/pulumi/output.py", line 388, in all
            raise ValueError("Output.all() was supplied no inputs")
        ValueError: Output.all() was supplied no inputs
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    It doesn't happen with pulumi==2.20.0 (tested with pulumi cli 2.14 and 2.21)
    b
    r
    • 3
    • 15
  • c

    clever-plumber-29709

    02/18/2021, 10:08 PM
    does this example works for someone? https://www.pulumi.com/docs/reference/pkg/aws/acm/certificate/#referencing-domain-validation-options-with-for-each-based-resources Looks really convoluted. I also tried just doing a:
    for x in cert.domain_validation_options:
        # add record here
    But seems like pulumi gets in an infinite loop
  • s

    sparse-state-34229

    02/18/2021, 10:10 PM
    I may be able to help
  • s

    sparse-state-34229

    02/18/2021, 10:10 PM
    one sec
  • s

    sparse-state-34229

    02/18/2021, 10:11 PM
    this is highly specific, but should get you going:
    self.resource = acm.Certificate(
                self.resource_name,
                domain_name=self.domain_name,
                validation_method="DNS",
                **self.options,
                opts=ResourceOptions(parent=self),
            )
    
            validation_records = []
            sans = self.options.get("subject_alternative_names", [])
    
            for idx, name in enumerate([self.domain_name] + sans):
                options = self.resource.domain_validation_options[idx]
                validation_records.append(
                    self.validation_record(
                        name=name, options=options, declare_record=declare_record
                    )
                )
    
            acm.CertificateValidation(
                self.resource_name,
                certificate_arn=self.resource.arn,
                validation_record_fqdns=validation_records,
                opts=ResourceOptions(parent=self),
            )
    
            export(f"acm.{self.domain_name}", self.resource.arn)
  • s

    sparse-state-34229

    02/18/2021, 10:13 PM
    validation_record
    method:
    def validation_record(self, name, options, declare_record):
            return declare_record(
                resource_name=name,
                stack_name=self.stack_name,
                dns_name=options.resource_record_name,
                zone_id=self.route53_zone_id,
                type=options.resource_record_type,
                records=[options.resource_record_value],
                ttl=60,
                allow_overwrite=True,
                parent=self,
            ).fqdn
    …which basically just calls
    route53.Record
    or whatever
  • c

    clever-plumber-29709

    02/18/2021, 10:14 PM
    thanks, will check it and test it
  • c

    clever-plumber-29709

    02/18/2021, 10:29 PM
    the prevoew works fine, maybe the example in the docs should be updated, but i have more questions. Why dows it returns an array of validation options? in which cases there is more that one item in that array?
  • s

    sparse-state-34229

    02/18/2021, 10:30 PM
    SANs
  • s

    sparse-state-34229

    02/18/2021, 10:30 PM
    each option represents one domain/fqdn
  • s

    sparse-state-34229

    02/18/2021, 10:31 PM
    there’s an issue or two, let me find them
  • s

    sparse-state-34229

    02/18/2021, 10:32 PM
    https://github.com/pulumi/pulumi-aws/issues/1201 / https://github.com/pulumi/pulumi/issues/5028
  • s

    sparse-state-34229

    02/18/2021, 10:32 PM
    but since you probably know how many names you want in the cert, you can enumerate
  • w

    wide-boots-22590

    02/20/2021, 11:55 AM
    Hello, everyone! Sorry, but i didn't find, how to create cloudfront using pulumi from scratch. Maybe someone can help me?
    s
    c
    • 3
    • 2
  • q

    quaint-electrician-41503

    02/24/2021, 11:13 PM
    I’d like to write something like this for a stack output where an API changed the exported name between versions
    try 
      output_value: str = stack.require_output("new_api_name")
    except Error:
      output_value: str = stack.require_output("old_api_name")
    I had an issue above when I tried this for a reference using “old_api_name”. How can I  write a python pulumi program that will behave as expected?
    r
    • 2
    • 2
  • r

    rhythmic-ambulance-86976

    02/28/2021, 7:24 PM
    hello, I'm working on getting a kubernetes cluster deployed and found that there are two different packages to do it on aws with two different sets of options. One is pulumi_aws, the second is pulumi_eks, which also has more options. Why are there two packages and are there any differences between them I should know about?
    b
    • 2
    • 1
  • b

    broad-hairdresser-1495

    03/02/2021, 5:03 PM
    Hi, im using Pulumi in python:
    from pulumi.x import automation as auto
    stack = auto.create_or_select_stack(stack_name=stack_name,
                                        project_name=project_name,
                                        program=pulumi_program)
    resp = stack.preview()
    this preview is without
    --diff
    , is it possible to use this with diff flag? Right now im changing this in
    Python391\Lib\site-packages\pulumi\x\automation\_stack.py
    def preview(self,
                    parallel: Optional[int] = None,.....
    from
    args = ["preview"]
    to
    args = ["preview", "--diff"]
    r
    • 2
    • 1
  • s

    shy-football-10348

    03/03/2021, 3:02 AM
    are there any examples of using integration tests in python?
    r
    • 2
    • 1
  • s

    shy-football-10348

    03/03/2021, 3:02 AM
    https://github.com/pulumi/examples/tree/31056c3480cc445e5d4d3a8a0a86977adce2bc5e/testing-integration
  • s

    shy-football-10348

    03/03/2021, 3:02 AM
    is this only for golang right now?
    c
    • 2
    • 1
  • s

    shy-sunset-67287

    03/08/2021, 2:43 PM
    Hey friendly people! Is there anywhere to get more info on these exceptions?
    w
    • 2
    • 4
  • a

    agreeable-ram-97887

    03/12/2021, 9:15 AM
    hello, is there a way to invoke
    pulumi up
    (or at least
    pulumi preview
    ) from within a python interpreter? I am trying to get into a debugger
    m
    s
    f
    • 4
    • 3
  • s

    sparse-state-34229

    03/15/2021, 5:10 AM
    what’s up with the change from
    get_ami
    to
    getAmi
    ? The former gives a deprecation warning but the latter raises an exception
    b
    • 2
    • 7
  • s

    sparse-state-34229

    03/15/2021, 5:12 AM
    with pulumi
    v2.22.0
    and pulumi-aws `3.32.2`:
    File "/Users/scott/Library/Caches/pypoetry/virtualenvs/pulumi-stacks-6O2qUYd5-py3.9/lib/python3.9/site-packages/hatch_pulumi/aws/launch_template.py", line 37, in __attrs_post_init__
            self.ami = self.ami or ec2.getAmi(**self.ami_filter).id
        AttributeError: module 'pulumi_aws.ec2' has no attribute 'getAmi'
        error: an unhandled error occurred: Program exited with non-zero exit code: 1
    c
    • 2
    • 6
  • s

    sparse-state-34229

    03/16/2021, 7:41 AM
    is anyone using
    identifier_prefix
    with
    rds.Instance
    ? I am getting an error about conflicting with
    identifier
    but am only setting prefix…
    self.resource = rds.Instance(
                self.component.resource_name,
                allocated_storage=self.allocated_storage,
                allow_major_version_upgrade=self.allow_major_version_upgrade,
                auto_minor_version_upgrade=self.auto_minor_version_upgrade,
                backup_window=self.backup_window,
                db_subnet_group_name=subnet_group.name,
                engine=self.engine,
                identifier_prefix=self.name_prefix,
                instance_class=self.instance_class,
                maintenance_window=self.maintenance_window,
                password=self.password,
                port=self.port,
                username=self.username,
                security_group_names=self.security_group_names,
                tags=self.tags,
                opts=ResourceOptions(parent=self.component),
            )
    g
    • 2
    • 3
Powered by Linen
Title
s

sparse-state-34229

03/16/2021, 7:41 AM
is anyone using
identifier_prefix
with
rds.Instance
? I am getting an error about conflicting with
identifier
but am only setting prefix…
self.resource = rds.Instance(
            self.component.resource_name,
            allocated_storage=self.allocated_storage,
            allow_major_version_upgrade=self.allow_major_version_upgrade,
            auto_minor_version_upgrade=self.auto_minor_version_upgrade,
            backup_window=self.backup_window,
            db_subnet_group_name=subnet_group.name,
            engine=self.engine,
            identifier_prefix=self.name_prefix,
            instance_class=self.instance_class,
            maintenance_window=self.maintenance_window,
            password=self.password,
            port=self.port,
            username=self.username,
            security_group_names=self.security_group_names,
            tags=self.tags,
            opts=ResourceOptions(parent=self.component),
        )
g

gentle-diamond-70147

03/16/2021, 4:40 PM
This is a bug. https://github.com/pulumi/pulumi-aws/issues/1184#issuecomment-715614674
s

sparse-state-34229

03/16/2021, 4:48 PM
ahh thanks, I looked but was searching for the Python case `identifier_prefix`….thank you!
I had a feeling Pulumi was setting the identifier but couldn’t find it in the code
View count: 2