-
-
Notifications
You must be signed in to change notification settings - Fork 740
Description
Is your request related to a problem? Please describe.
I've been trying to use docker-build submodule to build a container image in GitHub Actions, and deploy it with CodeDeploy using deploy
module but docker_image
resource which will be automatically created by docker-build
module will be forcibly replaced every time when CI pipeline get triggered withtout changing any code because docker_image
refaers to local image, and so the local iamge will be reseted every CI process.
Describe the solution you'd like.
To avoid the avobe behavior, It would be better to have an option to specify whether local docker image is stored on local or not by using ignore_changes
of terraform lifecycle. Since ignore_changes
doesn't support dynamic paramter on it currently, I think one of the workaround to implement this is like the following:
resource "docker_image" "this" {
count = var. store_on_local == true ? 1 : 0
name = local.ecr_image_name
triggers = var.triggers
lifecycle {
ignore_changes = [id, image_id]
}
}
resource "docker_image_with_ci" "this" {
count = var. store_on_local == true ? 0 : 1
name = local.ecr_image_name
triggers = var.triggers
lifecycle {
ignore_changes = [id, image_id]
}
}
If there is another workaround for this problem, or I misunderstand something, please correct me. Thanks!