https://pulumi.com logo
#general
Title
# general
f

fancy-magazine-29876

01/15/2019, 2:06 AM
typescript is new to me - am I doing something wrong here? the following yields
{"__pulumiOutput":true,"isKnown":{}}
instead of what I expect to be an array of ASG names. this syntax works other places so I am confused
Copy code
const autoscalingGroups = pulumi.output(aws.getAutoscalingGroups({
      filters: [
          {
              name: "key",
              values: [`<http://kubernetes.io/cluster/${environment}`|kubernetes.io/cluster/${environment}`>],
          }
      ]
})).apply(v => v.names);
I see that
Invoke RPC finished: tok=aws:index/getAutoscalingGroups:getAutoscalingGroups;
does contain the autoscaling group names
s

stocky-spoon-28903

01/15/2019, 2:17 AM
@fancy-magazine-29876 is that from logging the value of
autoscalingGroups
?
f

fancy-magazine-29876

01/15/2019, 2:18 AM
no, its from debug and verbose doing a
pulumi preview
i dont know if its the way i'm running it but
console.log
is suppressed
nvm about console.log
console.log(JSON.stringify(autoscalingGroups));
shows up in preview:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (api-docs-api-docs-staging):
    {"__pulumiOutput":true,"isKnown":{}}
s

stocky-spoon-28903

01/15/2019, 2:28 AM
So what you have is an output of array of autoscaling group names, rather than an array of the names themselves - you can pass them to an input or similar,m
Hard to explain on a phone, if no one else has replied when I get home I’ll post more
👍 1
f

fancy-magazine-29876

01/15/2019, 5:03 PM
@stocky-spoon-28903 so maybe I'm just doing it wrong - maybe there's a better pattern for the equivalent of
data
resources in terraform? in many places I need to reference existing resources
wrapping in pulumi.output seemed to work fine in another repo but is not here
s

stocky-spoon-28903

01/15/2019, 6:47 PM
There are a few different ways to do this - can you outline what you’re using the values for in your program?
f

fancy-magazine-29876

01/15/2019, 6:49 PM
i want to loop through all ASG names found and create autoscaling group attachments for the target groups that get created
2 Views