-
Notifications
You must be signed in to change notification settings - Fork 630
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
Allow full deletion of pop_pools, country_pools, region_pools on load balancer updates #2673
Conversation
changelog detected ✅ |
… balancer updates
thanks @thetwoj, this is great and thanks for including the test case. acceptance tests all passing
|
This functionality has been released in v4.12.0 of the Terraform Cloudflare Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
Resolves #2659, supersedes #2660
Currently
pop_pools
,country_pools
, andregion_pools
are defined asComputed: true
in their respective schemas. As a result, thed.GetOk()
for each in resourceCloudflareLoadBalancerUpdate is returning the currently configured value when the corresponding definition is deleted from the Terraform config, effectively making it impossible to delete all entries frompop_pools
,country_pools
, orregion_pools
on a load balancer once they're initially defined. By removingComputed: true
from the schemas full deletions in Terraform are respected, mirroring the behavior from calling the REST API directly with empty maps for any of the pool sets.This MR also adds a test for this behavior - configuring a load balancer for geo steering via pop and country balancing before updating it to use region balancing instead. This test fails in the absence of the schema changes in this MR.
New test without schema changes:
New test with schema changes:
$ TESTARGS='-run "^TestAccCloudflareLoadBalancer_GeoBalancedUpdate" -count 1 -parallel 1 -v' make testacc ... === RUN TestAccCloudflareLoadBalancer_GeoBalancedUpdate === PAUSE TestAccCloudflareLoadBalancer_GeoBalancedUpdate === CONT TestAccCloudflareLoadBalancer_GeoBalancedUpdate --- PASS: TestAccCloudflareLoadBalancer_GeoBalancedUpdate (7.02s) ...
When running all the load balancer tests with this MR's changes the only failure is on a pool count assertion because I'm running the tests on an account with existing infrastructure deployed in other zones
Example of referenced successful API call body to delete
pop_pools
from an existing load balancer: