cockroachdb / terraform-provider-cockroach

Terraform provider for CockroachDB Cloud
Apache License 2.0
57 stars 12 forks source link

Could not enable log export: log channel 'TELEMETRY' 'DEV' is unknown #116

Closed uLan08 closed 1 year ago

uLan08 commented 1 year ago

Using cockroach_log_export_config, I encounter errors when specifying DEV and TELEMETRY channels.

│ Error: Error enabling log export
│
│   with module.cockroachdb_dedicated.cockroach_log_export_config.example[0],
│   on ../../metric_log_export.tf line 82, in resource "cockroach_log_export_config" "example":
│   82: resource "cockroach_log_export_config" "example" {
│
│ Could not enable log export: invalid argument: invalid field
│ ClusterSpec: log channel 'DEV' is unknown

│ Error: Error enabling log export
│
│   with module.cockroachdb_dedicated.cockroach_log_export_config.export[0],
│   on ../../metric_log_export.tf line 82, in resource "cockroach_log_export_config" "export":
│   82: resource "cockroach_log_export_config" "export" {
│
│ Could not enable log export: invalid argument: invalid
│ field ClusterSpec: log channel 'TELEMETRY' is unknown

I am able to create the cockroach_log_export_config resource after removing these channels. I don't understand why this is the case, official documentation mentions that this is a supported channel name.

Code

resource "cockroach_log_export_config" "export" {
  count          = var.enable_cloudwatch_integration ? 1 : 0
  id             = cockroach_cluster.cluster.id
  auth_principal = aws_iam_role.crdb_cloudwatch_role[count.index].arn
  log_name       = "${var.cluster_name}-${local.cockroachdb_short_name}"
  type           = "AWS_CLOUDWATCH"
  redact         = false
  groups         = [
    {
      log_name : "sql-perf",
      channels : ["SQL_PERF", "SQL_EXEC"],
      redact : false
    },
    {
      log_name : "ops",
      channels : ["OPS", "HEALTH", "SQL_SCHEMA"]
      min_level : "WARNING"
    },
    {
      log_name : "security",
      channels : ["SESSIONS", "USER_ADMIN", "PRIVILEGES", "SENSITIVE_ACCESS"]
    },
    {
      log_name : "debug",
      channels : ["DEV", "TELEMETRY", "STORAGE"],
      redact : true
    },
  ]
}

Terraform versions

Terraform v1.3.7
on darwin_amd64
+ provider registry.terraform.io/cockroachdb/cockroach v0.4.7
+ provider registry.terraform.io/hashicorp/aws v4.66.1
uLan08 commented 1 year ago

Oh okay. Apparently these log channels are not exportable from CockroachDB dedicated. https://www.cockroachlabs.com/docs/cockroachcloud/export-logs.html#what-log-channels-are-supported