Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider is not consistent in choosing the api key #262

Open
aelmekeev opened this issue Aug 22, 2024 · 0 comments
Open

Provider is not consistent in choosing the api key #262

aelmekeev opened this issue Aug 22, 2024 · 0 comments

Comments

@aelmekeev
Copy link

aelmekeev commented Aug 22, 2024

Affected Resource(s)

  • coralogix_alert (at least)

Terraform Configuration Files

Here is an example of the terraform file:

provider "coralogix" {
  api_key = <api key>
  env     = "USA1"
}

resource "coralogix_webhook" "this" {
  name  = "#test"
  slack = {
    notify_on = null
    url       = "https://example.com"
  }
}


resource "coralogix_alert" "this" {
  name        = "Coralogix Alert"
  description = "Coralogix Alert."
  
  severity    = "Critical"

  notifications_group {
    notification {
      notify_on                   = "Triggered_and_resolved"
      integration_id              = coralogix_webhook.this.external_id
      retriggering_period_minutes = 60
    }
  }

  metric {
    promql {
      search_query = "k8s_daemonset_desired_scheduled_nodes__node_"
      condition {
        more_than                      = true
        threshold                      = 0
        sample_threshold_percentage    = 40
        time_window                    = "5Min"
        min_non_null_values_percentage = 10
      }
    }
  }
}

Expected Behavior

Both webhook and alert to be created.

Actual Behavior

Webhook gets created but not the alert.

~/temp/tf on 🅰 admin-org (eu-west-2) ☸ arn:aws:eks:us-east-1:804670868283:cluster/eks-blue took 3s at 16:28:52CORALOGIX_API_KEY=test t apply
data.honeycombio_auth_metadata.current: Reading...
data.honeycombio_auth_metadata.current: Read complete after 0s
data.honeycombio_environments.current: Reading...
data.honeycombio_environments.current: Read complete after 0s [id=1552630114]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # coralogix_alert.this will be created
  + resource "coralogix_alert" "this" {
      + description = "Coralogix Alert."
      + enabled     = true
      + id          = (known after apply)
      + name        = "Coralogix Alert"
      + severity    = "Critical"

      + metric {
          + promql {
              + search_query = "k8s_daemonset_desired_scheduled_nodes__node_"

              + condition {
                  + min_non_null_values_percentage = 10
                  + more_than                      = true
                  + sample_threshold_percentage    = 40
                  + threshold                      = 0
                  + time_window                    = "5Min"
                }
            }
        }

      + notifications_group {
          + group_by_fields = []

          + notification {
              + email_recipients            = []
              + integration_id              = (known after apply)
              + notify_on                   = "Triggered_and_resolved"
              + retriggering_period_minutes = 60
            }
        }
    }

  # coralogix_webhook.this will be created
  + resource "coralogix_webhook" "this" {
      + external_id = (known after apply)
      + id          = (known after apply)
      + name        = "#test"
      + slack       = {
          + url = "https://example.com"
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

coralogix_webhook.this: Creating...
coralogix_webhook.this: Creation complete after 1s [id=1bc549bd-7908-4888-9079-6d84db594fcf]
coralogix_alert.this: Creating...
╷
│ Error: rpc error: code = Unauthenticated desc = c5e597274094beff3ed21416556add2a344b6f11
│ 
│   with coralogix_alert.this,
│   on coralogix.tf line 30, in resource "coralogix_alert" "this":
│   30: resource "coralogix_alert" "this" {
│ 
╵

Steps to Reproduce

Caught an issue while running terraform with the provider explicitly configured with the api key from secret manager for one team while the pipeline already had set CORALOGIX_API_KEY to api key from another team.

  1. CORALOGIX_API_KEY=test terraform apply

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant