typescript is new to me - am I doing something wro...
# general
f
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
@fancy-magazine-29876 is that from logging the value of
autoscalingGroups
?
f
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
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
@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
There are a few different ways to do this - can you outline what you’re using the values for in your program?
f
i want to loop through all ASG names found and create autoscaling group attachments for the target groups that get created