Find Related products on Amazon

Shop on Amazon

Ignoring unwanted Terraform attribute changes

Published on: 2025-05-22 23:09:46

The Problem! I’ve ocassionally found Terraform providers that take an attribute and manipulate it in a way that.. isn’t favourable. This means that, following runs see a change in the attribute (compared) to the attribute passed and want to modify it. For example!… The Docker Terraform provider (by kreuzwerker :D https://registry.terraform.io/providers/kreuzwerker/docker/latest/docs) manipulates the “image” attribute to the SHA digest of the image… This means, that if I create: resource "docker_container" "my_important_container" { ... image = "base-image-for-my-important-container:v2.20.2" ... } A terraform refresh later, the image attribute will be been read as a SHA digest. This means that next time Terraform runs, it will want to re-create the container, changing the image from the SHA digest to the original named image. For some resources, this is probably fine, it maybe an update-in-place and nothing changes.. but in this case, it forces a re-creation and, for a container ... Read full article.