Skip to content

Potential bug with new terraform clickhouse_database resource #243

@willbeaufoy

Description

@willbeaufoy

I am trying to use the new terraform clickhouse_database resource in v2.2.0-alpha1. I can create a clickhouse_service fine, but the databases error with Could not create database, unexpected error: status: 401, body: {"error":"Unauthorized"}. My API token has full admin permissions. I assume I should be able to create the databases if I can create the service. My terraform looks like:

resource "clickhouse_service" "service" {
  name           = "${local.aws_account_id}-${var.service_name_suffix}"
  cloud_provider = "aws"
  region         = "eu-west-2"
  tier           = var.environment == "prod" ? "production" : "development"
  idle_scaling   = true

  ip_access = [
    {
      source      = "0.0.0.0"
      description = "Allow All Connections"
    }
  ]

  idle_timeout_minutes  = 15
  max_replica_memory_gb = var.environment == "prod" ? 72 : null
  min_replica_memory_gb = var.environment == "prod" ? 24 : null

  password = var.clickhouse_cloud_password
}

resource "clickhouse_database" "mapped" {
  service_id = clickhouse_service.service.id
  name       = "mapped"
}

resource "clickhouse_database" "mapped_atlas_dev" {
  service_id = clickhouse_service.service.id
  name       = "mapped_atlas_dev"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions