plan -destroy -target does not show anything will be destroyed

819 views
Skip to first unread message

Alexander Kabenin

unread,
Apr 26, 2017, 6:12:59 PM4/26/17
to Terraform
Hello,

I'm wondering if I misread the documentation regarding terraform plan arguments.

'full' plan -destroy shows that resources will be dropped:

[root@dca7c114677d usw1]# terraform plan -destroy
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to
local or remote state storage.
...

Plan: 0 to add, 0 to change, 85 to destroy.


If I want to narrow it down to a single resource, I'm getting that nothing will be changed:
[root@dca7c114677d usw1]# terraform plan -destroy -target=module.root.aws_instance.appsrv
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to
local or remote state storage.

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your

configuration
and real physical resources that exist. As a result, Terraform
doesn
't need to do anything.



I'm running version 0.9.4 for plan, however initially the infrastructure was created using 0.9.2.
[root@dca7c114677d usw1]# terraform  version
Terraform v0.9.4


It looks like if I provide -target argument, the -destroy is ignored.
Is that expected behavior? 

Thanks!

Haydn Dufrene

unread,
Apr 26, 2017, 7:42:37 PM4/26/17
to terrafo...@googlegroups.com
What does terraform state show module.root.aws_instance.appsrv give you? 
Targeting a malformed resource will not error out, but only show you that there are no changes to be made.

One thing that looks odd, is you have include module.root, which is incorrect if you are trying to indicate that the aws_instance is at the top level of your configuration file.. If so, it would be just 'aws_instance.appsrv'.

--
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-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/017c96f9-112f-416d-b01c-5857fe47d0c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
CONFIDENTIALITY NOTE

The information transmitted, including attachments, is intended only for the person(s) or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and destroy any copies of this information.

Alexander Kabenin

unread,
Apr 26, 2017, 7:54:27 PM4/26/17
to Terraform
Hi Haydn,

thanks a lot!

terraform state show does not show anything, so I used malformed resource ID.

With just aws_instance.appsrv everything works great.

Thank you and sorry for the stupid question.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages