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

    better-actor-92669

    12/02/2019, 11:26 AM
    message has been deleted
  • c

    clever-nest-47198

    12/03/2019, 4:23 PM
    from the PR implementing dynamic providers for Python: https://github.com/pulumi/pulumi/pull/2900
    So any resource created with Python 3.x.y can only be updated by exactly the same version of Python.
    Is this still true?
  • c

    clever-nest-47198

    12/03/2019, 5:06 PM
    still true, uses dill internally still
    b
    s
    • 3
    • 3
  • n

    nutritious-airline-70839

    12/04/2019, 10:07 AM
    Hi there! Is there the
    awsx
    for pulumi for python?
  • n

    nutritious-airline-70839

    12/04/2019, 10:08 AM
    ...if so, how do I install it?
  • a

    astonishing-spoon-27005

    12/04/2019, 4:10 PM
    crosswalk is typescript-only at the moment šŸ˜ž
  • n

    nutritious-airline-70839

    12/04/2019, 4:39 PM
    okay, thanks!
  • c

    clean-engineer-75963

    12/05/2019, 10:05 PM
    Creating an AWS tag from the name value of a Kubernetes output:
    tags={
        "Name": f"{config.require('cluster.name')}_"
                f"{base_namespace.metadata['name'].apply(lambda x: str(x))}_backups",
    }
    Is giving me this tag:
    clustername_<pulumi.output.Output object at 0x7f1d972fa160>_backups
    q
    m
    • 3
    • 5
  • c

    clever-nest-47198

    12/05/2019, 10:11 PM
    thats because the name is only a string within the apply function
  • c

    clean-engineer-75963

    12/05/2019, 10:15 PM
    How am I supposed to be doing this?
  • c

    clever-nest-47198

    12/05/2019, 10:16 PM
    theres way simpler ways than this ^ but this is the easiest to explain I think
    Untitled
  • m

    mysterious-egg-7415

    12/06/2019, 2:06 AM
    Use `pulumi.Output.concat()`:
    cluster_name = config.require("cluster.name")
    
    tags = {
        "Name": pulumi.Output.concat(cluster_name, "_", base_namespace.metadata['name'], "_backups")
    }
  • c

    clever-nest-47198

    12/06/2019, 1:38 PM
    ah yeah thats way cleaner
  • c

    clean-engineer-75963

    12/06/2019, 5:17 PM
    Anyone have tips for getting a reference to a Kubernetes Pod created by a deployment? The Pod's name isn't known, so core.v1.Pod.get doesn't seem like it will work.
    g
    • 2
    • 14
  • c

    clean-engineer-75963

    12/06/2019, 7:01 PM
    Are incomplete Python docs a known problem? For example, https://www.pulumi.com/docs/reference/pkg/python/pulumi_vault/: the pulumi-vault provider has root-level resources, but docs are only generated for subpackages.
    m
    • 2
    • 4
  • c

    clean-engineer-75963

    12/06/2019, 10:32 PM
    I think pulumi_vault might be badly broken. I don't seem to be able to import
    Token
    , from this file: https://github.com/pulumi/pulumi-vault/blob/master/sdk/python/pulumi_vault/token.py
    w
    • 2
    • 8
  • c

    clean-engineer-75963

    12/10/2019, 12:15 AM
    I tried to create a Pulumi resource inside a context manager (
    with
    block) and it doesn't seem to be respecting the context. Details to follow...
    w
    • 2
    • 11
  • b

    better-actor-92669

    12/12/2019, 11:04 AM
    message has been deleted
  • c

    clean-engineer-75963

    12/13/2019, 11:33 PM
    One of my pulumi-managed Kubernetes Deployments was mysteriously deleted from Kubernetes, presumably by pulumi, and now pulumi doesn't think it needs to recreate it.
    w
    • 2
    • 7
  • c

    clean-engineer-75963

    12/16/2019, 10:13 PM
    I'm still struggling with port-forwarding to a pod during Pulumi setup, but am making progress. Here's the code I have currently:
    PORT_FORWARD = None
    
    def get_vault_port_forward_address(vault_deployment_metadata):
        """Wait for a Vault Pod to become leader, port-forward to it, and return its address."""
    
        namespace = vault_deployment_metadata["namespace"]
        vault_component = vault_deployment_metadata["labels"]["component"]
    
        def get_ready_vault_pod():
            kubernetes.config.load_kube_config()
            client = kubernetes.client.CoreV1Api()
    
            while True:
                pods = client.list_namespaced_pod(
                    namespace,
                    label_selector=f"component={vault_component}",
                )
    
                for pod in pods.items:
                    for status in pod.status.conditions:
                        if status.type == "Ready" and status.status == "True":
                            return pod.metadata.name
    
                time.sleep(2)
    
        # TODO: This port-forward will run for the remainder of the Pulumi program.
        # Find a way to tear it down as soon as we're done with it. The pulumi
        # programming model makes this tough.
        global PORT_FORWARD
        PORT_FORWARD = pexpect.spawn(
            "kubectl",
            ["-n", namespace, "port-forward", get_ready_vault_pod(), "8200:8200"],
            ignore_sighup=True)
        PORT_FORWARD.expect_exact("Forwarding from 127.0.0.1:8200 -> 8200\r\n")
        PORT_FORWARD.expect_exact("Forwarding from [::1]:8200 -> 8200\r\n")
    
        return "<https://127.0.0.1:8200>"
    
    # Vault provider to be used via port-forward.
    vault_provider = pulumi_vault.Provider(
        "vault-provider",
        address=vault_deployment.metadata.apply(
            get_vault_port_forward_address),
        skip_tls_verify=True,
        token="my-token",
    )
    I'm using a function in an apply to start the port-forward during initialization of the vault provider. Unfortunately I'm closing over a global variable so the port-forward persists outside of the apply.
    • 1
    • 7
  • b

    better-actor-92669

    12/17/2019, 12:41 PM
    Hi guys. Very simple question. I need to get the value of my gcp default region via pulumi config
    from pulumi import Config, export, get_project, get_stack, Output,\
        ResourceOptions
    
    config = Config(None)
    
    compute.Instance(...,
                     zone=config.get('gcp:region') + '-' +
                          zone_matcher.get(count + 1, 'a'),
                    )
    But it doesn't work, however in my stack's yaml file it is set up
    config:
      gcp:project: some-project
      gcp:region: europe-west3
    When I do
    config.require()
    it says that 'some-project:gcp:region' is not setup, and this is correct since I only set up secrets on some-projects level. Gcp region is under config key.
    error: Missing required configuration variable 'some-project:gcp:region'
            please set a value using the command `pulumi config set some-project:gcp:region <value>`
    How can I get the value of the project's default gcp:region?
    w
    g
    • 3
    • 8
  • l

    limited-honey-31480

    12/19/2019, 4:50 PM
    anyone have any examples of use of GCP DNS,SQL,NoSQL,Machine Learning or any other IA plataform to spare on python?
  • c

    colossal-plastic-46140

    12/20/2019, 6:25 PM
    Hi I was hoping I could get some eyes on this issue I filed a while back https://github.com/pulumi/pulumi/issues/3596. I used to have a work around for this, but now with 1.7.1, it appears to have returned.
  • b

    bright-orange-69401

    12/22/2019, 9:09 PM
    Does the import feature of Pulumi actually work ? I've tried over several AWS resources, the latest one being S3 : never managed to import a single thing. I got the following error message after running
    pulumi preview
    on the S3 example template I attached:
    Diagnostics:
    pulumišŸ˜›ulumi:Stack (nuage-admin-dev):
    error: preview failed
    awsšŸ˜’3:Bucket (nuage-test):
    error: Preview failed: importing arn:aws:s3:::nuage-test: Error importing AWS S3 bucket policy: InvalidARNError: invalid ARN
    caused by: invalid Amazon S3 ARN, unknown resource type, arn:aws:s3:::nuage-test
    __main__.py
    w
    • 2
    • 5
  • b

    bumpy-restaurant-1466

    12/24/2019, 4:09 AM
    I’m exploring using Pulumi for our infrastructure but am concerned about the heavy emphasis on Typescript. Is there anything with Pulumi that can be done with Typescript but not Python?
    b
    c
    • 3
    • 11
  • o

    orange-australia-91292

    12/26/2019, 3:57 PM
    Hi. New to Pulumi, I want to try it out, see how it fits compared to the-other-one. Working in Python. First question…
  • o

    orange-australia-91292

    12/26/2019, 3:59 PM
    Are these the docs: https://www.pulumi.com/docs/reference/pkg/python/pulumi_aws/s3/ ? Are there better docs, easier to navigate? Looking to create a bucket and it took a lot of scrolling to find the proper method
  • o

    orange-australia-91292

    12/26/2019, 5:14 PM
    I see there are a couple of issues in the docs repo to improve on Python, though they seem to have been put on hold indefinitely. Oh, well.
    w
    • 2
    • 2
  • o

    orange-australia-91292

    12/28/2019, 6:56 AM
    I’m doing:
    import pulumi
    from pulumi_aws import s3
    
    s3.Bucket.get("pm-images", "arn:aws:s3:::pm-images")
    and I get back
    error: Preview failed: importing arn:aws:s3:::pm-images: Error importing AWS S3 bucket policy: InvalidARNError: invalid ARN
    caused by: invalid Amazon S3 ARN, unknown resource type, arn:aws:s3:::pm-images
  • o

    orange-australia-91292

    12/28/2019, 6:56 AM
    as far as I can tell from the docs, this should work
Powered by Linen
Title
o

orange-australia-91292

12/28/2019, 6:56 AM
as far as I can tell from the docs, this should work
View count: 1