Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ resource "aws_ecs_task_definition" "nginx_task" {
"awslogs-stream-prefix" : "ecs"
}
}
},
{
name = "ubuntu"
image = "public.ecr.aws/ubuntu/ubuntu:latest"
command = ["sleep", "8000"]
}
])
skip_destroy = true
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether to retain the old revision when the resource is destroyed or replacement is necessary. Default is false.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition.html

trueにすることで過去のtask_definitionを削除しなくなる

image

これを設定していないと、過去のrevisionはINACTIVEステータスになってしまう

}

resource "aws_security_group" "ecs_http_sg" {
Expand Down Expand Up @@ -80,6 +86,9 @@ resource "aws_ecs_service" "nginx_service" {
container_name = "nginx"
container_port = 80
}
lifecycle {
ignore_changes = [task_definition]
}
}

resource "aws_cloudwatch_log_group" "nginx_task" {
Expand Down