Terraform taint resource naming convention (v0.11.13)

5/18/2019

My module abc contains an instance of redis-ha deployed to Kubernetes via helm compliments of https://github.com/helm/charts/tree/master/stable/redis-ha. I want to taint this resource. When I terraform state list I see the resource listed as:

  • module.abc.module.redis.helm_release.redis-ha[3]

My understanding from https://github.com/hashicorp/terraform/issues/11570 is that the taint command pre-dates the resource naming convention shown in state list. As of v0.12 it will honour the same naming convention.

I'm unfortunately not in a position to upgrade to v0.12.

How do I go about taint-ing the resource module.abc.module.redis.helm_release.redis-ha[3] pre-v0.12?

I'm happy to taint the entire redis-ha deployment.

-- Frank
infrastructure-as-code
kubernetes
redis
terraform

1 Answer

5/20/2019

In Terraform v0.11 and earlier, the taint command can work with that resource instance like this:

terraform taint -module=abc.redis helm_release.redis-ha.3

From Terraform v0.12.0 onwards, that uses the standard resource address syntax:

terraform taint module.abc.module.redis.helm_release.redis-ha[3]
-- Martin Atkins
Source: StackOverflow