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

ENG-44000: Resource provider for label application rule #16

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

meghana-pedduri
Copy link
Contributor

@meghana-pedduri meghana-pedduri commented May 19, 2024

Example usage:

resource "traceable_label_application_rule" "meg-test1" {
  name        = "test-label-appl-rule"
  description = "optional desc"
  enabled     = true

  condition_list {
    key      = "test1"
    operator = "OPERATOR_EQUALS"
    value    = "sdfghj"
  }

  condition_list {
    key      = "test2"
    operator = "OPERATOR_MATCHES_REGEX"
    value    = "sdfg"
  }

  condition_list {
    key      = "test3"
    operator = "OPERATOR_EQUALS"
  }

  condition_list {
    key      = "test4"
    operator = "OPERATOR_MATCHES_IPS"
    values   = ["1.0.0.0", "9.0.8.0"]
  }

  condition_list {
    key      = "test5"
    operator = "OPERATOR_NOT_MATCHES_IPS"
    values   = ["6.9.3.5", "5.5.6.5"]
  }

  action {
    type             = "DYNAMIC_LABEL_KEY"
    entity_types     = ["API", "SERVICE", "BACKEND"]
    operation        = "OPERATION_MERGE"
    dynamic_label_key = "hellotest"
  }

  
}

Schema:

Required:
name: (string) name of the label rule
enabled: (boolean) Flag to enable or disable the rule
condition list: (list of strings) (min 1 condition req.) List of conditions for the rule
- key: (string) The key for the condition
- operator: (string) The operator for the condition
- value: (string)(optional) The value for the condition (if applicable)
- values: (list of strings)(optional) The values for the condition (if applicable)
action: (list of strings) Action to apply for the rule
- type: (string) The type of action (DYNAMIC_LABEL_KEY or STATIC_LABELS)
- entity_types: (string) List of entity types
- operation: (string)(optional) The operation to perform
- dynamic_label_key: (string)(optional) The dynamic label key (if applicable)
- static_labels: (list of strings)(optional) List of static labels (if applicable)

Optional:
description: (string) description of the label rule

provider/label_application.go Show resolved Hide resolved
provider/label_application.go Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants