Skip to content
Back

Terraform tablesdb_column type inconsistency

  • 0
  • Self Hosted
  • Databases
dklenke
7 May, 2026, 13:24

Hi, I am trying out the new terraform provider for appwrite that was introduced a few weeks back. As a first step I wanted to import our existing databases into a terraform state. When I try to import columns of type "string" terraform detects a change and plans a recreation of the column.

I had an example here but the message got too long and I wasn't allowed to post. This is the example https://pastebin.com/XXjCFNVW

So the api tells me the column type is string but terraform interprets type = "string" as a change requiring recreation. For now I am testing in a dev environment but later when I import in prod recreating the column is not an option. Am I misunderstanding something here? I have tried all "similar" types (varchar, text, longtext, mediumtext) just to see if it would have an effect but all lead to the same outcome.

TL;DR
Developers are using Terraform to import existing databases but facing an issue where columns of type "string" are being marked for recreation in the plan due to type inconsistency. The API shows the column as type "string," but Terraform interprets it differently. Changing the type to a different string variation produces the same result. Recreation of the column is not an option for the production environment.
dklenke
7 May, 2026, 13:25

Example from the pastebin above:

TypeScript
curl -XGET -H 'X-Appwrite-Project: my-project-id' -H 'X-Appwrite-Key: my-appwrite-key' 'https://my-appwrite-host.org/v1/tablesdb/my_db/tables/my_table/columns/user_id'

returns

TypeScript
{
  "key": "user_id",
  "type": "string",
  "status": "available",
  "error": "",
  "required": true,
  "array": false,
  "$createdAt": "2025-10-29T14:19:10.427+00:00",
  "$updatedAt": "2025-10-29T14:19:10.457+00:00",
  "size": 128,
  "default": null,
  "encrypt": false
}

But trying to import this into terraform state like

TypeScript
resource "appwrite_tablesdb_column" "my_db_my_table_user_id" {
  database_id = appwrite_tablesdb.my_db.id
  table_id    = appwrite_tablesdb_table.my_db_my_table.id
  type        = "string"
  key         = "user_id"
  array       = false
  default     = null
  encrypt     = false
  required    = true
  size        = 128
}
import {
  to = appwrite_tablesdb_column.my_db_my_table_user_id
  id = "my_db/my_table/user_id"
}

Returns the following change in the terraform plan

TypeScript
  # appwrite_tablesdb_column.my_db_my_table_user_id must be replaced
  # (imported from "my_db/my_table/user_id")
  # Warning: this will destroy the imported resource
-/+ resource "appwrite_tablesdb_column" "my_db_my_table_user_id" {
        array       = false
      ~ created_at  = "2025-10-29T14:19:10.427+00:00" -> (known after apply)
        database_id = "my_db"
        encrypt     = false
        key         = "user_id"
      ~ project_id  = "my-project-id" -> (known after apply)
        required    = true
        size        = 128
        table_id    = "my_table"
      + type        = "string" # forces replacement
      ~ updated_at  = "2025-10-29T14:19:10.457+00:00" -> (known after apply)
    }
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more