Giter VIP home page Giter VIP logo

terraform-provider-coralogix's Introduction

terraform-provider-coralogix's People

Contributors

amit-o avatar davidmyriel avatar eldaraliiev avatar giltk avatar mbedulli avatar oded-dd avatar ornovo avatar povilasv avatar talknopf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-coralogix's Issues

Creating a reusable coralogix_tco_policy resource in a module errors on plan with invalid combination of arguments

Affected Resource(s)

  • coralogix_tco_policy

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

module main.tf:

  resource "coralogix_tco_policy" "tco_policy" {
  name       = var.name
  priority   = var.priority
  order      = var.order
  severities = var.severities

  application_name {
    is          = var.application_name.is
    is_not      = var.application_name.is_not
    starts_with = var.application_name.starts_with
    includes    = var.application_name.includes
    rule        = var.application_name.rule
    rules       = var.application_name.rules
  }

  subsystem_name {
    is          = var.subsystem_name.is
    is_not      = var.subsystem_name.is_not
    starts_with = var.subsystem_name.starts_with
    includes    = var.subsystem_name.includes
    rule        = var.subsystem_name.rule
    rules       = var.subsystem_name.rules
  }
}

module variables.tf:

variable "name" {
  description = "the name of the policy"
  type        = string
}

variable "priority" {
  description = "the priority of the policy"
  type        = string
}

variable "order" {
  type = number
}

variable "severities" {
  description = "the severities to apply the policy on. can be few of warning, error, critical, debug, verbose, info."
  type        = list(string)
}

variable "application_name" {
  type = object({
    includes    = optional(bool)
    is          = optional(bool)
    is_not      = optional(bool)
    starts_with = optional(bool)
    rule        = optional(string)
    rules       = optional(list(string))
  })
  default = {}
}

variable "subsystem_name" {
  type = object({
    includes    = optional(bool)
    is          = optional(bool)
    is_not      = optional(bool)
    starts_with = optional(bool)
    rule        = optional(string)
    rules       = optional(list(string))
  })
  default = {}
}

module versions.tf:

terraform {
  required_version = "~> 1.5.1"
  required_providers {
    coralogix = {
      source  = "coralogix/coralogix"
      version = "1.5.8"
    }
  }
}

example module call:

terraform {
  required_version = "~> 1.5.1"
  required_providers {
    coralogix = {
      source  = "coralogix/coralogix"
      version = "1.5.8"
    }
  }
}

provider "coralogix" {
  domain = <domain>
}


module "example_error" {
  source     = "../../modules/coralogix_tco_policy"
  name       = "compliance tco"
  priority   = "low"
  order      = "3"
  severities = ["warning", "error", "critical", "debug", "verbose", "info"]
  application_name = {
    includes = true
    rules    = ["test_app"]
  }
}

Debug Output

debug gist

Expected Behavior

Terraform should plan the resources.

Actual Behavior

Terraform fails to plan because of variable validation.

Steps to Reproduce

  1. Create a module and a module resource with the snippets above.
  2. terraform plan

Important Factoids

References

  • #0000

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Unable to initialize Coralogix provider.

Affected Resource(s)

The coralogix provider itself

Terraform Configuration Files

terraform {
  required_providers {
    coralogix = {
      source = "coralogix/coralogix"
      version = "1.8.15"
    }
  }
}

Debug Output

Expected Behavior

The Coralogix provider would be installed.

Actual Behavior

Receiving this error

β”‚ Error: Failed to install provider
β”‚ 
β”‚ Error while installing coralogix/coralogix v1.8.15: could not query provider registry for registry.terraform.io/coralogix/coralogix: failed to retrieve authentication checksums for provider: 404 Not Found returned from github.com
β•΅

Steps to Reproduce

badcure@XXX tmp % ls -ltr
total 8
-rw-r--r--  1 badcure  staff  127 Oct  2 12:56 global.tf
badcure@XXX tmp % cat global.tf 
terraform {
  required_providers {
    coralogix = {
      source = "coralogix/coralogix"
      version = "1.8.15"
    }
  }
}
badcure@XXX tmp % terraform init

Initializing the backend...

Initializing provider plugins...
- Finding coralogix/coralogix versions matching "1.8.15"...
β•·
β”‚ Error: Failed to install provider
β”‚ 
β”‚ Error while installing coralogix/coralogix v1.8.15: could not query provider registry for registry.terraform.io/coralogix/coralogix: failed to retrieve authentication checksums for provider: 404 Not Found returned from github.com
β•΅
  1. terraform apply

Important Factoids

References

  • #0000

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Provider produced inconsistent result after apply when `color_scheme` is being applied to query

Affected Resource(s)

  • coralogix_dashboard

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "coralogix_dashboard" "aws_runners" {
  name = "Sample dashabord"
  layout = {
    sections = [
      {
        rows = [
          {
            height = 9
            widgets = [
              {
                title = "Sample widget",
                definition = {
                  line_chart = {
                    legend = {
                      group_by_query = false
                    }
                    query_definitions = [
                      {
                        query = {
                          logs = {
                            lucene_query = <<-EOT
(${local.base_filters["runners"]["logs"]["aws"]}) && (${local.isError})
                            EOT
                            aggregations = [
                              {
                                type = "count"
                              }
                            ]
                          }
                        }
                        series_name_template = "Errors"
                        name                 = "Errors"
                        color_scheme          = "red"
                      },
                    ]
                  }
                }
                appearance = {
                  width = 0
                }
              },
            ]
          }
        ]
      }
    ]
  }

  time_frame = {
    relative = {
      duration = local.time_window
    }
  }

  filters = []

  folder = {
    id = coralogix_dashboards_folder.runners.id
  }
}

Expected Behavior

Terraform should not complain

Actual Behavior

Terraform fails with

When applying changes to coralogix_dashboard.local_runners, provider
β”‚ "provider[\"registry.terraform.io/coralogix/coralogix\"]" produced an
β”‚ unexpected new value:
β”‚ .layout.sections[0].rows[4].widgets[0].definition.line_chart.query_definitions[1].color_scheme:
β”‚ was cty.StringVal("red"), but now null.
β”‚ 
β”‚ This is a bug in the provider, which should be reported in the provider's
β”‚ own issue tracker.

Steps to Reproduce

Create any query in line_chart and attempt to define color_scheme (even with the default value)

  • #0000

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Each terraform apply wants to replace my resource

We have a resource that on each terraform run wants to replace the existing alart

This is our resource

resource "coralogix_alert" "digital_ocean_provider_healthy" {
  name     = "Digital ocean provider healthy - ${var.environment_name}"
  description = "This alert is triggered after a provider is recorded as unhealthy and is now reporting as healthy again."
  severity = "critical"
  enabled  = true
  type     = "text"

  filter {
    text         = "\"DO_HEALTH_GOOD\""
    applications = ["app-${var.environment_name}"]
    subsystems   = []
    severities   = []
  }

  condition {
    condition_type = "more_than"
    threshold      = 0
    timeframe      = "10MIN"
  }

  notifications {
    integrations = ["Video", "SlackVideo"]
  }
}

This is when I'm checking the plan

-/+ resource "coralogix_alert" "digital_ocean_provider_healthy" {
      ~ id          = "f232a470-9e20-11ec-abe9-25c233ccf15e" -> (known after apply)
        name        = "Digital ocean provider healthy - live"
        # (4 unchanged attributes hidden)



      - notifications { # forces replacement
          - emails       = [] -> null
          - integrations = [
              - "SlackVideo",
              - "Video",
            ] -> null
        }
      + notifications { # forces replacement
          + emails       = []
          + integrations = [
              + "Video",
              + "SlackVideo",
            ]
        }
        # (2 unchanged blocks hidden)
    }

The only difference I can see here is the way the integrations are ordered

Dashboards - invalid value for grafana.0.folder (must be a valid folder id)

If we try to set the folder id we get this error:

invalid value for grafana.0.folder (must be a valid folder id)

resource "coralogix_hosted_dashboard" dashboard {
  grafana {
    config_json = templatefile("${path.module}/dashboard_templates/high_level.tpl", {
        common_prefix = var.common_prefix
    })
    overwrite = true
    folder = var.grafana_folder_id
  }
}

From the ui I see this from the url of the dashboard:

https://coralogix-url/#/grafana/dashboards/f/V04RZuWSk/test-dashboard.
And I guess that the folder id is "V04RZuWSk", but I found on the provider code that the ID must match a regexp that wants the id as integer, but from the doc it can be a string https://registry.terraform.io/providers/coralogix/coralogix/latest/docs/resources/hosted_dashboard#folder

Error creating standard alert with more_than condition

Affected Resource(s)

  • coralogix_alert

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "coralogix_alert" "test_failure" {
  name     = "test failure"
  severity = "Critical"

  show_in_insights {
    notify_on                   = "Triggered_and_resolved"
    retriggering_period_minutes = 5
  }

  standard {
    applications = [
      "default"
    ]
    subsystems = [
      "tests"
    ]
    search_query = "name:TestResult NOT failed:[0, 2}"
    condition {
      # less_than         = false
      more_than         = true
      evaluation_window = "Rolling"
      time_window       = "5Min"
      threshold         = 0
      group_by          = []
      manage_undetected_values {
        enable_triggering_on_undetected_values = true
        auto_retire_ratio                      = "5Min"
      }
    }
  }

  notifications_group {
    notification {
      email_recipients = [] # each.value.email_recipients
    }
  }
}

Debug Output

https://gist.github.com/chris468/efad130a98ac57b2400686bde6a4e968

Panic Output

N/A

Expected Behavior

Alarm should have been created

Actual Behavior

Error saying that all of less_than, group_by, and manage_undetected_values must be specified:

Error: Missing required argument

  with coralogix_alert.test_failure,
  on standard_alert.tf line 25, in resource "coralogix_alert" "test_failure":
  25:       manage_undetected_values {

"standard.0.condition.0.manage_undetected_values": all of
`standard.0.condition.0.group_by,standard.0.condition.0.less_than,standard.0.condition.0.manage_undetected_values`
must be specified

I also tried specifying less_than = true instead of more_than, and it gave an error saying that all of more_than, group_by, and manage_undetected_values must be specified. And I tried specifying both less_than = false and more_than = true, and reported an error saying that only one of less_than or more_than can be specified.

Steps to Reproduce

  1. terraform plan

Important Factoids

N/A

References

  • N/A

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Dashboards - Metric-Promql Alert manage_undetected_values attribute representing nested block must not be unknown itself

This is our terraform code:

resource "coralogix_alert" "rds_cpu_usage_warning" {
  name        = "RDS CPU usage per RDS host - Warning TF"
  description = "Terraform example"
  severity    = "Warning"
  enabled     = false

  notifications_group {
    notification {
      notify_on                   = "Triggered_and_resolved"
      email_recipients            = local.is_alert_alert_emails
      retriggering_period_minutes = 1
    }
  }

  show_in_insights {
    retriggering_period_minutes = 1
    notify_on                   = "Triggered_and_resolved"
  }

  scheduling {
    time_zone = "UTC+2"
    time_frame {
      days_enabled = ["Monday", "Friday"]
      start_time   = "07:00"
      end_time     = "23:00"
    }
  }

  metric {
    promql {
      search_query = "avg_over_time((avg(amazonaws_com_AWS_RDS_CPUUtilization{}) by (DBInstanceIdentifier)) [5m])"
      condition {
        more_than                      = true
        threshold                      = local.rds_memory_usage_threshold[0]
        sample_threshold_percentage    = 0
        time_window                    = "5Min"
        replace_missing_value_with_zero = true
      }
    }
  }
}

If we try to run terraform plan we get:

Provider "registry.terraform.io/coralogix/coralogix" planned an invalid
value for
module.cloudwatch_ui[0].coralogix_alert.rds_cpu_usage_warning.metric[0].promql[0].condition[0].manage_undetected_values:
attribute representing nested block must not be unknown itself; set nested
attribute values to unknown instead.

From the doc the value for manage_undetected_values is not needed for Promql alerts.

If we try to set the value for manage_undetected_values we get:

Error: Missing required argument

with module.cloudwatch_ui.coralogix_alert.rds_cpu_usage_warning,
on modules/coralogix-ui/alerts.tf line 38, in resource "coralogix_alert" "rds_cpu_usage_warning":
38: manage_undetected_values {

"metric.0.promql.0.condition.0.manage_undetected_values": all of
metric.0.promql.0.condition.0.less_than,metric.0.promql.0.condition.0.manage_undetected_values
must be specified

We are missing something or there is an error with the provider or the documentation?

Thank you
Lorenzo

Runtime error: invalid memory address or nil pointer dereference

Affected Resource(s)

terraform-provider-coralogix_1.10.11

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

https://registry.terraform.io/providers/coralogix/coralogix/latest/docs/resources/alert

Debug Output

Panic Output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xc5cf04]

goroutine 102 [running]:
terraform-provider-coralogix/coralogix.extractCreateAlertRequest(0xdf8474860?)
terraform-provider-coralogix/coralogix/resource_coralogix_alert.go:1560 +0xb24
terraform-provider-coralogix/coralogix.resourceCoralogixAlertCreate({0x1225cc8, 0xc000b36330}, 0x0?, {0x102efc0?, 0xc000732990?})
terraform-provider-coralogix/coralogix/resource_coralogix_alert.go:1444 +0x65
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc0004caa80, {0x1225d00, 0xc0005e8840}, 0xd?, {0x102efc0, 0xc000732990})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0004caa80, {0x1225d00, 0xc0005e8840}, 0xc000828000, 0xc0003cb200, {0x102efc0, 0xc000732990})
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0004c60d8, {0x1225d00?, 0xc0007d22a0?}, 0xc000192460)
github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1074 +0xe8d
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x122e040?, 0xc0004c60d8?}}, {0x1225d00, 0xc0007d22a0}, 0x0?)
github.com/hashicorp/[email protected]/tf5to6server/tf5to6server.go:37 +0x5a
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).ApplyResourceChange(0x1225c58?, {0x1225d00?, 0xc0005e8660?}, 0xc000192410)
github.com/hashicorp/[email protected]/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x1b5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc0004b4280, {0x1225d00?, 0xc00073fcb0?}, 0xc000218310)
github.com/hashicorp/[email protected]/tfprotov6/tf6server/server.go:857 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x1031fc0?, 0xc0004b4280}, {0x1225d00, 0xc00073fcb0}, 0xc0003ca780, 0x0)
github.com/hashicorp/[email protected]/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:503 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000572000, {0x1225d00, 0xc00073fc20}, {0x122b8f8, 0xc0005824e0}, 0xc0005afd40, 0xc0004d3e60, 0x198ae38, 0x0)
google.golang.org/[email protected]/server.go:1372 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc000572000, {0x122b8f8, 0xc0005824e0}, 0xc0005afd40)
google.golang.org/[email protected]/server.go:1783 +0x1031
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/[email protected]/server.go:1016 +0x68
created by google.golang.org/grpc.(*Server).serveStreams.func2
google.golang.org/[email protected]/server.go:1027 +0x12e

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Outdated documentation for `coralogix_alert` resource

Hello,

we've been trying to figure out what's wrong with our configs and we've discovered that there was a change released in v1.11.0 of this provider and following fact is not documented:

exactly one of incident_settings or all of notifications_group..notification.. notify_on and retriggering_period_minutes must be set.

`coralogix_rules_group` creates rules with OR instead of AND

resource: coralogix_rules_group.
When I'm creating a new rules group via the coralogix_rules_group resource, i the rules inside it are created with "OR" condition and not "AND", even though the doc declares it should be created with AND (&&).
image

And example:

resource "coralogix_rules_group" "example" {
name         = "otel-agent-ecs-rule"
  order = 1
rules {
 parse_json_field {
                 active                 = true
                 description            = "Parse the LogRecord.body.log to an object"
                 destination_field      = "text.new_body"
                 keep_destination_field = true
                 keep_source_field      = false
                 name                   = "Parse LogRecord.body.log to obj"
                 source_field           = "text.logRecord.body"
                }
            }
remove_fields {
                active          = true
                description     = "Remove redundant fields"
                 excluded_fields = [
                     "logRecord.body",
                     "new_body",
                      "resourceSchemaUrl"
                    ]
                 name            = "Remove redundant Fields"
                }
}
}

image

Application order of coralogix_sli filters is inconsistent

Affected Resource(s)

  • coralogix_sli

Terraform Configuration Files

terraform {
  required_version = ">= 1.5.7"
  required_providers {
    coralogix = {
      source  = "coralogix/coralogix"
      version = ">=1.10.3"
    }
  }
}

provider "coralogix" {}

resource "coralogix_sli" "test_sli_with_filters" {
  name            = "test_sli_with_filters"
  slo_period_type = "7_days"
  service_name    = "nidataframe"
  slo_percentage  = "99"
  metric_type     = "error"
  filters = [{
    compare_type = "is"
    field        = "tags.http.route"
    field_values = ["nidataframe/v1/tables", "nidataframe/v1/tables/{id}/data"]
    },
    {
      compare_type = "is"
      field        = "tags.http.well_formed_request"
      field_values = ["true"]
    },
    {
      compare_type = "is"
      field        = "tags.http.request.method"
      field_values = ["POST"]
  }]
}

Debug Output

Successful apply
Failed apply

Panic Output

N/A

Expected Behavior

The order in which the filters are applied is consistent, avoiding the Provider produced inconsistent result after apply error.

Actual Behavior

Subsequent applies without changes fail because the provider thinks the filter order has changed when it has not.

Steps to Reproduce

  1. terraform apply (succeed)
  2. terraform apply (error)

Important Factoids

N/A

References

  • #193 - The resulting error is the same as mentioned in this issue.

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

TCO-Policy - 'order' gets incorrect value via terraform

Currently, there is no support in the backend side to control the order of TCO policies on creation several Policies in parallel (it is planned to be supported).
Therefore, it required to apply the policies without parallelism (terraform apply -auto-approve -parallelism=1).

Datasource for AWS PrivateLink VPC endpoint

Description

When setting up AWS PrivateLink connection to Coralogix, it is currently needed to source VPC endpoints from Coralogix documentation [1].

A more convenient solution would be to have a datasource which would provide the VPC endpoint URL, similar to how other vendors implement this [2].

New or Affected Resource(s)

Not affecting existing resources.

Potential Terraform Configuration

data "coralogix_system_get_privatelink_config" "coralogix_private_link" {}

resource "aws_vpc_endpoint" "coralogix_private_link" {
  vpc_id              = var.vpc_id
  service_name        = data.coralogix_system_get_privatelink_config.coralogix_private_link.aws_vpce_id
  vpc_endpoint_type   = "Interface"
.....
}

References

[1] https://coralogix.com/docs/coralogix-amazon-web-services-aws-privatelink-endpoints/

[2] https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/data-sources/system_get_privatelink_config

  • #0000

Community Note

  • Please vote on this issue by adding a
    πŸ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Missing documentation for importing existing resources

Description

πŸ‘‹ - Most terraform resources that support being imported have a documentation snippet at the bottom of the docs page (for example https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ami)

It would be great to see these added for this provider as the lack of it suggests resources don't support being imported when some of them actually do. The examples are also helpful for understanding the format of the id to use in the import which isn't always obvious.

Thanks πŸ‘

Provider produced inconsistent result after apply if order changed in UI

Affected Resource(s)

  • coralogix_tco_policy_logs

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_version = ">= 1.2.3"
  required_providers {
    coralogix = {
      source  = "coralogix/coralogix"
      version = ">=1.10"
    }
  }
}

provider "coralogix" {}

resource "coralogix_tco_policy_logs" "tco_policy_all_logs_to_low" {
  name       = "pawling-test debug to low - tf"
  priority   = "low"
  order      = 10
  severities = ["debug"]
}

Debug Output

https://gist.github.com/chris468/9005c7c947badbcb36dc222bbd0c21aa

I forgot to redirect stderr when I captured the logs, but I was able to get the full debug output from console history for 2 of the files.

Panic Output

N/A

Expected Behavior

Ideally find a way to maintain the desired order, but at least error during apply rather than reporting inconsistent result.

Actual Behavior

β”‚ Error: Provider produced inconsistent result after apply
β”‚
β”‚ When applying changes to coralogix_tco_policy_logs.tco_policy_all_logs_to_low, provider "provider[\"registry.terraform.io/coralogix/coralogix\"]"
β”‚ produced an unexpected new value: .order: was cty.NumberIntVal(10), but now cty.NumberIntVal(3).
β”‚
β”‚ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Steps to Reproduce

  1. Check order of any existing policies: grpcurl -H "Authorization: Bearer $CORALOGIX_API_KEY" -d '{}' ng-api-grpc.coralogix.com:443 com.coralogix.quota.v1.PoliciesService.GetCompanyPolicies | jq '.policies[] | {name: .name, order: .order}'
    Result:
    {
      "name": "End to end test logs",
      "order": 1
    }
    {
      "name": "Debug, Verbose, and Info to Low",
      "order": 2
    }
    
  2. terraform apply | tee initial_apply.log
  3. Check order: grpcurl -H "Authorization: Bearer $CORALOGIX_API_KEY" -d '{}' ng-api-grpc.coralogix.com:443 com.coralogix.quota.v1.PoliciesService.GetCompanyPolicies | jq '.policies[] | {name: .name, order: .order}'
    Result: Terraform-created policy is order 3, even though 10 was specified in resource definition. But overall order is correct.
    {
      "name": "End to end test logs",
      "order": 1
    }
    {
      "name": "Debug, Verbose, and Info to Low",
      "order": 2
    }
    {
      "name": "pawling-test debug to low - tf",
      "order": 3
    }
    
  4. Create another tco policy in the web UI, at the end.
  5. Check order: grpcurl -H "Authorization: Bearer $CORALOGIX_API_KEY" -d '{}' ng-api-grpc.coralogix.com:443 com.coralogix.quota.v1.PoliciesService.GetCompanyPolicies | jq '.policies[] | {name: .name, order: .order}'
    Result: New policy has order 4, makes sense
    {
      "name": "End to end test logs",
      "order": 1
    }
    {
      "name": "Debug, Verbose, and Info to Low",
      "order": 2
    }
    {
      "name": "pawling-test debug to low - tf",
      "order": 3
    }
    {
      "name": "pawling-test verbose to low - ui",
      "order": 4
    }
    
  6. In the web UI, move the manually created one above the one that was created by the stack: swap 3 and 4.
  7. Check order: grpcurl -H "Authorization: Bearer $CORALOGIX_API_KEY" -d '{}' ng-api-grpc.coralogix.com:443 com.coralogix.quota.v1.PoliciesService.GetCompanyPolicies | jq '.policies[] | {name: .name, order: .order}'
    Result all policies orders are updated, starting w/ 0 instead of 1:
    {
      "name": "End to end test logs",
      "order": 0
    }
    {
      "name": "Debug, Verbose, and Info to Low",
      "order": 1
    }
    {
      "name": "pawling-test verbose to low - ui",
      "order": 2
    }
    {
      "name": "pawling-test debug to low - tf",
      "order": 3
    }
    
  8. terraform apply | tee second_apply.log
    Result: Error in provider
    β”‚ Error: Provider produced inconsistent result after apply
    β”‚
    β”‚ When applying changes to coralogix_tco_policy_logs.tco_policy_all_logs_to_low, provider "provider[\"registry.terraform.io/coralogix/coralogix\"]"
    β”‚ produced an unexpected new value: .order: was cty.NumberIntVal(10), but now cty.NumberIntVal(3).
    β”‚
    β”‚ This is a bug in the provider, which should be reported in the provider's own issue tracker.
    
    

Important Factoids

Our use case is that we want a default policy to set Info and below to 'Low', but we have an exception where we have one service that needs Info to be 'High'. We attempted to do this by setting the "default" policy w/ a high order, so that "exceptions" could be inserted above it.

When that didn't work, we tried to set the order to exactly what it should be. But the terraform resource will not allow an order of 0: Change the order in the configuration to 0 and terraform validate | tee validate_order_0.log reports:

β”‚ Error: Invalid Attribute Value
β”‚
β”‚   with coralogix_tco_policy_logs.tco_policy_all_logs_to_low,
β”‚   on main.tf line 15, in resource "coralogix_tco_policy_logs" "tco_policy_all_logs_to_low":
β”‚   15:   order      = 0
β”‚
β”‚ Attribute order value must be at least 1, got: 0

References

  • #113 refers to multiple policies in the same terraform stack. But in these steps I use a single policy.
  • #178 removed coralogix_tco_policy_override. I believe policy overrides would be a better solution to my use case. Is there a plan to support a policy override resource going forward?

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Ability to manage notification groups through Terraform.

Description

There are many alerts that come out of the box. In our specific case for now, it would be the Okta alerts.

It would be nice to be able to through Terraform to programmatically attach notifications without the need to manage the alerts themselves, or create duplicate alerts.

New or Affected Resource(s)

  • resource - coralogix_alert_notification_group - The ability to manage a particular notification group only
  • data - coralogix_alerts - The ability to get back a list of alerts based on some search criteria.

Potential Terraform Configuration

data "coralogix_alerts" "okta_alerts" {
  name_search = "Okta -"
  labels = ["label1:value1", "lable2:value2"]
  status = "active/disabled"
  severity = "info"
}

resource "coralogix_alert_notification_group" "okta_notifications" {
  count = len(data.coralogix_alerts.okta_alerts.ids) 
  alert_id = data.coralogix_alerts.okta_alerts.ids[count.index]
  group_by_fields = []
  notification {
    integration_id              = coralogix_webhook.slack_staging.id
    retriggering_period_minutes = 10
  } 
}

References

None

  • #0000

Community Note

  • Please vote on this issue by adding a
    πŸ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Unable to share Grafana dashboards between Coralogix teams using Terraform

Affected Resource(s)

  • coralogix_hosted_dashboard

Terraform Configuration Files

# Comments describe behavior applying to our "dev" Team/tier.

# Applies and loads successfully.
resource "coralogix_hosted_dashboard" "bug_dashboard_copied_from_dev" {
  grafana {
    config_json = file("${path.module}/grafana-bug-dev.json")
  }
}

# Dashboard loads broken with "Datasource XFs7pbK4z was not found",
resource "coralogix_hosted_dashboard" "bug_dashboard_copied_from_test" {
  grafana {
    config_json = file("${path.module}/grafana-bug-test.json")
  }
}

# Dashboard loads broken with "Datasource ${DS_LOGS} was not found"
resource "coralogix_hosted_dashboard" "bug_dashboard_exported_for_sharing" {
  grafana {
    config_json = file("${path.module}/grafana-bug-exported-for-sharing.json")
  }
}

# Dashboard loads without errors but NO Data. Widget is linked to "Metrics" (the default?) instead of "Logs" as expected.
resource "coralogix_hosted_dashboard" "bug_dashboard_delete_elastic_datasource_uid" {
  grafana {
    config_json = file("${path.module}/grafana-bug-delete-datasource-uid.json")
  }
}

See gist for json files: https://gist.github.com/astarche/5d84f939328959975d997e50dabc52b6

The Grafana json includes a "datasource uid" for each data source (Logs or Metrics). This uid is not the same for each Coralogix instance, so the dashboard does not import correctly to a different Coralogix Team.

Debug Output

There is no debug output. The dashboards are created successfully but have errors when loading in Grafana.

Panic Output

None.

Expected Behavior

I don't know if these options should "magically work", but there should be a recommended way to apply the same Grafana dashboards to different Coralogix teams. This could be something explicit like detecting the datasource ID as a Terraform Data source and passing it as a parameter. Or it could be automatic.

The Grafana "export for sharing externally" feature was created for this purpose but it's implemented in the Grafana UI.

Actual Behavior

The failure in grafana is either:

  • "Datasource <some_name> was not found"
  • Dashboard loads linked to default Metrics datasource instead of logs.

See comments in the terraform config for more details.

Steps to Reproduce

  1. Create a grafana dashboard in the Grafana instance for Coralogix Team "test"
  2. Export the dashboard json either by (a) copying the JSON Model or (b) using the "Export for sharing externally" option or (c) delete the datasource uid.
  3. terraform apply to a different Coralogix Team "dev"
  4. Open the created dashboard(s) on dev to see errors.

Note that in the example terrraform I have manually changed the dashboard uid and name to allow deploying multiple versions of the same dashboard.

Important Factoids

We use a separate Coralogix Team for each environment (i.e. dev/test/astarche-demo) with common Terraform to apply the configuration.

References

None.

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Webhook doc question

Hello,
I was waiting for the webhook support PR before upgrading to version 1.3.x.
Now that the PR was merged I just want to verify that it is indeed supported since in the doc it is still stated

Note! The Coralogix terraform registry has now been updated to v1.3.x. The new version contains many breaking changes and does not support webhooks. It should be configured by following the instructions below.

So just wanted to verify it's just a doc that needs a bit of update and not something else I'm missing.
Thanks

Unable to create dashboards using data_table widget with aggregations

Affected Resource(s)

  • coralogix_dashboard

Terraform Configuration Files

coralogix_dashboard resource snippet 1 Here I have used official Coralogix TF 1.13.4 documentation to build a data table - however not sure how to reference the Aggregation in the column so I used its name. I also tried just with "Aggregation".
resource "coralogix_dashboard" "test1" {
  layout = {
    sections = [
      {
        rows = [
          {
            height  = 19
            widgets = [
              {
                definition = {
                  data_table = {
                    query = {
                      logs = {
                        filter = [
                          {
                            logs = {
                              field = "applicationname"
                              operator = {
                                type            = "equals"
                                selected_values = ["xxx"]
                              }
                            }
                          },
                          {
                            logs = {
                              field = "subsystemname"
                              operator = {
                                type            = "equals"
                                selected_values = ["xxx"]
                              }
                            }
                          }
                        ]
                        aggregation = {
                          type = "count"
                        }
                        group_names_fields = [
                          {
                            keypath = ["xxx", "xxx", "xxx"]
                            scope   = "label"
                          }
                        ]
                      }
                    }
                    results_per_page = 10
                    row_style        = "one_line"
                    columns          = [
                      {
                        field = "GroupBy:coralogix.metadata.subsystemName"
                      },
                      {
                        field = "Aggregation:Count"
                      }
                    ]
                    data_mode_type = "archive"
                    order_by = {
                      field           = "Aggregation:Count"
                      order_direction = "desc"
                    }
                  }
                }
                title = "New Data Table"
              }
            ]
          }
        ]
      }
    ]
  }
  name = "Dashboard TEST"
}
coralogix_dashboard resource snippet 2 Here I have used extracted code from tfstate after creating the dashboard manually in the UI and then using "data" source in Terraform to load it into tfstate. This one has a different structure than that provided in the documentation. Here I'm trying to use the aggregation name.
resource "coralogix_dashboard" "test2" {
  layout = {
    sections = [
      {
        rows = [
          {
            height  = 19
            widgets = [
              {
                definition = {
                  data_table = {
                    columns = [
                      {
                        field = "GroupBy:xxx"
                      },
                      {
                        field = "Aggregation:Count"
                        width = 200
                      }
                    ]
                    data_mode_type = "archive"
                    order_by = {
                      field           = "Aggregation:Count"
                      order_direction = "desc"
                    }
                    query = {
                      logs = {
                        filters = [
                          {
                            field = "applicationname"
                            observation_field = {
                              keypath = ["applicationname"]
                              scope   = "label"
                            }
                            operator = {
                              selected_values = ["xxx"]
                              type            = "equals"
                            }
                          },
                          {
                            field = "subsystemname"
                            observation_field = {
                              keypath = ["subsystemname"]
                              scope   = "label"
                            }
                            operator = {
                              selected_values = ["xxx"]
                              type            = "equals"
                            }
                          }
                        ],
                        grouping = {
                          aggregations = [
                            {
                              aggregation = {
                                type = "count"
                              }
                              is_visible = true
                              name       = "Count"
                            }
                          ]
                          group_bys = [
                            {
                              keypath = ["xxx", "xxx", "xxx"]
                              scope   = "user_data"
                            }
                          ]
                        }
                      }
                    }
                    results_per_page = 10
                    row_style        = "one_line"
                  }
                }
                title = "New Data Table"
              }
            ]
          }
        ]
      }
    ]
  }
  name = "Dashboard TEST"
}
coralogix_dashboard resource snippet 3 Here I'm also using the code from tfstate, however I tried to assign the "id" to the aggregation definition and referenced it in column and order by.
resource "coralogix_dashboard" "test3" {
  layout = {
    sections = [
      {
        rows = [
          {
            height  = 19
            widgets = [
              {
                definition = {
                  data_table = {
                    columns = [
                      {
                        field = "GroupBy:xxx"
                      },
                      {
                        field = "Aggregation:8e21cba0-070b-79f1-3c1c-05b50f72dacc"
                        width = 200
                      }
                    ]
                    data_mode_type = "archive"
                    order_by = {
                      field           = "Aggregation:8e21cba0-070b-79f1-3c1c-05b50f72dacc"
                      order_direction = "desc"
                    }
                    query = {
                      logs = {
                        filters = [
                          {
                            field = "applicationname"
                            observation_field = {
                              keypath = ["applicationname"]
                              scope   = "label"
                            }
                            operator = {
                              selected_values = ["xxx"]
                              type            = "equals"
                            }
                          },
                          {
                            field = "subsystemname"
                            observation_field = {
                              keypath = ["subsystemname"]
                              scope   = "label"
                            }
                            operator = {
                              selected_values = ["xxx"]
                              type            = "equals"
                            }
                          }
                        ],
                        grouping = {
                          aggregations = [
                            {
                              aggregation = {
                                type = "count"
                              }
                              id = "8e21cba0-070b-79f1-3c1c-05b50f72dacc"
                              is_visible = true
                              name       = "Count"
                            }
                          ]
                          group_bys = [
                            {
                              keypath = ["xxx", "xxx", "xxx"]
                              scope   = "user_data"
                            }
                          ]
                        }
                      }
                    }
                    results_per_page = 10
                    row_style        = "one_line"
                  }
                }
                title = "New Data Table"
              }
            ]
          }
        ]
      }
    ]
  }
  name = "Dashboard TEST"
}

Debug Output

Dashboard 1:
Terraform passed but created dashboard contains an Event type data table instead of Aggregation type
image
Dashboard 2:
Terraform passed but the dashboard fails to load in the UI. Browser console contains this error:
TypeError: column is undefined
Also:

