Skip to content

Commit

Permalink
something else
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianriobo committed Nov 28, 2023
1 parent b46f507 commit 52a56c9
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions pkg/provider/aws/action/mac/mac-dh.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,30 @@ func (r *MacRequest) manageResultsDedicatedHost(stackResult auto.UpResult) (*str

func (r *MacRequest) ScheduleDestroy(ctx *pulumi.Context) error {
// https://medium.com/@nilangav/set-up-scheduled-tasks-with-aws-fargate-using-cloudformation-templates-b7bd2f7db46b

cluster, err := awsECS.NewCluster(ctx, "cluster",
&awsECS.ClusterArgs{})
// Cluster is not deleted as it is required to run the self prune container
clusterName := resourcesUtil.GetResourceName(r.Prefix, awsMacMachineID, "mac-dh-event-destroy")
cluster, err := awsECS.NewCluster(ctx,
clusterName,
&awsECS.ClusterArgs{
Tags: qenvsContext.ResourceTags(),
Name: pulumi.String(clusterName),
},
pulumi.RetainOnDelete(true))
if err != nil {
return err
}

destroyCmd := []string{"aws", "destroy", "mac"}
fs, err := ecs.NewFargateService(ctx,
resourcesUtil.GetResourceName(r.Prefix, awsMacMachineID, "fg"),
&ecs.FargateServiceArgs{
Cluster: cluster.Arn,
TaskDefinitionArgs: &ecs.FargateServiceTaskDefinitionArgs{},
Cluster: cluster.Arn,
TaskDefinitionArgs: &ecs.FargateServiceTaskDefinitionArgs{
Container: &ecs.TaskDefinitionContainerDefinitionArgs{
Command: pulumi.ToStringArray(destroyCmd),
Image: pulumi.String(""),
},
},
})
if err != nil {
return err
Expand Down

0 comments on commit 52a56c9

Please sign in to comment.