Configuring Credit Manager Settings Via Terraform

You can manage Credit Manager settings via Terraform. Credit Manager settings are a type of layered setting. This documentation page provides specific examples.

Customer Level Settings

These settings apply to all users. However, in the case of the QueryGovernor.user* settings that target the customer ID (ex: data.observe_oid.customer.oid), these can be overridden by settings that target specific users (ex: data.observe_user.kyle_champlin.oid).

# set up an OID lookup so we get back a properly formatted string
data "observe_oid" "customer" {
  id   = "<yourcustomerID>"
  type = "customer"
}

# Query Governor - Customer Level Throttled Global
resource "observe_layered_setting_record" "base_tenant_credit_limit_throttled" {
    workspace     = data.observe_workspace.default.oid
    name          = "New Global Credit Limit THROTTLED"
    setting       = "QueryGovernor.throttledLimitCreditsPerDay"
    value_float64 = 100.0
    target        = data.observe_oid.customer.oid
}

# Applying hard and soft limits for all users
# Query Governor - User Level - All Users - Throttled
resource "observe_layered_setting_record" "all_users_credit_limit_soft" {
    workspace     = data.observe_workspace.default.oid
    name          = "All Users Query Limit THROTTLED"
    setting       = "QueryGovernor.userThrottledLimitCreditsPerDay"
    value_float64 = 1.0
    target        = data.observe_oid.customer.oid
}

# Query Governor - User Level - All Users - Hard
resource "observe_layered_setting_record" "all_users_credit_limit_hard" {
    workspace     = data.observe_workspace.default.oid
    name          = "All Users Query Limit HARD"
    setting       = "QueryGovernor.userCreditsPerDay"
    value_float64 = 5.0
    target        = data.observe_oid.customer.oid
}

User specific settings

This example covers setting hard and soft limits targeting specific users. These override the global users settings above, for whatever users they are set for, except for the QueryGovernor.throttledLimitCreditsPerDay setting.

# User 1 Lookup
data "observe_user" "kyle_champlin" {
  email = "[email protected]"
}

# Query Governor - User Level - User 1 - Throttled
resource "observe_layered_setting_record" "base_admin_credit_limit" {
    workspace     = data.observe_workspace.default.oid
    name          = "User 1 Query Limit THROTTLED"
    setting       = "QueryGovernor.userThrottledLimitCreditsPerDay"
    value_float64 = 5.0
    target        = data.observe_user.kyle_champlin.oid
}

# Query Governor - User Level - User 1 - Hard
resource "observe_layered_setting_record" "base_admin_credit_limit_hard" {
    workspace     = data.observe_workspace.default.oid
    name          = "User 1 Query Limit HARD"
    setting       = "QueryGovernor.userCreditsPerDay"
    value_float64 = 10.0
    target        = data.observe_user.kyle_champlin.oid
}


# User 2 Lookup
data "observe_user" "carl_credit" {
  email = "[email protected]"
}

# Query Governor - User Level - User 2 - Throttled
resource "observe_layered_setting_record" "base_reader_credit_limit" {
    workspace     = data.observe_workspace.default.oid
    name          = "New User READER Credit Limit HARD"
    setting       = "QueryGovernor.userCreditsPerDay"
    value_float64 = 1.0
    target        = data.observe_user.carl_credit.oid
}