How to use taint for a nested module?

2,724 views
Skip to first unread message

Jef Statham

unread,
Oct 29, 2015, 10:51:51 AM10/29/15
to Terraform
Been trying to taint a resource in a module without any success. I don't understand what the path is supposed to be for the -module=path option. Is the path suppose to be the module name in the root or the source path the module?

My modules are in a folder. 

-- prod
    main.tf
-- module
   -- product
       main.tf
       -- feature
           aws_ecs_proxy.tf
           

prod/main.tf

module "product" {
  source = "../modules/product"
}

module/product/main.tf
module "feature" {
  source = "feature"
}

My understanding is the following should work

/prod $ terraform taint -module=product.feature proxy
The module root.product.feature could not be found. There is nothing to taint.

/prod $ terraform taint -module=product proxy
The module root.product could not be found. There is nothing to taint.




Paul Hinze

unread,
Nov 20, 2015, 5:17:53 PM11/20/15
to terrafo...@googlegroups.com
Hi Jef,

I just set up a similar test and the dot notation seems to be working for me.

.
├── child
│   ├── grandchild
│   │   └── main.tf
│   └── main.tf
└── main.tf

module "child" {
  source = "./child"
}

child/main.tf
module "grandchild" {
  source = "./grandchild"
}

child/main.tf
resource "aws_vpc" "foo" {
  cidr_block = "10.0.1.0/24"
}

$ terraform apply
# ...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

$ terraform taint -module=child.grandchild aws_vpc.foo
The resource aws_vpc.foo in the module root.child.grandchild has been marked as tainted!

If you're still having an issue w/ the latest version of Terraform, feel free to file a GitHub issue!

Paul

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/ae94f0b7-74d6-4166-9985-ac1b22d3dbe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages