https://pulumi.com logo
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
  • i

    incalculable-dream-27508

    06/01/2020, 5:36 PM
    goes to read up on that
  • s

    sparse-state-34229

    06/01/2020, 5:56 PM
    you probably just want to directly call
    openstack.networking.Network.get()
    or something
  • i

    incalculable-dream-27508

    06/01/2020, 6:14 PM
    Mhmm, that indeed works syntax-wise, though I'm not sure yet how to use it. Attempts like
    my_net = openstack.networking.Network.get('my_net_name', 'uuid_from_openstack')
    and then
    instance = openstack.compute.Instance("name", networks=[my_net])
    (shortened) complains about
    Instance resource 'name' has a problem: network.0: expected object, got string
    w
    • 2
    • 1
  • i

    incalculable-dream-27508

    06/01/2020, 6:15 PM
    Same with using it directly like
    instance = openstack.compute.Instance("name", networks=[openstack.networking.Network.get('my_net_name', 'uuid_from_openstack')])
  • s

    sparse-state-34229

    06/01/2020, 6:18 PM
    i think you need the id generated by pulumi
  • s

    sparse-state-34229

    06/01/2020, 6:18 PM
    not the openstack resource id
  • s

    sparse-state-34229

    06/01/2020, 6:19 PM
    i haven’t used .get anywhere, i wonder if any of the examples use it. have you checked?
  • i

    incalculable-dream-27508

    06/01/2020, 6:22 PM
    I'm not sure I've seen any openstack examples, but indeed I didn't think to look at the main examples repo
  • i

    incalculable-dream-27508

    06/01/2020, 6:23 PM
    Yeah, https://github.com/pulumi/examples/search?q=openstack&unscoped_q=openstack returns nothing
  • i

    incalculable-dream-27508

    06/01/2020, 6:25 PM
    Hm, though I guess I should read about pulumi import scenarios
  • s

    sparse-state-34229

    06/01/2020, 6:58 PM
    what about other get calls?
  • c

    chilly-hairdresser-56259

    06/02/2020, 4:03 PM
    I am trying to get image_name from the Image() function from Alpha's pulumi-docker, however whenever I call
    ui_image.image_name
    it returns a
    pulumi.Output.output object
    , which is expected however I need to insert the value as a string so I can create the container_definition. My question is how are you going about this? I thought the following would work, however it fails still. Maybe its plain as day and I just been staring at it too long. Error returns
    Container.image contains invalid characters.
    Untitled.txt
    f
    • 2
    • 14
  • m

    many-pencil-56466

    06/03/2020, 11:11 PM
    Hi, trying out pulumi so far looks pretty neat but stuck at some seemingly obvious problem. Is it possible to do the below in pulumi, i tried using trigger nd this is what i have
    gcloud builds submit --tag <http://gcr.io/${GCP_PROJECT}/${APP}|gcr.io/${GCP_PROJECT}/${APP}> --project=${GCP_PROJECT}
    g
    • 2
    • 6
  • m

    many-pencil-56466

    06/03/2020, 11:11 PM
    def Image(app="pasteit",location="asia-northeast1", project="leadmrktr"):
        img = gcp.cloudbuild.Trigger(
            "pasteit-http",
            build={
                "step": [{"name":"pasteit","dir": ".."}]
    
            },
            project=project,
            trigger_template={
                "dir": "..",
                "tag_name":  "<http://gcr.io/{}/{}|gcr.io/{}/{}>".format(project,app)
            })
        return img
    • 1
    • 1
  • c

    chilly-hairdresser-56259

    06/04/2020, 9:53 PM
    Is there a way to set AWS Account settings? I am looking through their API reference and not finding it. It also maybe somewhere else too. Settings such as enabling ecs
    vpctrunking, container insights
    g
    • 2
    • 2
  • n

    nutritious-shampoo-16116

    06/09/2020, 2:17 PM
    does
    Output.all
    accept only up to 5 args?
    ❓ 1
    f
    • 2
    • 2
  • s

    shy-football-10348

    06/10/2020, 12:18 AM
    Hi folks, I am trying to access an output value in Python and running into some issues. I read this documentation (https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs-and-strings) and tried to implement the
    apply
    all
    and
    concat
    functions, but couldn't get the Pulumi object to convert to a string. The documentation is mainly focused on multiple values or list values and doesn't have a section for a single string variable as far as I can tell. Additionally, I looked at each Python example found here (https://github.com/pulumi/examples) and couldn't find any that implemented this use case, and could I find any third-party blogs that do either. For reference, I am trying to access the
    repository_url
    string that is output from the
    ecr.Repository
    function.
    ecr = aws.ecr.Repository(
        "jupyterhub",
        name="jupyterhub",
        image_scanning_configuration={
            "scanOnPush": True,
        },
        image_tag_mutability="MUTABLE"
    )
    Has anyone done this in the past and can assist? Thank you all!
    s
    • 2
    • 1
  • s

    shy-football-10348

    06/10/2020, 12:23 AM
    I would like to say something like:
    url = ecr.repository_url
    or
    url = ecr['repository_url']
    g
    s
    c
    • 4
    • 13
  • s

    shy-football-10348

    06/10/2020, 12:24 AM
    Looks like my answer may exist in here somewhere (https://www.pulumi.com/docs/reference/pkg/python/pulumi/#outputs-and-inputs%C2%B6)
  • s

    strong-plastic-28250

    06/10/2020, 3:50 PM
    Is there a “tell” or sure fire way when we know when we need to use apply() outside of running pulumi up and finding out on resource creation?
    g
    • 2
    • 3
  • i

    incalculable-dream-27508

    06/11/2020, 2:05 PM
    I'd like to apologise for disappearing earlier. I'm starting playing with this anew, and https://www.pulumi.com/docs/guides/adopting/import/ seems to be helping.
  • i

    incalculable-dream-27508

    06/11/2020, 4:21 PM
    OK, but I'm apparently back to where I was. I have
    my_net = openstack.networking.Network("Network-Name-As-Seen-In-Openstack", admin_state_up="true", name="Network-Name-As-Seen-In-Openstack", opts=pulumi.ResourceOptions(import_='network-uuid-from-openstack'))
    define a security group
    sec_git
    with some rules, and then
    instance = openstack.compute.Instance("my_test.example.internal", flavor_name="some_flavor", image_name="image_name", key_pair="my_key", security_groups=[sec_git], networks=[my_net])
    and when I do
    pulumi preview
    it complains about
    error: openstack:compute/instance:Instance reousrce 'my_test.example.internal' has a problem: network.0: expected object, got string
  • i

    incalculable-dream-27508

    06/11/2020, 4:22 PM
    I tried
    networks=[my_net.id]
    which I saw in examples how you add security rules to a security group, but that doesn't change the error message
  • i

    incalculable-dream-27508

    06/11/2020, 4:30 PM
    And https://www.pulumi.com/docs/reference/pkg/openstack/compute/instance/#instancenetwork doesn't help me figure out what I need to put there
    f
    • 2
    • 7
  • c

    chilly-hairdresser-56259

    06/11/2020, 7:04 PM
    Quick question regarding output manipulation. I have tried both
    Output.all().apply()
    and just
    apply()
    and I am unable to convert the output to string. I am attempting to create an AppAutoscaling Target which requires the resources Id structure of
    service/ECS Cluster Name/ECS Service Name
    , however I am unable to correctly convert it. Even so I would expect if I just try to print the output manipulation I should see the actual value. Example
    print(service[0].name.apply(lambda vals: f"""{vals}"""))
    returns
    <pulumi.output.Output object at 0x7fcc88389b50>
    I would expect the actual ECSService Name. I created a wrapper function which output multiple returns thus the index
    0
    . Another thing I tested was
    service[0].Output.all(service[0].name).apply(lambda vals: f"""{vals}""")
    which still results with ``<pulumi.output.Output object at 0x7fcc88389b50>`
  • s

    sparse-state-34229

    06/11/2020, 7:04 PM
    Output.all()
    returns a list of lists
  • s

    sparse-state-34229

    06/11/2020, 7:05 PM
    also stop using print, it just doesn’t work unfortunately
  • s

    sparse-state-34229

    06/11/2020, 7:05 PM
    https://gist.github.com/ohlol/330bc4fd062700dde7d8fd15cf3e18ab
  • s

    sparse-state-34229

    06/11/2020, 7:06 PM
    oh actually for you it may just be a list
  • s

    sparse-state-34229

    06/11/2020, 7:06 PM
    that gist may not need to pass a list to
    Output.all()
    . TIL!
Powered by Linen
Title
s

sparse-state-34229

06/11/2020, 7:06 PM
that gist may not need to pass a list to
Output.all()
. TIL!
View count: 1