azaurus1 / terraform-provider-pinot

A terraform provider for Apache Pinot
https://registry.terraform.io/providers/azaurus1/pinot/latest
Mozilla Public License 2.0
8 stars 1 forks source link

Tables: "terraform apply" fails if tenants are not explicitly specified #107

Open johannesploetner opened 1 week ago

johannesploetner commented 1 week ago

If you don't explicitly specify tenants in your resource definition, the "terraform plan" works & creates the correct plan, but "terraform apply" fails:

      + table_type         = "OFFLINE"
      + tenants            = {}
    }

Plan: 2 to add, 0 to change, 0 to destroy.

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Saved the plan to: tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "tfplan"

➜  tables git:(main) ✗ terraform apply "tfplan"                             
pinot_schema.realtime_table_schema: Creating...
pinot_schema.realtime_table_schema: Creation complete after 0s
pinot_table.realtime_table: Creating...
╷
│ Error: Create Failed: Unable to create table
│ 
│   with pinot_table.realtime_table,
│   on main.tf line 127, in resource "pinot_table" "realtime_table":
│  127: resource "pinot_table" "realtime_table" {
│ 
│ client: request failed: status 400
│ {"code":400,"error":"Invalid table config for table realtime_ethereum_mainnet_block_headers_OFFLINE: Failed to find instances with tag: _BROKER for table: realtime_ethereum_mainnet_block_headers_OFFLINE"}

Whereas if you create a table using curl/REST API calls and having empty tenants, it works. IMHO the provider should behave the same as the REST API in this case.

azaurus1 commented 1 week ago

Note: This is an error coming from API -> go-pinot-api