ZodError: [
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "object",
            "received": "undefined",
            "path": [
              "dashboard",
              "layout",
              "sections",
              0,
              "rows",
              0,
              "widgets",
              0,
              "definition",
              "dataTable",
              "query",
              "logs",
              "grouping",
              "aggregations",
              0,
              "id"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "string",
            "received": "undefined",
            "path": [
              "dashboard",
              "layout",
              "sections",
              0,
              "rows",
              0,
              "widgets",
              0,
              "definition",
              "dataTable",
              "query",
              "logs",
              "grouping",
              "aggregations",
              0,
              "id"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [
      "dashboard",
      "layout",
      "sections",
      0,
      "rows",
      0,
      "widgets",
      0,
      "definition",
      "dataTable",
      "query",
      "logs",
      "grouping",
      "aggregations",
      0,
      "id"
    ],
    "message": "Invalid input"
  }
]

Dashboard 3:
Terraform fails with:

Error: -18T08:26:55.003Z [ERROR] provider.terraform-provider-coralogix_1.13.4: Response contains error diagnostic:
  diagnostic_detail=
  | Cannot set value for this attribute as the provider has marked it as read-only. Remove the configuration line setting the value.
  | 
  | Refer to the provider documentation or contact the provider developers for additional information about configurable and read-only attributes that are supported.
   diagnostic_summary="Invalid Configuration for Read-Only Attribute" tf_proto_version=6.4 tf_resource_type=coralogix_dashboard @caller=github.com/hashicorp/[email protected]/tfprotov6/internal/diag/diagnostics.go:62 @module=sdk.proto diagnostic_severity=ERROR tf_req_id=4abd06f1-b65a-71fb-b42a-a372a09b88a6 tf_rpc=ValidateResourceConfig diagnostic_attribute="AttributeName(\"layout\").AttributeName(\"sections\").ElementKeyInt(0).AttributeName(\"rows\").ElementKeyInt(0).AttributeName(\"widgets\").ElementKeyInt(0).AttributeName(\"definition\").AttributeName(\"data_table\").AttributeName(\"query\").AttributeName(\"logs\").AttributeName(\"grouping\").AttributeName(\"aggregations\").ElementKeyInt(0).AttributeName(\"id\")" tf_provider_addr=registry.terraform.io/coralogix/coralogix timestamp=2024-04-18T08:26:55.002Z
Error: -18T08:26:55.003Z [ERROR] vertex "coralogix_dashboard.test3" error: Invalid Configuration for Read-Only Attribute

Expected Behavior

It should be possible to create a dashboard containing data table widget with aggregations via Terraform.

Actual Behavior

It's not possible to create a dashboard containing data table widget with aggregations using latest Terraform provider.

Important Factoids

Terraform 1.6.6
Coralogix TF provider 1.13.4

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Coralogix Slack Webhook - Monitor alert message Snapshot field

Description of the issue

Coralogix Slack Webhook - Monitor alert message > Snapshot field is automatically set to true. This is not a part of the Coralogix Terraform Provider so when creating a webhook you must enter each webhook and change this field to false.
image

Affected Resource(s)

Coralogix Slack webhook.

Terraform Configuration Files

The field's setting is missing in the Coralogix Terraform Provider:

Expected Behavior

This should be part of the Coralogix webhook resource. If it is not, it should not be set to true by default.

Steps to Reproduce

Create a webhook resource -

resource "coralogix_webhook" "slack_webhook" {
  name = "slack-webhook"
  slack = {
    notify_about = ["flow_anomalies"]
    url = "https://join.slack.com/example"
  }
}

Go to the created resource and see that the Snapshot is automatically set to true.

Add more unit for line chart with Terraform

Description

Hello, we need the USD unit for some line chart graphic, I see this unit is available on Coralogix UI but in Terraform, we have an error because it's not available, only unit about size and time are available. This is the error that I get when I set usd value:

Error: Invalid Attribute Value Match

  with coralogix_dashboard.xxxx,
  on xxxxx.tf line 1, in resource "coralogix_dashboard" "xxxxxxx":
   1: resource "coralogix_dashboard" "xxxxxxxxx" {

Attribute
layout.sections[0].rows[0].widgets[0].definition.line_chart.query_definitions[1].unit
value must be one of: ["bytes" "mbytes" "gibytes" "unspecified" "seconds"
"kbytes" "gbytes" "bytes_iec" "kibytes" "mibytes" "microseconds"
"milliseconds"], got: "usd"

Actually, if I apply the dashboard without unspecified unit, I can go to the Coralogix UI to modify the unit, select usd then save modification. When I export the dashboard in Json, I see

unit:	"UNIT_USD"

New or Affected Resource(s)

  • coralogix_dashboard

Potential Terraform Configuration

                            {
                                title      = "Cost of docs per day"
                                definition = {
                                    line_chart = {
                                        legend            = {
                                            group_by_query = true
                                            is_visible     = true
                                        }
                                        query_definitions = [
                                            {
                                                data_mode_type     = "unspecified"
                                                is_visible         = true
                                                name               = "Diff"
                                                query              = {
                                                    metrics = {
                                                        promql_query = <<EOT
                                                        EOT
                                                    }
                                                }
                                                resolution         = {
                                                    buckets_presented = 96
                                                }
                                                scale_type             = "linear"
                                                series_count_limit = 20
                                                unit                         = "usd"
                                            },
                                        ]

References

  • #0000

Community Note

  • Please vote on this issue by adding a
    πŸ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform lose track of alarm if you manually change it

Hi, using this module we faced an issue when terraform lose track of alarm if you manually change it. It. not always possible to handle all conditions via terraform(especially when using for each to create a bunch of similar alarms and later on adjust them separately in UI)

Expected Behavior
Able to change alarm settings and conditions manually or by terraform
Current Behavior
Terraform lose track of alarm after any changes due to unique id change
Possible Solution
Steps to Reproduce

  1. Create alarm using terraform
  2. Change anything in this alarm
  3. Run terraform plan

Mandatory block in coralogix_alert resource is not documented properly

Affected Resource(s)

  • coralogix_alert

Terraform Configuration Files

resource "coralogix_alert" "count_get_response_times_warning" {
  name     = "${local.alert_display_name} [Number of GET with response times P90 >= 500ms]"
  enabled  = var.enable_alerts
  severity = "Warning"

  meta_labels = {
    application = var.aws_account_name
    subsystem   = var.ecs_service_name
  }

  standard {
    search_query = ".......omitted..... AND http_request.duration_ms: [500 TO *} ${local.get_http_method_condition_q1}"
    applications = [var.aws_account_name]
    subsystems   = [var.ecs_service_name]
    severities   = [
      "Info", "Error"
    ]
    condition {
      more_than   = true
      threshold   = var.cx_get_slow_request_threshold
      time_window = var.cx_get_slow_request_time_window
    }
  }
}

Debug Output

Error: internal error in Coralogix backend.
β”‚ error - rpc error: code = Internal desc = statusCode: 400, response: {"success":false,"status":400,"message":"alert definition, notificationGroups is invalid , SequelizeValidationError: Must have at least 1 notificationGroups item"}
β”‚ url - com.coralogix.alerts.v2.AlertService/CreateAlert

Expected Behavior

notification_group should be either documented as required or allowed to be optional in CX backend

Actual Behavior

notification_group must be specified otherwise TF plan fails

Important Factoids

Coralogix TF provider v1.14.1
TF v1.8.2

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Changes are applied, but never saved

I had the following resource

resource "coralogix_alert" "castle_purchase_error_web" {
  name     = "Castle purchase error web - ${var.environment_name}"
  description = "Unable to purchase gift on web"
  severity = "info"
  enabled  = true
  type     = "text"

  filter {
    text         = "logStoreFailure AND castle AND platform:3"
    applications = ["app-${var.environment_name}"]
    subsystems   = []
    severities   = []
  }

  condition {
    condition_type = "more_than"
    threshold      = 30
    timeframe      = "1H"
  }

  notifications {
    integrations = ["Fraud"]
  }
}

I changed the text to be the following

text         = "\"logStoreFailure\" AND \"castle\" AND platform:3"

Terraform says it's going to update the alert

 # coralogix_alert.castle_purchase_error_web will be updated in-place
  ~ resource "coralogix_alert" "castle_purchase_error_web" {
        id          = "f1a49df1-9a3e-11ec-b57d-57f7f49f8514"
        name        = "Castle purchase error web - live"
        # (4 unchanged attributes hidden)


      + filter {
          + applications = [
              + "app-live",
            ]
          + severities   = []
          + subsystems   = []
          + text         = "\"logStoreFailure\" AND \"castle\" AND platform:3"
        }
      - filter {
          - applications = [
              - "app-live",
            ] -> null
          - severities   = [] -> null
          - subsystems   = [] -> null
          - text         = "logStoreFailure AND castle AND platform:3" -> null
        }

        # (2 unchanged blocks hidden)
    }

Once apply has finished, the alert still has the old values.

Each terraform apply wants to update the resource.

Missing webhook resources after minor version upgrade

Affected Resource(s)

  • coralogix_webhook

Terraform Configuration Files

resource "coralogix_webhook" "coralogix_webhook" {
  alias      = "API webhook"
  type       = "pager_duty"
  pager_duty = pagerduty_service_integration.coralogix.integration_key // reference to another resource from same module 
}

resource "coralogix_webhook" "coralogix_webhook_email" {
  alias      = "Email webhook"
  type       = "email_group"
  email_group = [ pagerduty_service_integration.coralogix.integration_email ] // reference to another resource from same module  
}

Expected Behavior

coralogix_webhook resource remains available for usage after the minor version upgrade.
No errors received from re-running the existing Terraform stacks.

Actual Behavior

Dozens of our TF stacks just return errors due to invalid resource

Error: Invalid resource type
  on .terraform/modules/module_name/integration_cx.tf line 52, in resource "coralogix_webhook" "coralogix_webhook":
  52: resource "coralogix_webhook" "coralogix_webhook" {

The provider provider.coralogix does not support resource type
"coralogix_webhook".

Steps to Reproduce

  1. Upgrade the coralogix provider from 1.2.x to 1.3.x version
  2. Try to run terraform plan over existing configuration

References

  • Seems like there's upcoming change which should bring back webhook resources - #51

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Error: Provider produced invalid plan

β”‚ Provider "registry.terraform.io/coralogix/coralogix" planned an invalid
β”‚ value for
β”‚ coralogix_alert.standard_alert.standard[0].condition[0].group_by_key:
β”‚ planned value cty.StringVal("") for a non-computed attribute.
β”‚
β”‚ This is a bug in the provider, which should be reported in the provider's
β”‚ own issue tracker.
β•΅
β•·
β”‚ Error: Unable to Read Previously Saved State for UpgradeResourceState
β”‚
β”‚ with coralogix_webhook.pager_duty_webhook,
β”‚ on coralogix-alerts.tf line 1, in resource "coralogix_webhook" "pager_duty_webhook":
β”‚ 1: resource "coralogix_webhook" "pager_duty_webhook" {
β”‚
β”‚ There was an error reading the saved resource state using the current
β”‚ resource schema.

Applied only one change, updated Coralogix for 1.4.4 to 1.10.4 version

coralogix = {
source = "coralogix/coralogix"
version = "> 1.4.4"
}
coralogix = {
source = "coralogix/coralogix"
version = "
> 1.10.4"
}

Affected Resource(s)

  • coralogix_XXXXX

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Creating Native Dashboards via Terraform Using Layout

Hi CX team. This is not really a bug but an inquiry. I would like to seek help regarding creations of native dashboards via TF.

The self-service I would like to expose to my users is to create the dashboard first (in any folder), export as JSON and drop to a self-service repo. structure of the repo below

parent-1/sub-11/db.json
parent-2/sub-21/db.json

these folders are created in CX accordingly, however Im stuck in creating the dashboard.

Creating via below seems inflexible(?) as i need to give my users options which folder the dashboard should be created as structured in the self-service repo.

resource "coralogix_dashboard" dashboard_from_json {
  content_json = file("./dashboard.json") # this already have ids and folderId
  
  # perhaps we can allow to override folder id here?
  # folder_id = ...
}

Affected Resource(s)

  • coralogix_dashboard

Terraform Configuration Files

terraform {
  required_version = "~> 1.7"
  required_providers {
    ...
    coralogix = {
      source  = "coralogix/coralogix"
      version = "1.11.12"
    }
  }
}
...

Debug Output

Panic Output

Expected Behavior

Dashboard is created in a folder

Actual Behavior

Inappropriate value for attribute "layout": attribute "sections": element 0: attribute "rows": element 0: attribute "height" is required.

Steps to Reproduce

i have created a native dashboard using the UI and exported the JSON file.

{
  "id": "1mDArBIW4knyUoHUYNCDo",
  "name": "test",
  "layout": {
    "sections": [
      {
        "id": {
          "value": "856d1938-7e1b-fd5a-36a3-83e8bef6de32"
        },
        "rows": [
          {
            "id": {
              "value": "fafd7374-801b-6dbb-57c6-8da617b3133a"
            },
            "appearance": {
              "height": 19
            },
            "widgets": [
              {
                "id": {
                  "value": "c8442aa5-e3a3-2cae-ed90-c7b7145afc93"
                },
                "title": "New line chart",
                "definition": {
                  "lineChart": {
                    "legend": {
                      "isVisible": true,
                      "columns": [],
                      "groupByQuery": true
                    },
                    "tooltip": {
                      "showLabels": false,
                      "type": "TOOLTIP_TYPE_ALL"
                    },
                    "queryDefinitions": [
                      {
                        "id": "f9cd41a1-2fff-590a-acc2-7e2b46324169",
                        "query": {
                          "logs": {
                            "groupBy": [],
                            "aggregations": [
                              {
                                "count": {}
                              }
                            ],
                            "filters": [],
                            "groupBys": []
                          }
                        },
                        "seriesCountLimit": "20",
                        "unit": "UNIT_UNSPECIFIED",
                        "scaleType": "SCALE_TYPE_LINEAR",
                        "name": "Query 1",
                        "isVisible": true,
                        "colorScheme": "cold",
                        "resolution": {
                          "bucketsPresented": 96
                        },
                        "dataModeType": "DATA_MODE_TYPE_HIGH_UNSPECIFIED"
                      }
                    ]
                  }
                },
                "appearance": {
                  "width": 0
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "variables": [],
  "filters": [
    {
      "source": {
        "logs": {
          "operator": {
            "equals": {
              "selection": {
                "list": {
                  "values": []
                }
              }
            }
          },
          "observationField": {
            "keypath": [
              "applicationname"
            ],
            "scope": "DATASET_SCOPE_LABEL"
          }
        }
      },
      "enabled": true,
      "collapsed": false
    },
    {
      "source": {
        "logs": {
          "operator": {
            "equals": {
              "selection": {
                "list": {
                  "values": []
                }
              }
            }
          },
          "observationField": {
            "keypath": [
              "subsystemname"
            ],
            "scope": "DATASET_SCOPE_LABEL"
          }
        }
      },
      "enabled": true,
      "collapsed": false
    }
  ],
  "relativeTimeFrame": "900s",
  "folderId": {
    "value": "52bc7c39-3f38-4871-9559-a8aecb674285"
  },
  "annotations": [],
  "off": {}
}

as part of my TF, i run a removal of certain fields.

// ❯ tf fmt && tf console
// > local.file_paths
// toset([
//   "plat/test_02-25-2024.json",
// ])
resource "null_resource" "clean_json" {
  for_each = { for i, v in local.file_paths : i => v }

  triggers = {
    file_paths = each.value
  }

  provisioner "local-exec" {
    command = <<-EOT
      cat ${local.cx_src_dir}/${each.value} | jq 'del(.. | .off?, .folderId?, .id?)' > ${local.cx_src_dir}/${each.value}.json-edited
      rm -rf ${local.cx_src_dir}/${each.value}
      mv ${local.cx_src_dir}/${each.value}.json-edited ${local.cx_src_dir}/${each.value}
    EOT
  }
}

and below is the sample result of this null_resource.clean_json

{
  "name": "test",
  "layout": {
    "sections": [
      {
        "rows": [
          {
            "appearance": {
              "height": 19
            },
            "widgets": [
              {
                "title": "New line chart",
                "definition": {
                  "lineChart": {
                    "legend": {
                      "isVisible": true,
                      "columns": [],
                      "groupByQuery": true
                    },
                    "tooltip": {
                      "showLabels": false,
                      "type": "TOOLTIP_TYPE_ALL"
                    },
                    "queryDefinitions": [
                      {
                        "query": {
                          "logs": {
                            "groupBy": [],
                            "aggregations": [
                              {
                                "count": {}
                              }
                            ],
                            "filters": [],
                            "groupBys": []
                          }
                        },
                        "seriesCountLimit": "20",
                        "unit": "UNIT_UNSPECIFIED",
                        "scaleType": "SCALE_TYPE_LINEAR",
                        "name": "Query 1",
                        "isVisible": true,
                        "colorScheme": "cold",
                        "resolution": {
                          "bucketsPresented": 96
                        },
                        "dataModeType": "DATA_MODE_TYPE_HIGH_UNSPECIFIED"
                      }
                    ]
                  }
                },
                "appearance": {
                  "width": 0
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "variables": [],
  "filters": [
    {
      "source": {
        "logs": {
          "operator": {
            "equals": {
              "selection": {
                "list": {
                  "values": []
                }
              }
            }
          },
          "observationField": {
            "keypath": [
              "applicationname"
            ],
            "scope": "DATASET_SCOPE_LABEL"
          }
        }
      },
      "enabled": true,
      "collapsed": false
    },
    {
      "source": {
        "logs": {
          "operator": {
            "equals": {
              "selection": {
                "list": {
                  "values": []
                }
              }
            }
          },
          "observationField": {
            "keypath": [
              "subsystemname"
            ],
            "scope": "DATASET_SCOPE_LABEL"
          }
        }
      },
      "enabled": true,
      "collapsed": false
    }
  ],
  "relativeTimeFrame": "900s",
  "annotations": []
}

then in dashboard creation

// ❯ tf fmt && tf console
// > local.json_files
// {
//   "plat" = {
//     "content" = {
//       "annotations" = []
//       "filters" = [
//         {
//           "collapsed" = false
//           "enabled" = true
//           "source" = {
//             "logs" = {
//               "observationField" = {
//                 "keypath" = [
//                   "applicationname",
//                 ]
//                 "scope" = "DATASET_SCOPE_LABEL"
//               }
//               "operator" = {
//                 "equals" = {
//                   "selection" = {
//                     "list" = {
//                       "values" = []
//                     }
//                   }
//                 }
//               }
//             }
//           }
//         },
//         {
//           "collapsed" = false
//           "enabled" = true
//           "source" = {
//             "logs" = {
//               "observationField" = {
//                 "keypath" = [
//                   "subsystemname",
//                 ]
//                 "scope" = "DATASET_SCOPE_LABEL"
//               }
//               "operator" = {
//                 "equals" = {
//                   "selection" = {
//                     "list" = {
//                       "values" = []
//                     }
//                   }
//                 }
//               }
//             }
//           }
//         },
//       ]
//       "layout" = {
//         "sections" = [
//           {
//             "rows" = [
//               {
//                 "appearance" = {
//                   "height" = 19
//                 }
//                 "widgets" = [
//                   {
//                     "appearance" = {
//                       "width" = 0
//                     }
//                     "definition" = {
//                       "lineChart" = {
//                         "legend" = {
//                           "columns" = []
//                           "groupByQuery" = true
//                           "isVisible" = true
//                         }
//                         "queryDefinitions" = [
//                           {
//                             "colorScheme" = "cold"
//                             "dataModeType" = "DATA_MODE_TYPE_HIGH_UNSPECIFIED"
//                             "isVisible" = true
//                             "name" = "Query 1"
//                             "query" = {
//                               "logs" = {
//                                 "aggregations" = [
//                                   {
//                                     "count" = {}
//                                   },
//                                 ]
//                                 "filters" = []
//                                 "groupBy" = []
//                                 "groupBys" = []
//                               }
//                             }
//                             "resolution" = {
//                               "bucketsPresented" = 96
//                             }
//                             "scaleType" = "SCALE_TYPE_LINEAR"
//                             "seriesCountLimit" = "20"
//                             "unit" = "UNIT_UNSPECIFIED"
//                           },
//                         ]
//                         "tooltip" = {
//                           "showLabels" = false
//                           "type" = "TOOLTIP_TYPE_ALL"
//                         }
//                       }
//                     }
//                     "title" = "New line chart"
//                   },
//                 ]
//               },
//             ]
//           },
//         ]
//       }
//       "name" = "test"
//       "relativeTimeFrame" = "900s"
//       "variables" = []
//     }
//     "name" = "test"
//   }
// }
resource "coralogix_dashboard" "dashboard" {
  for_each = { for k, v in local.json_files : k => v }
  name     = each.value.name
  folder = {
    id = coralogix_dashboards_folder.parents[each.key].id
  }

  layout = {
    sections = each.value.content.layout.sections
  }
}
# returns 'Inappropriate value for attribute "layout": attribute "sections": 
# element 0: attribute "rows": element 0: attribute "height" is required.'

Important Factoids

References

coralogix_tco_policy_logs value conversion error

Affected Resource(s)

  • coralogix_tco_policy_logs

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_providers {
    coralogix = {
      source  = "coralogix/coralogix"
      version = "~> 1.8.17"
    }
  }
  required_version = "1.5.4"
}

provider "coralogix" {
  api_key = xxxxxxxxx
  env     = "EUROPE2"
}

locals {
  test = [{
    rule_type : "includes"
    names : ["-dev"]
  }]
}

resource "coralogix_tco_policy_logs" "tco_policy" {
  count = 1

  name        = "test"
  priority     = "medium"
  order        = count.index + 1
  severities   = ["debug", "verbose", "info", "error", "warning", "critical"]
  applications = local.test[count.index] # gives error
#  applications = local.test[0]                 # works
}

Expected Behavior

I would expect the resource to apply properly, without throwing any error.

Actual Behavior

A plan or apply fails before refreshing state, with the following message:

β”‚ Error: Value Conversion Error
β”‚
β”‚ with coralogix_tco_policy_logs.tco_policy,
β”‚ on coralogix_tco.tf line 118, in resource "coralogix_tco_policy_logs" "tco_policy":
β”‚ 118: applications = local.test[count.index]
β”‚
β”‚ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
β”‚
β”‚ Received unknown value, however the target type cannot handle unknown values. Use the corresponding types package type or a custom type that handles unknown values.
β”‚
β”‚ Path: applications
β”‚ Target Type: *coralogix.TCORuleModel
β”‚ Suggested Type: basetypes.ObjectValue

If the "count.index" is instead hardcoded to 0, it works. The issue prevents me from creating multiple tco policy rules with configuration from a yaml file.

Steps to Reproduce

  1. terraform plan

Community Note

  • Please vote on this issue by adding a πŸ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

applications filter in alerts is not applied / stored

When adding applications in the filter, it's not stored upon applying.
Each terraform apply wants to change the same resource

 # coralogix_alert.appsflyer_pba_errors will be updated in-place
  ~ resource "coralogix_alert" "appsflyer_pba_errors" {
        id          = "c3fe8dc1-996c-11ec-b7aa-cfdadc0f5234"
        name        = "Appsflyer pba errors - dev"
        # (4 unchanged attributes hidden)


      + filter {
          + applications = [
              + "my-app",
            ]
          + severities   = []
          + subsystems   = []
          + text         = "COPY_FROM_APPSFLAYER_BUCKET_ERROR"
        }
      - filter {
          - applications = [] -> null
          - severities   = [] -> null
          - subsystems   = [] -> null
          - text         = "COPY_FROM_APPSFLAYER_BUCKET_ERROR" -> null
        }

        # (2 unchanged blocks hidden)
    }

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Missing package.json file.

A package.json file at the root of your project is required to release on npm.

Please follow the npm guideline to create a valid package.json file.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Respect semver

Description

Between 1.2.x and 1.3.x the configuration for alerts changed completely. The provider configuration also changed in a backwards incompatible manner.

In order to upgrade we had to remove all alerts and re-create them. Just adjusting the configuration was not enough and we got errors such as:

internal error for alert in Coralogix backend - rpc error: code = Internal desc = Attempt to decode value on failed cursor: DownField(alert)

I do not expect such massive, backwards incompatible changes when upgrading minor versions. For future releases, please create a new major release when there are backwards incompatible changes.

New or Affected Resource(s)

  • coralogix_alert

Community Note

  • Please vote on this issue by adding a
    πŸ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Alerts - scheduling not disabled if first was enabled via terraform code

We have the following alarm:

resource "coralogix_alert" "error_checker" {
  name        ="example error checker"
  description = "example desc"
  severity    = "Error"
  enabled     = true

  notifications_group {
    notification {
      notify_on                   = "Triggered_and_resolved"
      email_recipients            = local.is_alert_alert_emails
      retriggering_period_minutes = 1
    }
  }

  show_in_insights {
    retriggering_period_minutes = 1
    notify_on                   = "Triggered_and_resolved"
  }

  scheduling {
    time_zone = "UTC+2"
    time_frame {
      days_enabled = ["Monday", "Tuesday", "Wednesday", "Thursday",  "Friday"]
      start_time   = "07:00"
      end_time     = "23:00"
    }
  }

  standard {
    subsystems   = [format("filter:startsWith:%s", var.common_prefix)]
    search_query = "_exists_:\"logRecord.body.alert_type\" AND logRecord.body.alert_type:\"error\"  AND logRecord.body.title:\"event\""
    condition {
      immediately   = true
    }
  }
}

now we need this alarm to be enabled h24 so we modified the alarm as follow:

resource "coralogix_alert" "error_checker" {
  name        ="example error checker"
  description = "example desc"
  severity    = "Error"
  enabled     = true

  notifications_group {
    notification {
      notify_on                   = "Triggered_and_resolved"
      email_recipients            = local.is_alert_alert_emails
      retriggering_period_minutes = 1
    }
  }

  show_in_insights {
    retriggering_period_minutes = 1
    notify_on                   = "Triggered_and_resolved"
  }

  # scheduling {
  #  time_zone = "UTC+2"
  #  time_frame {
  #     days_enabled = ["Monday", "Tuesday", "Wednesday", "Thursday",  "Friday"]
  #     start_time   = "07:00"
  #     end_time     = "23:00"
  #   }
  # }

  standard {
    subsystems   = [format("filter:startsWith:%s", var.common_prefix)]
    search_query = "_exists_:\"logRecord.body.alert_type\" AND logRecord.body.alert_type:\"error\"  AND logRecord.body.title:\"event\""
    condition {
      immediately   = true
    }
  }
}

the terraform output confirm that the scheduling was removed:
image

But if I check the UI i see the scheduling enabled:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.