我正在使用terraform创建ecs taskDefinition。
resource "aws_ecs_task_definition" "tktest_terraform-td" {
family = "nodejs-webapp"
container_definitions = "${templatefile("${path.module}/taskdefinition/service-td.tpl", { webapp_docker_image = "${var.webapp_docker_image_name}:${var.webapp_docker_image_tag}"})}"
}
每当对taskdefinition进行更改时,都会创建一个新修订,但是问题是删除了较旧的修订。
是否可以创建一个新修订,但同时保留旧修订?
这是一个长期存在的问题,任务定义已记录并在GitHub Issues上进行了讨论。
到目前为止,此问题尚未解决,报告的解决方法是从TF状态手动删除任务的当前版本。您的情况是:
# we can still get the task definition diff at this point, which we care about
terraform plan
# remove from state so that task definition is not destroyed, and we're able to rollback in the future if needed
terraform state rm aws_ecs_task_definition.tktest_terraform-td
# diff will show a brand new task definition created, but that's ok because we got the diff in step 1
terraform apply
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句