Skip to content

Instantly share code, notes, and snippets.

@cmaggiulli
Created September 20, 2022 00:17
Show Gist options
  • Save cmaggiulli/47a8523d7d0b0a29145eafa61d8a6e83 to your computer and use it in GitHub Desktop.
Save cmaggiulli/47a8523d7d0b0a29145eafa61d8a6e83 to your computer and use it in GitHub Desktop.
Run ECR Command from Terraform
resource "null_resource" "run_task" {
count = var.run_task == "YES" ? 1 : 0
triggers = {
timestamp = timestamp()
}
provisioner "local-exec" {
command = "aws ecs run-task --task-definition appdev-deactivate-canvas-enrollments-${terraform.workspace} --cluster ${data.aws_ecs_cluster.ecs_cluster.cluster_name} --network-configuration \"awsvpcConfiguration={subnets=[${join(",", data.aws_subnet_ids.subnets.ids)}],securityGroups=[${join(",", concat(data.aws_security_groups.default-container-sg.ids, data.aws_security_groups.mail-sg.ids, data.aws_security_groups.db-sg.ids, data.aws_security_groups.allow-443-outbound-sg.ids))}],assignPublicIp=DISABLED}\" --launch-type FARGATE --region us-east-1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment