-
Notifications
You must be signed in to change notification settings - Fork 178
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
Whitelisted Project IPs when manually deleted causes failure at next plan/apply #68
Comments
Hi @richardj-bsquare! If you have another comment or concern plz just let me know. |
Hi, Sorry for the confusion. I removed them all manually from the Mongo DB Atlas whitelist via the Atlas web UI. As indicated in this scenario, the provider should detect entries are missing and re-add them, this prevents inadvertent deletion or other manual changes from being missed, and would be consistent behaviour with other providers (i.e. if you delete a subnet in AWS via the console, and its in your terraform configuration it gets re-created by the plan and apply cycle). |
Hi @richardj-bsquare as you can see we are working on some improvements in regard to the IP Whitelist resource based on customer feedback. In doing so I'm reviewing some of the issues reported in and I'm not quite clear on the expectations here? When one create a resource like an IP Whitelist with Terraform the information is held in the Terraform state file. If one then manually deletes the resource Terraform and refreshes Terraform's state ( |
It's really simple to reproduce. Add some whitelists IPs to a terraform config, plan it, apply it, delete 1 manually via the Atlas console, re-plan, you'll see the above error. The expectation is as described, when your terraform configuration says IPs should be in a whitelist, and they are not, it should put them back when you plan and apply. This is only an issue when they are manually deleted via the Atlas console, not if you remove them from the terraform configuration. It's so easy to reproduce, try it and see. I don't think my bug report could be any clearer in this respect. |
HI @richardj-bsquare - yes, I've reproduced the behavior but there are some resources for which state can be refreshed and some that can't (this is covered in the drift documentation at Terraform's site and is why I provided the work around above). In order to determine if this is one that's a bug or one that's problematic when removed manually to refresh state I've asked the team to look into it. I'll report back their results. Thank you for your patience. |
@themantissa is there any update on this issue? |
Hi @themantissa and @w0ut0, If you have another comment or concern plz let us know, thank you so much! |
Fix #68: Added the ability to re-create the whitelist entry when it's remove manually
Version affected
terraform-provider-mongodbatlas 0.3.1
How to reproduce
Use mongodbatlas_project_ip_whitelist to whitelist a list of IPs
Terraform plan & apply
Delete all of the IP whitelisted addresses.
Run terraform plan & apply
Expected Behaviour
The whitelisted IP is recreated.
Actual behaviour
Upon re-running the terraform plan this is reported (example):
Error: error getting project IP whitelist information: GET https://cloud.mongodb.com/api/atlas/v1.0/groups/5dc3051579358e9725c677e8/whitelist/139.14.250.168%2F29: 404 (request "Not Found") IP Address 139.14.250.168/29 not on Atlas whitelist for group 5dc3021579358e9745c677e8.
Workaround
The above error will be reported individually for each IP that is missing, but only one error per plan until each is manually re-added (which is quite tedious, to say the least, especially if some are dynamically generated).
Notes
The resource also does not notice changes in the comment field and therefore does not modify them to match the terraform.
The text was updated successfully, but these errors were encountered: