0.8.7
$ terraform state list |grep kong-ext.aws_instance
module.kong-ext.aws_instance.instance[0]
module.kong-ext.aws_instance.instance[1]
$ terraform taint -module='kong-ext' 'aws_instance.instance[0]'
The resource aws_instance.instance[0] couldn't be found in the module root.kong-ext.
$ terraform taint -module='kong-ext' 'aws_instance.instance'
The resource aws_instance.instance couldn't be found in the module root.kong-ext.
$ TF_LOG=TRACE terraform taint -module='kong-ext' 'aws_instance.instance'
2017/03/02 12:43:32 [INFO] Terraform version: 0.8.7 c1df88ac4633b61b83802bbb10c343c20d3035b5
2017/03/02 12:43:32 [INFO] CLI args: []string{"/usr/local/bin/terraform", "taint", "-module=kong-ext", "aws_instance.instance"}
2017/03/02 12:43:32 [DEBUG] Detected home directory from env var: /Users/matt
2017/03/02 12:43:32 [DEBUG] Detected home directory from env var: /Users/matt
2017/03/02 12:43:32 [DEBUG] Attempting to open CLI config file: /Users/matt/.terraformrc
2017/03/02 12:43:32 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/03/02 12:43:32 [DEBUG] Detected home directory from env var: /Users/matt
2017/03/02 12:43:32 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:32 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:33 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:33 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:33 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:33 [TRACE] Preserving existing state lineage "146a8656-91ea-44e6-883f-804e713dbe6e"
2017/03/02 12:43:33 [DEBUG] plugin: waiting for all plugin processes to complete...
Terraform should be able to taint the resource from the module.
Terraform says the resource is not found despite the state showing them and otherwise behaving normally. State is remote via consul.
Hi @mattlqx,
Sorry about the confusion here, the output from the state command turns out to be a little differently formatted.
The taint command will use the format you see in the normal plan or apply output. The following example should give you want you want:
terraform taint -module='kong-ext' 'aws_instance.instance.0'
Thanks for the reply. I thought that was one of the variations I tried too, but apparently I tried it while my state didn't have multiple instances in it. I did get it to work now. False alarm!
@jbardin how do you taint such magic stuff? module.rds_sharepass.db_instance.aws_db_instance.this
@holms,
The module would be specified like above, -module=rds_sharepass
, but I'm not sure what db_instance.aws_db_instance.this
is supposed to represent. What is that particular address from?
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
Hi @mattlqx,
Sorry about the confusion here, the output from the state command turns out to be a little differently formatted.
The taint command will use the format you see in the normal plan or apply output. The following example should give you want you want: