terraform-provider-oci icon indicating copy to clipboard operation
terraform-provider-oci copied to clipboard

Error received attempting to edit redirect rule_set created from terraform resource

Open gillfimj opened this issue 10 months ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

Terraform v1.5.3
on windows_amd64
+ provider registry.terraform.io/oracle/oci v5.9.0

Affected Resource(s)

oci_load_balancer_rule_set

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. 
# Please remove any sensitive information from configuration files before sharing them. 

Debug Output

Panic Output

Expected Behavior

After creating a redirect rule set resource with no query data via terraform, I expect to be able to use the OCI Console to edit the rule set.

Actual Behavior

When I attempt to use the OCI Console to edit/view the redirect rule set that was created via terraform, I receive the error, "An unknown problem occurred. Refresh your browser and try again." The browser devtools shows "UnhandledException TypeError: Cannot read properties of null (reading 'length')". The oci cli shows that the query field has been created with a null value

            "port": null,
            "protocol": "https",
            "query": null

When the rule set is created via the console, the query value is a different kind of "null":

            "port": null,
            "protocol": "https",
            "query": ""

I don't know if this is the issue causing the error, but I put even a "?" as a query value, the problem goes away. If the OCI console allows for an empty query, so should the terraform resource.

Steps to Reproduce

resource oci_load_balancer_rule_set rs_test {
  load_balancer_id = oci_load_balancer_load_balancer.lb-test-pub.id
  name             = "rs_test"
  items {
    action = "REDIRECT"
    conditions {
      attribute_name = "PATH"
      attribute_value = "/"
      operator = "FORCE_LONGEST_PREFIX_MATCH"
    }
    redirect_uri {
      host = "test.oracle.com"
      port = null
      path = "/somepath/"
      protocol = "https"
    }
  }
} 
  1. terraform apply

Important Factoids

This is not specific to any region. I have seen it happen in both Ashburn and Phoenix.

References

https://registry.terraform.io/providers/oracle/oci/latest/docs/resources/load_balancer_rule_set The resource documentation references the parameters as being optional, so I would expect that if any of them are missing, they would be handled appropriately and similarly to the way the OCI console would deal with them.

gillfimj avatar Aug 17 '23 17:08 gillfimj