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
general
  • t

    tall-monitor-77779

    10/23/2018, 4:29 PM
    I’m trying to get the
    vpcId
    returned when creating a
    cloud.Service
    which is in
    service.cluster.network.vpcId
    if I export
    service.cluster.network
    I see the vpcId but I can’t for the life of me manage to get it in code to be able to use it to create other resources. Help!
  • q

    quick-action-34599

    10/23/2018, 4:31 PM
    is it something you need to
    await
    ?
  • t

    tall-monitor-77779

    10/23/2018, 4:34 PM
    let me try, I’m actually creating the resources in a class constructor so awaiting is a little tricky, will do a little bit of refactoring
  • t

    tall-monitor-77779

    10/23/2018, 4:35 PM
    I don’t see much async/await in pulumi code
  • t

    tall-monitor-77779

    10/23/2018, 4:38 PM
    I’m trying to do something like this:
    let service = new cloud.Service(name, {
        containers: {
            nginx: {
                image: "nginx",
                memory: 2048,
                ports: [
                    { port: 80 },
    
                ],
            },
        },
        replicas: 1
    });
    
    let disco = new aws.servicediscovery.PrivateDnsNamespace("test", {
         description: "test",
         name: "test",
         vpc: service.cluster.network.vpcId.apply(v => v);
    })
  • q

    quick-action-34599

    10/23/2018, 4:42 PM
    is that your actual code? because you have a semicolon where there should be a comma
  • q

    quick-action-34599

    10/23/2018, 4:42 PM
    which I would expect would raise TS errors
  • t

    tall-monitor-77779

    10/23/2018, 4:43 PM
    yeah I just hacked it together as a simple example, so might not be syntactically correct
  • q

    quick-action-34599

    10/23/2018, 4:43 PM
    right ok
  • q

    quick-action-34599

    10/23/2018, 4:43 PM
    What happens if you take out the
    .apply(v => v)
    ? I'm doing similar stuff without using
    apply
    . pulumi seems to know how to wait for outputs when necessary
  • s

    stocky-spoon-28903

    10/23/2018, 4:44 PM
    Yes - you shouldn’t need the apply with an identity function there
  • t

    tall-monitor-77779

    10/23/2018, 4:44 PM
    value is null
  • t

    tall-monitor-77779

    10/23/2018, 4:44 PM
    but it prints absolutely fine in an
    exports
  • s

    stocky-spoon-28903

    10/23/2018, 4:45 PM
    So
    vpcId
    there will be a
    pulumi.Output<T>
    , and the
    vpc
    parameter for PrivateDnsNamespace should be a
    pulumi.Input<T>
    , defined as (something like):
    T | Promise<T> | Output<T>
  • t

    tall-monitor-77779

    10/23/2018, 4:45 PM
    I’m also having to cast to a
    awsinfra.Network
    to be able to get at the vpcId property
  • s

    stocky-spoon-28903

    10/23/2018, 4:45 PM
    ah - that might be related
  • t

    tall-monitor-77779

    10/23/2018, 4:46 PM
    well I say cast, in TS land
  • q

    quick-action-34599

    10/23/2018, 4:46 PM
    Would
    awsinfra.Network.getDefault()
    work? Services created by pulumi use the existing default I believe
  • t

    tall-monitor-77779

    10/23/2018, 4:47 PM
    ah thats the whole point, I’m using a private Vpc (thats a whole new story)
  • q

    quick-action-34599

    10/23/2018, 4:47 PM
    ah-ha
  • t

    tall-monitor-77779

    10/23/2018, 4:53 PM
    putting inside an async function makes no different
  • t

    tall-monitor-77779

    10/23/2018, 4:54 PM
    I’ve throw the kitchen sink at it but just get
    Missing required property 'vpc'
  • q

    quick-action-34599

    10/23/2018, 5:03 PM
    @tall-monitor-77779 so
    service.cluster
    is interface
    CloudCluster
    , which doesn't have a
    network
    prop, afaict: https://pulumi.io/reference/pkg/nodejs/@pulumi/cloud-aws/#CloudCluster
  • t

    tall-monitor-77779

    10/23/2018, 5:23 PM
    correct but if you trace the code back, a
    awsinfra.Network
    is passed and you can see it if you export the
    service.Cluster
  • q

    quick-action-34599

    10/23/2018, 5:23 PM
    I dunno then 😞
    🤯 1
  • t

    tall-monitor-77779

    10/23/2018, 5:57 PM
    I’ve created a simplified test if anyone wants to have a look
  • t

    tall-monitor-77779

    10/23/2018, 5:57 PM
    https://github.com/danny-waite/pulumi-service-test
    w
    • 2
    • 1
  • s

    stocky-spoon-28903

    10/23/2018, 5:59 PM
    I think I have an idea what the issue may be
  • s

    stocky-spoon-28903

    10/23/2018, 5:59 PM
    Give me a few mins and I’ll take a closer look
  • o

    orange-tailor-85423

    10/23/2018, 8:16 PM
    Team collaboration - so right now during a PoC - only way to share state is the Team edition?
Powered by Linen
Title
o

orange-tailor-85423

10/23/2018, 8:16 PM
Team collaboration - so right now during a PoC - only way to share state is the Team edition?
View count: 1