sparse-state-34229
06/11/2020, 7:17 PMchilly-hairdresser-56259
06/11/2020, 7:17 PMsparse-state-34229
06/11/2020, 7:19 PMservice[0].name
?sparse-state-34229
06/11/2020, 7:19 PMchilly-hairdresser-56259
06/11/2020, 7:21 PMservice[0].name
would be the output from the ecs service. I need to get string format of the output for resource_id
in the appautoscaling. Format service/ecs cluster name/ecs service name
. Yes Function argumentsparse-state-34229
06/11/2020, 7:27 PMdo_something(service_name=service[0].name)
yeah?sparse-state-34229
06/11/2020, 7:28 PMdo_something()
within the apply lambdachilly-hairdresser-56259
06/11/2020, 7:29 PMappautoscalingTarget = aws.appautoscaling.Target(
resource_name= "%s-%s-%s-asg-target" % (p_env, tasks[x]['application'], tasks[x]['service']),
min_capacity= tasks[x]['minimumCapacity'],
max_capacity= tasks[x]['maximumCapacity'],
resource_id= f"service/{service[0].name}/{ecs_cluster.name}",
scalable_dimension= "ecs:service:DesiredCount",
service_namespace= "ecs"
)
chilly-hairdresser-56259
06/11/2020, 7:30 PMx
being the iterator of my list[dict{}] of ecs tasks configssparse-state-34229
06/11/2020, 7:32 PMappautoscalingTarget
?chilly-hairdresser-56259
06/11/2020, 7:35 PMappautoscalingTarget
I use create the scaling policies. So I then reference like such in the scaling policies: appautoscalingTarget.scalable_dimension
for the resource aws.appautoscaling.Policy
sparse-state-34229
06/11/2020, 7:36 PMsparse-state-34229
06/11/2020, 7:37 PMaws.appautoscaling.Policy
gentle-diamond-70147
06/11/2020, 7:40 PMservice
here?chilly-hairdresser-56259
06/11/2020, 7:40 PMservice
= ecs Service. service
creates multiple resources and returns two objects. ECS Service and taskDefinitiongentle-diamond-70147
06/11/2020, 7:47 PMappautoscalingTarget = aws.appautoscaling.Target(
resource_name= "my-target",
min_capacity= 1,
max_capacity= 2,
resource_id= Output.all(service[0].name, ecs_cluster.name).apply(lambda args: f"service/{args[0]}/{args[1]}"),
scalable_dimension= "ecs:service:DesiredCount",
service_namespace= "ecs"
)
gentle-diamond-70147
06/11/2020, 7:48 PMresource_id
input line :)gentle-diamond-70147
06/11/2020, 7:52 PMOutput.all(service[0].name, ecs_cluster.name).apply(lambda args: print(f"service/{args[0]}/{args[1]}"))
gentle-diamond-70147
06/11/2020, 7:52 PM.apply()
always returns an Outputchilly-hairdresser-56259
06/11/2020, 7:54 PMOutput.all().apply()
I am going to try to figure out why.chilly-hairdresser-56259
06/11/2020, 7:55 PMoutput.all().apply()
does that implicitly "wait" for the previous resource output, making it like a depends_on
chilly-hairdresser-56259
06/11/2020, 7:55 PMgentle-diamond-70147
06/11/2020, 7:57 PM.all()
to be come "real" before proceeding with the lambda.gentle-diamond-70147
06/11/2020, 8:02 PM.all()
. It looks like AWS expects service/<cluster-name>/<service-name>
.gentle-diamond-70147
06/11/2020, 8:02 PMOutput.all(ecs_cluster.name, service[0].name).apply(lambda args: f"service/{args[0]}/{args[1]}")
chilly-hairdresser-56259
06/11/2020, 8:03 PMsparse-state-34229
06/11/2020, 8:07 PMgentle-diamond-70147
06/11/2020, 8:13 PMgentle-diamond-70147
06/11/2020, 8:18 PMchilly-hairdresser-56259
06/11/2020, 8:30 PM