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

    colossal-room-15708

    09/08/2019, 6:28 AM
    Alternatively, is there a
    local-exec
    equivalent?
  • m

    millions-farmer-54084

    09/08/2019, 8:57 PM
    Are there any Integration test tools; like
    molecule
    for Ansible? Or do we use the
    golang
    tool as described in https://www.pulumi.com/blog/testing-your-infrastructure-as-code-with-pulumi/ ?
    w
    • 2
    • 1
  • w

    white-jewelry-95626

    09/09/2019, 3:38 PM
    Hi all, I am trying create an appautoscaling target resource for a ecs service but I keep getting this error msg Error creating application autoscaling target: ValidationException: ECS service doesn't exist: service/<pulumi.output.Output object at 0x7f5d98103358>/<pulumi.output.Output object at 0x7f5d88ef0e80>
  • w

    white-jewelry-95626

    09/09/2019, 3:39 PM
    my assumption is referencing the cluster and service to get the names does not resolve though I have added them as dependables for the autoscaling target
  • w

    white-jewelry-95626

    09/09/2019, 3:40 PM
    stageapps_project_service = ecs.Service( resource_name= app_name +'-project_service', name=app_name, task_definition=stageapps_ts_task_definition.arn, desired_count=1, launch_type="FARGATE", cluster=ecs_cluster_name, network_configuration={ 'security_groups': [stageapps_ts_security_group], 'subnets': [private_subnets[0].id, private_subnets[1].id, private_subnets[2].id] }, load_balancers=[{ 'target_group_arn': alb_target_group.arn, 'container_name': 'nginx-node-proxy', 'container_port': app_container_port }], opts=pulumi.ResourceOptions(depends_on=[alb_target_group, load_balancer, stageapps_ts_task_definition]) ) appautoscaling_target = appautoscaling.Target( resource_name=app_name + '-appautoscaling_target', service_namespace='ecs', opts=pulumi.ResourceOptions(depends_on=[stageapps_project_service, ecs_module.ecs_cluster]), resource_id='service/' + str(ecs_cluster_name) + '/' + str(stageapps_project_service.name), scalable_dimension='ecsπŸ˜’ervice:DesiredCount', role_arn=ecs_autoscale_role_arn, min_capacity=scaling_min_capacity, max_capacity=scaling_max_capacity
  • n

    numerous-easter-93888

    09/09/2019, 7:22 PM
    Hi all, I'm having a little difficulty determining exactly how to import outputs from another stack in AWS. Specifically, I have a VPC stack I'm using for all my networking and I need to pull in VPC ID and a bunch of subnet IDs. I have those outputting properly but the example on the site isn't very clear for AWS... Is it as simple as defining a StackReference, then pulling in the output from stack.get_output(), like so?
    infra = pulumi.StackReference("my/project/stack")
    public_subnet_ids = pulumi_aws.Provider("aws", {'public_subnet_ids': infra.get_output('Public Subnet IDs'))
    private_subnet_ids = 'pulumi_aws.Provider("aws", {'web_subnet_ids': infra.get_output('Web Private Subnet IDs')
    vpc_id = pulumi_aws.Provider("aws", {'vpc_id': infra.get_output('vpc_id')})
    h
    • 2
    • 17
  • c

    colossal-barista-38672

    09/10/2019, 8:06 PM
    Hi all, I am installation pulumi in container ubuntu but the end setup "pip3 install -r requirements.txt" generates an error. Any recommendation. I use link https://www.pulumi.com/docs/get-started/azure/review-project/ for the installation. (venv) root@d4956ca4dfa4:/quickstart# pip3 install -r requirements.txt Collecting pulumi>=1.0.0 (from -r requirements.txt (line 1)) Using cached https://files.pythonhosted.org/packages/e1/fb/6597c0679953e09a e758fb2db3a545ffbce426e6433dd6c466c32dcba43d/pulumi-1.0.0-py2.py3-none-any.wh l Collecting pulumi-azure>=1.0.0 (from -r requirements.txt (line 2)) Using cached https://files.pythonhosted.org/packages/8f/76/1cf9e1e4e1e8d132 22a34034d388fcb03d4d973f46cc1249e4caa9bb6bbf/pulumi_azure-1.0.0.tar.gz ERROR: Command errored out with exit status 1: command: /quickstart/venv/bin/python3 -c 'import sys, setuptools, tokeni ze; sys.argv[0] = '"'"'/tmp/pip-install-5o8b904z/pulumi-azure/setup.py'"'"'; file='"'"'/tmp/pip-install-5o8b904z/pulumi-azure/setup.py'"'"';f=getattr( tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'" ', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg _info --egg-base pip-egg-info cwd: /tmp/pip-install-5o8b904z/pulumi-azure/ Complete output (9 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-5o8b904z/pulumi-azure/setup.py", line 33, in <mo dule> long_description=readme(), File "/tmp/pip-install-5o8b904z/pulumi-azure/setup.py", line 28, in rea dme return f.read() File "/quickstart/venv/lib/python3.6/encodings/ascii.py", line 26, in d ecode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 436: ordinal not in range(128) ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    f
    h
    • 3
    • 5
  • f

    fast-hamburger-46413

    09/15/2019, 2:22 AM
    Hello all, just curious, is there any example that shows reading the config (
    pulumi up -c var1=val1,var2=val2
    ) and / or configuration files (
    pulumi up --config-file
    ) in the python code?
    l
    • 2
    • 10
  • f

    fast-hamburger-46413

    09/15/2019, 2:25 AM
    Also, what the format of config file should be? Does it like this (say,
    config-file.txt
    ):
    var1=val1
    var2=val2
    ...
    Or it’s exact the same as
    .tfvars
    file?
  • g

    gray-nest-70702

    09/16/2019, 3:36 PM
    Sharing this issue here in case anyone else sees
    TypeError: unsupported operand type(s) for +: 'dict_values' and 'list'
    . https://github.com/pulumi/pulumi/issues/3235
  • b

    better-actor-92669

    09/17/2019, 9:36 AM
    Hi everyone! I want to separate my GCP cloud resources by categories. I use pulumi's
    gcp-python
    . For instance, I want to store my buckets definitions in a separate directory or in python terms, simply in a separate python package, instances in another one, vpn and network definition in yet another one, and so on. With the directory structure below, I managed to import packages' code into pulumi's
    __main__.py
    and make it work. Nevertheless, I don't like that I have to do import statements
    import pulumi
    from pulumi_gcp import storage
    both in a package module and in
    __main__.py
    itself. I know that am probably doing this wrong, so my question is: What is the best practice to separate pulumi resources as python packages? I would really appreciate some examples of how some of you do that. tree structure:
    (pulumi_venv) some_user@MAC-C02YG37SJGH some-pulumi (master) $ tree
    .
    β”œβ”€β”€ Pulumi.dev.yaml
    β”œβ”€β”€ Pulumi.yaml
    β”œβ”€β”€ __main__.py
    β”œβ”€β”€ __pycache__
    β”‚   └── __main__.cpython-37.pyc
    β”œβ”€β”€ buckets
    β”‚   β”œβ”€β”€ __init.py__
    β”‚   β”œβ”€β”€ __pycache__
    β”‚   β”‚   β”œβ”€β”€ bucket_func.cpython-37.pyc
    β”‚   β”‚   └── bucket_plain.cpython-37.pyc
    β”‚   β”œβ”€β”€ bucket_func.py
    β”‚   └── bucket_plain.py
    └── requirements.txt
    
    3 directories, 10 files
    buckets/bucket_func.py which has a bucket creation within a function:
    import pulumi
    from pulumi_gcp import storage
    
    
    def create_bucket5():
        # Create a GCP resource (Storage Bucket)
        bucket = storage.Bucket('pulumi-test-bucket-5', name="pulumi-test-bucket-5")
    
        # Export the DNS name of the bucket
        pulumi.export('bucket_name',  bucket.url)
    buckets/bucket_plain.py which is a plain code file not wrapped into a function or something:
    import pulumi
    from pulumi_gcp import storage
    
    # Create a GCP resource (Storage Bucket)
    bucket = storage.Bucket('pulumi-test-bucket-5', name="pulumi-test-bucket-5")
    
    # Export the DNS name of the bucket
    pulumi.export('bucket_name',  bucket.url)
    and the main.py for the buckets/bucket_func
    import pulumi
    from pulumi_gcp import storage
    
    -->>import buckets.bucket_func
    
    # State bucket
    # Create a GCP resource (Storage Bucket)
    bucket1 = storage.Bucket('pulumi-test-bucket-2')
    
    # Export the DNS name of the bucket
    pulumi.export('bucket_name',  bucket1.url)
    
    -->>buckets.bucket_func.create_bucket5()
    and also the main.py for the second case buckets/bucket_plain:
    import pulumi
    from pulumi_gcp import storage
    
    -->>import buckets.bucket_plain
    
    # State bucket
    # Create a GCP resource (Storage Bucket)
    bucket1 = storage.Bucket('pulumi-test-bucket-2')
    
    # Export the DNS name of the bucket
    pulumi.export('bucket_name',  bucket1.url)
    In both cases it works and creates a
    pulumi-test-bucket-5
    bucket. Please note the
    pulumi-test-bucket-2
    in
    __main__.py
    is just a state bucket for pulumi.
    (pulumi_venv) some_user@MAC-C02YG37SJGH some-pulumi (master) $ pulumi up
    Enter your passphrase to unlock config/secrets
        (set PULUMI_CONFIG_PASSPHRASE to remember):
    Previewing update (dev):
    
         Type                   Name                  Plan
         pulumi:pulumi:Stack    lodgify-pulumi-dev
     +   └─ gcp:storage:Bucket  pulumi-test-bucket-5  create
    
    Resources:
        + 1 to create
        2 unchanged
    
    Do you want to perform this update?
      yes
    > no
      details
    n
    • 2
    • 7
  • b

    boundless-room-36997

    09/17/2019, 1:51 PM
    Hello everyone, does anybody use pulumi in production using python ? What is the state of python in pulumi as most of the examples are in typescript or javascript ...
    c
    • 2
    • 1
  • s

    stocky-spoon-28903

    09/17/2019, 2:07 PM
    @boundless-room-36997 Several people are running in production with Python - including enterprise customers we (sadly!) aren’t necessarily able to name. (I’ll defer to @big-piano-35669 or @white-balloon-205 to do so if we can!)
  • s

    stocky-spoon-28903

    09/17/2019, 2:07 PM
    The examples are primarily typescript and javascript, but the same surface area is exposed via Python too.
  • a

    alert-monitor-28534

    09/18/2019, 5:20 AM
    Hi, just got a bare-metal cluster up with Rancher's RKE, and I'm now following the Python intro @ https://www.pulumi.com/docs/intro/languages/python/, but Pulumi fails to connect to the cluster even though
    kubectl
    works:
    Python Kubernetes connect issue
    g
    w
    • 3
    • 6
  • a

    alert-monitor-28534

    09/18/2019, 2:33 PM
    Anyone?
  • s

    sparse-cpu-53654

    09/18/2019, 4:42 PM
    has anyone successfully installed
    pulumi-kubernetes
    recently (e.g. with pip)? it's failing for me during setup.py in multiple environments
    • 1
    • 1
  • q

    quick-australia-29016

    09/19/2019, 4:30 AM
    I use this config to setup ssh-key in pulumi_gcp.compute.Instance but it does not affect
    • 1
    • 2
  • f

    fast-hamburger-46413

    09/24/2019, 7:49 AM
    Hello, just curious on how to get the runtime credential iam role_arn in python. I tried to provide role_arn while creating eks cluster (pulumi_aws.eks.Cluster), which is mandatory.
  • f

    fast-hamburger-46413

    09/24/2019, 7:50 AM
    I also notice that in TS, create eks cluster does not need to provide roleArn.
  • f

    fast-hamburger-46413

    09/24/2019, 7:53 AM
    I also provided a fixed Arn (myself, an admin under admin groups) but doesn’t get passed
  • f

    freezing-artist-51725

    09/26/2019, 12:57 AM
    any example on how to add nodepool to gke cluster for python?
    f
    • 2
    • 1
  • w

    white-jewelry-95626

    09/27/2019, 9:41 AM
    Hi folks, does anyone know how to resolve the state of Pulumi stack state after a timeout. I was running pulumi up through a ci/cd runner, the runner time'd out while a cloudfront distribution was in progress of being deployed, on the next ran, the cloudfront distro is deployed but is not in Pulumi state, so pulumi tries to create it again and fails with a message of resource already exist. I know it is possible to just delete the resource on aws and run pulumi again but was wondering if there is any other time saving option and leaning towards automation. Thanks
    f
    b
    • 3
    • 7
  • a

    alert-monitor-28534

    10/02/2019, 6:49 AM
    Anybody got some simple example on how to use
    transformations
    with Helm charts? I'd like to change ingress values of Jenkins chart and I've mostly found examples with JS etc. which I really don't understand.
  • c

    clean-engineer-75963

    10/04/2019, 4:47 PM
    Hello. Brand new to Pulumi as of yesterday. I'm trying it out with Python since the Golang support hasn't fully landed yet. Is there a way I can get the value of an Output as a Python primitive? I'm trying to pass one to
    base64.b64encode
    and it's not working since it's a
    pulumi.Output
    and not a bytes-like object.
    n
    • 2
    • 9
  • c

    clean-engineer-75963

    10/04/2019, 5:08 PM
    I'm still having some trouble and I think I created an XY problem for myself before... what I'm actually trying to do is use the
    pulumi_random
    provider to generate a password, then store it in a Kubernetes secret with
    pulumi_kubernetes
    . The code looks like this:
    python
    password = pulumi_random.RandomPassword(password_name, length=32)
    
    secret = corev1.Secret(
        password_name,
        data={"pw": password.result.apply(lambda result: base64.b64encode(result.encode("utf-8")))},
    )
    n
    c
    • 3
    • 20
  • c

    clean-engineer-75963

    10/04/2019, 5:44 PM
    Pulumi is getting stuck trying to create a headless Kubernetes service.
    g
    c
    • 3
    • 12
  • c

    clean-engineer-75963

    10/04/2019, 9:45 PM
    The pulumi-terraform Python SDK requires a really old version of pulumi that's making it incompatible with the rest of the pulumi modules I'm trying to use: https://github.com/pulumi/pulumi-terraform/blob/v1.0.0/sdk/python/setup.py#L46
    w
    • 2
    • 3
  • c

    clean-engineer-75963

    10/04/2019, 11:18 PM
    I've noticed in two cases today that typos in my Kubernetes configuration have just silently omitted the misconfigured part of the spec, instead of warning or erroring on
    pulumi up
    .
    c
    • 2
    • 17
  • w

    white-jewelry-95626

    10/07/2019, 1:59 PM
    Hi Folks, does anyone have a reusable component created in python I could use as example.
Powered by Linen
Title
w

white-jewelry-95626

10/07/2019, 1:59 PM
Hi Folks, does anyone have a reusable component created in python I could use as example.
View count: 1