terraform-provider-bigip
terraform-provider-bigip copied to clipboard
Failure to refresh state
Environment
- TMOS/Bigip Version: 16.1.3.2
- Terraform Version: 1.3.9
- Terraform bigip provider Version: 1.22.0
Summary
New versions of provider fail to properly refresh tfstate and update it accordingly. When tfstate contains entry that does not have a corresponding object on BIG-IP, instead of refreshing and removing given entry in tfstate, provider returns an error and fails to apply configuration.
In v1.16.1 behavior is different and works as expected i.e. provider correctly refreshes state and removes entries if needed.
v 1.22.0:
2024-03-27T11:23:09.616-0400 [INFO] provider.terraform-provider-bigip_v1.22.0: Reading pool /Common/repeated-pool-22-0_pool: timestamp=2024-03-27T11:23:09.616-0400 2024-03-27T11:23:09.668-0400 [ERROR] provider.terraform-provider-bigip_v1.22.0: Response contains error diagnostic: tf_resource_type=bigip_ltm_pool diagnostic_summary="01020036:3: The requested Pool (/Common/repeated-pool-22-0_pool) was not found." tf_proto_version=5.3 tf_provider_addr=provider @caller=github.com/hashicorp/[email protected]/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR tf_req_id=10cfd51f-a8c5-e22a-38c6-494f9ea34b9d tf_rpc=ReadResource timestamp=2024-03-27T11:23:09.668-0400 2024-03-27T11:23:09.669-0400 [ERROR] vertex "bigip_ltm_pool.f5_pool" error: 01020036:3: The requested Pool (/Common/repeated-pool-22-0_pool) was not found. 2024-03-27T11:23:09.669-0400 [ERROR] vertex "bigip_ltm_pool.f5_pool (expand)" error: 01020036:3: The requested Pool (/Common/repeated-pool-22-0_pool) was not found.
v 1.16.1 for the same config:
2024-03-27T11:30:41.481-0400 [INFO] provider.terraform-provider-bigip: [INFO] Checking pool /Common/repeated-pool-16-1_pool exists. 2024-03-27T11:30:41.536-0400 [WARN] provider.terraform-provider-bigip: [WARN] Pool (/Common/repeated-pool-16-1_pool) not found, removing from state 2024-03-27T11:30:41.536-0400 [WARN] Provider "terraform.local/local/bigip" produced an unexpected new value for bigip_ltm_pool.f5_pool during refresh. - Root resource was present, but now absent
Steps To Reproduce
Steps to reproduce the behavior:
- Apply Terraform configuration.
- Modify created configuration directly on BIG-IP (remove one of the resources previously created) without changing tfstate
- Apply Terraform again
Expected Behavior
Provider should detect changes on the device and update tfstate accordingly so that consequent terraform apply calls return success.
Actual Behavior
Provider returns an error and does not proceed with applying configuration. Manual edit of tfstate is required.