Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker-build module with CI pipeline #528

Closed
tkasuz opened this issue Jan 8, 2024 · 5 comments · Fixed by #518
Closed

Support docker-build module with CI pipeline #528

tkasuz opened this issue Jan 8, 2024 · 5 comments · Fixed by #518

Comments

@tkasuz
Copy link

tkasuz commented Jan 8, 2024

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!

@IlyesDemineExtVeolia
Copy link
Contributor

IlyesDemineExtVeolia commented Jan 10, 2024

@tkasuz I think is the same issue : #517

@IlyesDemineExtVeolia
Copy link
Contributor

IlyesDemineExtVeolia commented Jan 10, 2024

I created a pull request #518 but no response from the reviewer

@antonbabenko
Copy link
Member

Fixed in #518 by @IlyesDemineExtVeolia

@tkasuz
Copy link
Author

tkasuz commented Jan 15, 2024

@IlyesDemineExtVeolia Thanks! I've checked out if your changes don't trigger to replace docker_image resource but docker_image resource seems to still has problem that I mentioned here while docker_registry_image will be updated properly based on the new trigger you changed though 🤔

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants