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

Resources are not truly destroyed upon destroy #57

Closed
gravcat opened this issue Jan 21, 2020 · 9 comments
Closed

Resources are not truly destroyed upon destroy #57

gravcat opened this issue Jan 21, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@gravcat
Copy link

gravcat commented Jan 21, 2020

I've only tested this with the network view, network, and ip_allocation resources, so there may be more resources with similar problems.

The actions

  1. start an infoblox nios 8.4.4 vmware appliance for testing
  2. clone https://gitlab.com/adrift/terraform-infoblox
  3. build the plugin, install to ~/.terraform/plugins
  4. terraform init
  5. create a set of resources with a terraform apply
  6. terraform destroy
  7. attempt another terraform apply

Expected outcome

The resources are created, destroyed, and created once again.

Actual outcome

network views are not destroyed
The network view not being destroyed means that your state conflicts with what's actually out there. Any subsequent run whether plan or apply will fail.

ip allocation belongs to the network, which does not get destroyed until the network is.

networks are only moved to the recycle bin
The network only being moved to the recycle bin means that any attempt to create that network will fail as reportedly the network name is already in use.

Knowing this issue we can carefully work around it, but it'd be great to see this resolved by

  1. truly deleting network views
  2. running a recycle bin clean when a resource has been moved there as part of delete
@saiprasannasastry
Copy link
Contributor

Hi, not deleting the network view was part of PM requirment, hence it does give false impression, and i nios when you delete a network it goes to recycle bin, the APi does exactly that. Also in the features , we don't mention the deletion of network view

@gravcat
Copy link
Author

gravcat commented Jan 22, 2020

Given that Terraform is declarative, it doesn't make sense that one can create resources with it, and have the destroy not actually destroy.

I understand that the API sends things to the recycle bin as well, so it sounds like the provider should pick up the slack and delete from recycle bin as well. I also understand that the features does not describe the ability to delete a network view, but given that you can create/destroy the resource it is implied.

Not addressing and closing the issue on these things sounds very anti-pattern. An "Issue" can be tagged as an improvement if it's in the project's interests to get there eventually. Closed implies that it will not be implemented ever. If you disagree I will leave it at that as it is your repository, but please consider this as we are paying Infoblox customers who also intersect a lot with Terraform.

Would a PR be accepted that helps resolve these things in a reasonable way?

@saiprasannasastry
Copy link
Contributor

saiprasannasastry commented Jan 23, 2020

I am sorry if i offended you :) , these were the requirments that came by our PM, i will talk to him and let you know. Will Reopen for now

@gravcat
Copy link
Author

gravcat commented Jan 23, 2020

No offense taken! Just being adamant on what I think is best for the project as a soon-to-be heavy consumer and potentially bringing contributors with!

@saileshgiri
Copy link

Hello @gravcat,
For network views not getting deleted, we’ll look into fixing this post the certification of the provider.
Also, about networks going to recycle bin, this is expected behavior and is aligned with NIOS UI behavior. But if you expect this to be fixed, please raise the PR.

@pearcec
Copy link
Contributor

pearcec commented Apr 14, 2020

I was doing some testing for the datasource_infoblox_network. I was running into this issue because the network_view is not getting removed. It is missing out the the infoblox-go-client. I logged an issue so it can be tracked upstream.

infobloxopen/infoblox-go-client#92

pearcec pushed a commit to pearcec/terraform-provider-infoblox that referenced this issue Apr 14, 2020
This fix requires a newer version of infoblox-go-client is released
with infobloxopen/infoblox-go-client#92

The fix is not a good one.  This resource stores name for the id
unlike all the other resources which use Ref off the Struct in the
go client.  Changing it now would disrupt statefiles.  Either
we live with the computed network_view_ref attribute, see if it
is possible to transition the state, or we need to deprecate this
attribute in a future API release.
pearcec pushed a commit to pearcec/terraform-provider-infoblox that referenced this issue Apr 15, 2020
There is a lot of vendor baggage happening.  Seems like go mod vendor has not been run
in previous releases.

Also updated the GNUmakefile to include the variables for build automatically
updated README.md to reflect change.
AvRajath added a commit that referenced this issue Apr 16, 2020
pearcec pushed a commit to pearcec/terraform-provider-infoblox that referenced this issue Apr 16, 2020
This fix requires a newer version of infoblox-go-client is released
with infobloxopen/infoblox-go-client#92

The fix is not a good one.  This resource stores name for the id
unlike all the other resources which use Ref off the Struct in the
go client.  Changing it now would disrupt statefiles.  Either
we live with the computed network_view_ref attribute, see if it
is possible to transition the state, or we need to deprecate this
attribute in a future API release.
pearcec pushed a commit to pearcec/terraform-provider-infoblox that referenced this issue Apr 16, 2020
There is a lot of vendor baggage happening.  Seems like go mod vendor has not been run
in previous releases.

Also updated the GNUmakefile to include the variables for build automatically
updated README.md to reflect change.
@somashekhar
Copy link
Contributor

As of now we have the feature to create and delete network view. Will look around the possibility of cleaning the resources from recycle bin while deleting through the terraform.

@somashekhar somashekhar added the enhancement New feature or request label Mar 5, 2021
@somashekhar
Copy link
Contributor

@gravcat We are able to create the network resource even when the same network is at NIOS recycle bin.
Steps followed are,

  1. Created and destroyed network resource using terraform and observed that network is at NIOS recycle bin.
  2. Did a terraform apply to create the resource again and it was successful.

Can you give a try and let us know if you are facing the issue as of now?
As per NIOS design recycle bin feature gives the user an option to retrieve the resource deleted. But at the same time it does not restrict the user in creating the same resource.

@somashekhar
Copy link
Contributor

We will be closing this issue as of now with the above discussion.
Reach out to us if you are still facing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants