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

aws_eip resources not destroyed when using compact interpolation #9117

Closed
nocode99 opened this issue Sep 28, 2016 · 2 comments
Closed

aws_eip resources not destroyed when using compact interpolation #9117

nocode99 opened this issue Sep 28, 2016 · 2 comments

Comments

@nocode99
Copy link

nocode99 commented Sep 28, 2016

Terraform Version

0.7.4

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_eip (maybe more?)

Terraform Configuration Files

variable "some_comma_separated_list" {
    default        = "foo,bar"
}

resource "aws_eip" "nat" {                                                                                                                                                                                                                   
    count           = "${length(compact(split(",", var.some_comma_separated_list)))}"                                                                                                                                                                  
    vpc             = true                                                                                                                                                                                                                   
}  

Expected Behavior

aws_eip resources should be destroyed when running terraform destroy

Actual Behavior

Terraform will recognize the resources on the next plan but will not destroy the resources either by removing the resource from the configuration or running terraform destroy

Output

$ tf apply
aws_eip.nat.1: Creating...
  allocation_id:     "" => "<computed>"
  association_id:    "" => "<computed>"
  domain:            "" => "<computed>"
  instance:          "" => "<computed>"
  network_interface: "" => "<computed>"
  private_ip:        "" => "<computed>"
  public_ip:         "" => "<computed>"
  vpc:               "" => "true"
aws_eip.nat.0: Creating...
  allocation_id:     "" => "<computed>"
  association_id:    "" => "<computed>"
  domain:            "" => "<computed>"
  instance:          "" => "<computed>"
  network_interface: "" => "<computed>"
  private_ip:        "" => "<computed>"
  public_ip:         "" => "<computed>"
  vpc:               "" => "true"
aws_eip.nat.0: Creation complete
aws_eip.nat.1: Creation complete

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate

$ tf destroy
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes


Destroy complete! Resources: 0 destroyed.

Comments

I suspect perhaps the compact interpolation is affecting other resources. I came across this in an example and just removed using compact and make sure my lists have no spaces in between.

@nocode99 nocode99 changed the title aws_eip resources not destroyed when compact interpolation aws_eip resources not destroyed when using compact interpolation Sep 28, 2016
@mitchellh
Copy link
Contributor

I just verified on master and with the new destroy branch being merged in that this no longer happens. Perhaps it was fixed recently but I tried your exact config (byte for byte) with a real AWS account and wasn't able to reproduce it in any scenario below:

  • apply, then destroy
  • apply, change default of var to "", then destroy

@ghost
Copy link

ghost commented Apr 21, 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 Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants