Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete an entire module #2770

Closed
ryanking opened this issue Jul 17, 2015 · 7 comments · Fixed by #2786
Closed

Unable to delete an entire module #2770

ryanking opened this issue Jul 17, 2015 · 7 comments · Fixed by #2786
Assignees

Comments

@ryanking
Copy link
Contributor

  • using s3 for state
  • all my modules are local paths.
  • when I run terraform show I see a bunch of modules that are no longer used (and have 0 resources in them)

$ terraform plan --refresh=false
No changes. Infrastructure is up-to-date. This means that Terraform
could not detect any differences between your configuration and
the real physical resources that exist. As a result, Terraform
doesn't need to do anything.

[ comment out module ]

$ terraform plan --refresh=false
No changes. Infrastructure is up-to-date. This means that Terraform
could not detect any differences between your configuration and
the real physical resources that exist. As a result, Terraform
doesn't need to do anything.

Also. At the top level I have 3 modules. When i comment one of them out, terraform says "no changes". When I comment out a second one, it hangs. Output with TF_LOG=1 here.

@mitchellh
Copy link
Contributor

Ah, so just to clarify: your modules have no active resources, but deleting them from the config keeps them in the state? That is an edge case I could believe, but just checking.

@ryanking
Copy link
Contributor Author

I have both situations currently

  1. I have some modules with 0 active resources and not references in any
    .tf files
  2. I have modules with resources in them (and more modules) and when I
    comment the top level module out it does not trigger a planned destroy.

One note about #2- the the module that doesn't trigger a delete only
contains other modules, which then contain resources. Perhaps there's a
non-recursive check that should be recursive?

-ryan

On Fri, Jul 17, 2015 at 3:22 PM, Mitchell Hashimoto <
notifications@github.com> wrote:

Ah, so just to clarify: your modules have no active resources, but
deleting them from the config keeps them in the state? That is an edge case
I could believe, but just checking.


Reply to this email directly or view it on GitHub
#2770 (comment)
.

@ryanking
Copy link
Contributor Author

That was it.

Here's what I did.

  1. Added a resource inside the outer module.
  2. applied that change
  3. commented whole outer module out
  4. run plan and now the deletes show up

So it appears that terraform doesn't detect a deleted module when that
module only contains modules.

-ryan

On Fri, Jul 17, 2015 at 4:21 PM, Ryan King ryan@theryanking.com wrote:

I have both situations currently

  1. I have some modules with 0 active resources and not references in any
    .tf files
  2. I have modules with resources in them (and more modules) and when I
    comment the top level module out it does not trigger a planned destroy.

One note about #2- the the module that doesn't trigger a delete only
contains other modules, which then contain resources. Perhaps there's a
non-recursive check that should be recursive?

-ryan

On Fri, Jul 17, 2015 at 3:22 PM, Mitchell Hashimoto <
notifications@github.com> wrote:

Ah, so just to clarify: your modules have no active resources, but
deleting them from the config keeps them in the state? That is an edge case
I could believe, but just checking.


Reply to this email directly or view it on GitHub
#2770 (comment)
.

@mitchellh
Copy link
Contributor

Thanks... that will certainly help me repro.

Turtles

@mitchellh
Copy link
Contributor

Reproduced! Working on this now.

@mitchellh
Copy link
Contributor

Got a fix in the attached PR!

@ghost
Copy link

ghost commented May 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants