Before in 0.11 I could taint a resource with a count without having to know how many resources there was. Now when I do it need to use the new module reference syntax with [0] on the end to reference a single resource and can't use splat to get all.
Terraform v0.12.0
resource "aws_ebs_volume" "volume" {
count = 3
availability_zone = element(var.azs, count.index)
size = var.disk_volume_size
type = var.volume_type
encrypted = var.encrypt_volume
kms_key_id = var.kms_key_id
snapshot_id = var.data_disk_snapshot_id
}
As in terraform 0.11
terraform taint -module=my-volume aws_ebs_volume.volume
And all of my volumes with counts would be tainted
Now with the new calling syntax it doesn't allow me taint a group of resources with counts
terraform taint module.my-volume.aws_ebs_volume.volume
Gives me an error saying "No resource instance"
terraform taint module.my-volume.aws_ebs_volume.volume[0]
Works but only for the 1st volume
terraform taint module.my-volume.aws_ebs_volume.volume[*]
Gives me an error saying "Splat expressions ([*]) may not be used here."
I too depended on this functionality for tainting all of my replica databases when I rebuilt the master. It is nice if the engineer doing this doesn't have to know how many replicas we have. Everything else is just copy/paste.
it affects to me as well.
it affects to me as well. I need to taint a for_each 's creations.
This issue is absolutely still valid, however I am closing it to consolidate it as a duplicate of https://github.com/hashicorp/terraform/issues/1768. taint, in its current form, operates on one resource instance at a time, and asking taint to target multiple resource instances at once is an enhancement (and a greatly valued one at that!) from current behavior.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
I too depended on this functionality for tainting all of my replica databases when I rebuilt the master. It is nice if the engineer doing this doesn't have to know how many replicas we have. Everything else is just copy/paste.