How to discard certain resources not to be taken by terraform

1,641 views
Skip to first unread message

Bubunia Patra

unread,
Jun 23, 2018, 10:33:15 AM6/23/18
to Terraform
Hi all,

I have x set of.tf files in a directory. I want when I perform 'terraform apply
' I want certain resources should not be created and ignored by terraform. Is it possible?

I don't want to delete the extra set of tf files from the directory and terraform should not create some resources which I want to exclude. If it is possible, how?

Regards
Pradeep

Andrew Jeffree

unread,
Jun 23, 2018, 11:25:52 PM6/23/18
to terrafo...@googlegroups.com
You could use the target option https://www.terraform.io/docs/commands/plan.html#target-resource

But I’m not sure why you only want to create parts for now, in that situation I’d use git stash or similar
--
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/1cd6de06-1f65-4c0a-8a5e-406f957c6d6c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Josh Tenzer

unread,
Jun 27, 2018, 10:46:39 AM6/27/18
to Terraform
you can separate the resources into different folders, then call them as "modules" in the root. when you run apply, you can use the target to call module.WANTED or just apply to run it all.   you can use module outputs to export any attributes that the two sets of resources need from each other.

Bent Terp

unread,
Jul 13, 2018, 11:52:09 PM7/13/18
to Terraform
The lazy approach could be to simply rename the file of .tf.bak or something - I sometimes do that when I can't be bothered with git stash but just want to do an apply right now and fix something else without deplying the new stuff
Reply all
Reply to author
Forward
0 new messages