oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 676 forks source link

Error received attempting to edit redirect rule_set created from terraform resource #1944

Open gillfimj opened 1 year ago

gillfimj commented 1 year ago

Community Note

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.

tf-oci-pub commented 4 months ago

Thank you for reporting the issue. We have raised an internal ticket to track this. Our service engineers will get back to you.