Skip to content

Error Creating ClickHouse Privilege Grant with ACCESS MANAGEMENT or ALL #89

@takaishi

Description

@takaishi

Summary

The terraform-rovider-clickhousedbops says Error Creating ClickHouse Privilege Grant when trying to grant ACCESS MANAGEMENT or ALL privileges to a user. We can face this error when using native protocol or http protocol.

Error Details

clickhousedbops_grant_privilege.example: Creating...
╷
│ Error: Error Creating ClickHouse Privilege Grant
│ 
│   with clickhousedbops_grant_privilege.example,
│   on main.tf line 46, in resource "clickhousedbops_grant_privilege" "example":
│   46: resource "clickhousedbops_grant_privilege" "example" {
│ 
│ The grant operation was successful but it didn't create the expected entry in system.grants table. This normally means there is an
│ already granted privilege to the same grantee that already includes the one you tried to apply.
╵

Terraform Configuration

% docker run -d -p 18123:8123 -p19000:9000 -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=changeme --name some-clickhouse-server --ulimit nofile=262144:262144 clickhouse/clickhouse-server:25.6.4.12
terraform {
  required_providers {
    clickhousedbops = {
      version = "1.3.1"
      source  = "ClickHouse/clickhousedbops"
    }
  }
}

provider "clickhousedbops" {
  host = "localhost"

  protocol = "http"
  port     = 18123

  auth_config = {
    strategy = "basicauth"
    username = "default"
    password = "changeme"
  }
}

resource "clickhousedbops_database" "example" {
  name = "example1"
}

resource "clickhousedbops_user" "example1" {
  name                            = "example1"
  password_sha256_hash_wo         = sha256("password")
  password_sha256_hash_wo_version = 1
}

resource "clickhousedbops_grant_privilege" "example" {
  privilege_name = "ACCESS MANAGEMENT" # or "ALL"
  database_name     = clickhousedbops_database.example.name
  grantee_user_name = clickhousedbops_user.example1.name
  grant_option      = true
}

Environment

  • Provider version: 1.3.1
  • ClickHouse version: 25.6.4.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions