Closed stanicek closed 1 year ago
Thanks for reporting this @stanicek ! I am taking a look at it.
This seems like a genuine bug, and we will have an update on a plan in this week.
Hey @stanicek - we are working on the fix, but we don't have an ETA as of now. Do you have a workaround that unblocks you? If not, we can suggest something.
Hello, this scenario exposed a missing error check in the provider for load balancer resources which led you to see a nil pointer message (coming from the underlying sdk). This will be fixed in the next release.
What's also going on here is setting the count of the rule set resource to zero effectively both destroys the resource in the same step as it removes the dependency from the listener. When this happens Terraform no longer infers a dependency relationship between the two and will issue the delete command for the ruleset at the same time it issues the update command for the listener. Because the service is returning a general 400 error instead of a 409, the error is presented as a terminal condition. We'll ask the service team to change the error code they return to a 409 so that retry logic will trigger and mask this behavior, eventually resulting in a successful delete.
However, know that what is occurring here is an underlying limitation in how Terraform comprehends dependencies such that you may have to employ a modified two step approach in these circumstances--remove the dependency first from the resource, then delete the other resource. Alternately, it's possible you could see the listener update occur first, but still see the rule set fail to delete. In this scenario a subsequent apply would successfully delete the rule set.
The Terraform limitations that lead to this issue are tracked here: https://github.com/hashicorp/terraform/issues/20823
We are very sorry that we couldn't respond to each and every issue reported on GitHub. Although we have refined the process to prioritize customer issues on GitHub, since this issue was reported a while ago, there is a good chance it may have been fixed in the latest version of Terraform Provider OCI. If you are still experiencing this issue, please create a new issue and label it as Bug.
Terraform Version
v0.11.11
OCI Provider Version
3.17.0
Description:
Repro steps:
Expected:
Actual:
Plan looks good
Plan: 0 to add, 1 to change, 1 to destroy.
oci_load_balancer_rule_set.default_rule_set: Destroying... (ID: loadBalancers/ocid1.loadbalancer.oc1.ia...iry4f64e4szgfrs53emfa/ruleSets/default)
Error: Error applying plan:
1 error(s) occurred:
oci_load_balancer_rule_set.default_rule_set (destroy): 1 error(s) occurred:
oci_load_balancer_rule_set.default_rule_set: can not marshal to path in request for field WorkRequestId. Due to can not marshal a nil pointer
Nothing happens
At the first sight it seems that terraform tries to remove the rule before modifying the listener.