many-yak-61188
07/13/2021, 7:28 AMconst asgEventsTopic = new aws.sns.Topic("asg-events-topic")
asgEventsTopic.onEvent("ci-cd-scale-in", async ev =>{
console.log("Processing " + ev);
})
const runnerAsg = new aws.autoscaling.Group("ci-cd-runner-asg", {
name: "ci-cd-runner-asg",
desiredCapacity: 2,
maxSize: 2,
minSize: 1,
healthCheckGracePeriod: 300,
healthCheckType: "EC2",
launchTemplate: {
id: launchTemplate.id,
version: `$Latest`,
},
vpcZoneIdentifiers: vpc.privateSubnetIds,
initialLifecycleHooks: [{
name: "asg-events-hook",
defaultResult: "CONTINUE",
lifecycleTransition: "autoscaling:EC2_INSTANCE_TERMINATING",
notificationTargetArn: asgEventsTopic.arn
}]
});
the sns topic is assigned as a notificationTargetArn
to the ASG. I noticed during delete the topic subscription is deleted before the ASG. If it were the other way around, ASG deleted prior to topic subscription, deleting ASG would fire lifecycle transtion events for the EC2 hosts. In thread, I'm posting the output of pulumi delete
bug may be / am I missing something?pulumi delete
Type Name Status
pulumi:pulumi:Stack p-gar-personal-github-runners
- ├─ aws:ec2:Route ci-cd-private-1-nat-1 deleted
- ├─ aws:ec2:Route ci-cd-private-0-nat-0 deleted
- ├─ aws:lambda:Permission processScaleIn deleted
- ├─ aws:sns:TopicSubscription processScaleIn deleted
- ├─ aws:ec2:Instance ci-cd-ssh-hosts-1 deleted
- ├─ aws:ec2:Instance ci-cd-ssh-hosts-0 deleted
- ├─ aws:autoscaling:Group ci-cd-runner-asg deleted