Removing template_file from terraform state

I’ve run into this issue a few times so recording here for future reference. template_file has been deprecated in terraform but I occasionally perform a terraform init before realising that there is a template_file command in the code. I get the error:

Error: Incompatible provider version

Provider v2.2.0 does not have a package available for your current platform, darwin_arm64.

So I need to remove the template_file resource from state to continue. Listing the state:

terraform state list

Shows (among other things):

So I remove the middle one with:

terraform state rm

Then convert the template_file resource to a templatefile resource, and try the init again:

terraform init

Worked for me, YMMV

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>