GithubHelp home page GithubHelp logo

`docker_tag` does not detect changes when the `docker_image` referenced by `source_image` changes about terraform-provider-docker HOT 2 OPEN

labmonkey42 avatar labmonkey42 commented on July 26, 2024 5
`docker_tag` does not detect changes when the `docker_image` referenced by `source_image` changes

from terraform-provider-docker.

Comments (2)

carchi1a avatar carchi1a commented on July 26, 2024 1

@labmonkey42 I fully agree that it would be nice for the docker_tag resource to have a triggers parameter that mimics the functionality of other resources like docker_image and docker_registry_image.

In the meantime, I managed to implement a workaround using Terraform's replace_triggered_by. If you're on Terraform >= 1.2 this might work for you too:

data "docker_registry_image" "upstream" {
  name = "registry1.example.org/ns/foo:latest"
}

resource "docker_image" "local" {
  name          = data.docker_registry_image.upstream.name
  pull_triggers = [data.docker_registry_image.upstream.sha256_digest]
}

resource "docker_tag" "server" {
  source_image = docker_image.local.name
  target_image = "registry2.example.org/ns/foo:success"

  lifecycle {
    replace_triggered_by = [
      docker_image.local.repo_digest
    ]
  }
}

resource "docker_registry_image" "push" {
  keep_remotely = true
  name          = docker_tag.server.target_image

  triggers = {
    source_image_hash = docker_tag.server.source_image_id
  }
}

Hope this helps!

from terraform-provider-docker.

avbenavides avatar avbenavides commented on July 26, 2024

Would be very nice to add a triggers property like docker_registry_image so it is revalidated against the sha, for example.
My workaround is to taint the tag but that of course is manual 🤮

from terraform-provider-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.