Update existing api gateway using OpenAPI and put_rest_api_mode

I have a relatively large APIgateway config and I am using OpenAPI spec to deploy it,
I was trying to use put_rest_api_mode to update an existing API config so that I can easily split the OpenAPI spec into multiple smaller files.
I was able to do it via the console. but not through terraform.

the block of code I used to try an update the existing apigateway.

resource "aws_api_gateway_rest_api" "api-gateway" {
  name = var.api_name
  endpoint_configuration {
    types = ["REGIONAL"]
  }
  //disable_execute_api_endpoint = true
  body = templatefile("./files/api.yaml", {vars}})
  put_rest_api_mode = "merge"
}