TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ignoring unwanted Terraform attribute changes

36 pointsby mrmattyboyabout 2 months ago

4 comments

RulerOfabout 2 months ago
I&#x27;ve never used this provider, and while I do think you&#x27;re right that the provider probably shouldn&#x27;t change the attribute on you, the docs for the `docker_container` resource[1] suggest populating the `image` argument with the `image_id` attribute of a `docker_image` resource[2].<p>This should give you a location to stick in the friendly name of a container that won&#x27;t get clobbered by the provider.<p>I do like the explanation you provided though, because this is the kind of puzzle you can&#x27;t really solve with Terraform until you&#x27;ve run into it. I&#x27;ve never used the `replace_triggered_by` feature.<p>[1]: <a href="https:&#x2F;&#x2F;registry.terraform.io&#x2F;providers&#x2F;kreuzwerker&#x2F;docker&#x2F;latest&#x2F;docs&#x2F;resources&#x2F;container#example-usage" rel="nofollow">https:&#x2F;&#x2F;registry.terraform.io&#x2F;providers&#x2F;kreuzwerker&#x2F;docker&#x2F;l...</a><p>[2]: I was originally expecting `docker_image` to be a data source, but the resource seems to be the recommended method for this, and I didn&#x27;t wrap my brain around the differences between the data source and the resource before writing.
评论 #43497326 未加载
评论 #43497447 未加载
bmcgavinabout 2 months ago
As tags aren&#x27;t necessarily immutable, it&#x27;s probably advisable to use the full hash in most situations anyway.<p>This is a useful trick in situations where the image changing under your feet isn&#x27;t very important.
评论 #43496266 未加载
评论 #43497625 未加载
JohnMakinabout 2 months ago
null_resource is being deprecated in favor of terraform_data:<p><a href="https:&#x2F;&#x2F;developer.hashicorp.com&#x2F;terraform&#x2F;language&#x2F;resources&#x2F;terraform-data" rel="nofollow">https:&#x2F;&#x2F;developer.hashicorp.com&#x2F;terraform&#x2F;language&#x2F;resources...</a><p>~8 years in or so with terraform and I&#x27;ve found null_resource to be a useful crutch in doing things like, &quot;take this source and compile it with this script that&#x27;ll basically never change, then put it somewhere that&#x27;s defined in terraform.&quot; Overly relying on this mechanism feels like terraform code smell to me, just from my personal experience, if that&#x27;s even a thing.
评论 #43497594 未加载
nick__mabout 2 months ago
thanks, I learned something simple and useful ! I did not know about the null_resource.