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

Update resource_rule tests when switcing from question_id to query is fixed #190

Open
asaba-hashi opened this issue Aug 14, 2023 · 0 comments

Comments

@asaba-hashi
Copy link
Contributor

As noted in #174 (comment), there is an open bug in API when switching a rule from a referenced question to an inline one. The tests should be updated after it is fixed to prevent regressions.

Terraform Version

n/a

Affected Resource(s)

Please list the resources as a list, for example:

  • rule

Terraform Configuration Files

resource "jupiterone_question" "test" {
  title = "test-asaba"
  description = "test-referenced-rule"
  
  query {
      name    = "query0"
      query   = "Find DataStore with classification=('critical' or 'sensitive' or 'confidential' or 'restricted') and encrypted!=true"
      version = "v1"
  }

}

resource "jupiterone_rule" "test" {
  name             = "test-asaba"
  description      = "test"
  polling_interval = "ONE_DAY"

  #question_id = jupiterone_question.test.id
  question {
    queries {
      name    = "query0"
      query   = "Find DataStore with classification=('critical' or 'sensitive' or 'confidential' or 'restricted') and encrypted!=true"
      version = "v1"
    }
  }

  tags = ["exampletag"]

  outputs = [
    "queries.query0.total",
    "alertLevel"
  ]

  operations = [
    {
      when = jsonencode({
        "type" : "FILTER",
        "specVersion" : 1,
        "condition" : [
          "AND",
          [
            "queries.query0.total",
            "<",
            1000
          ]
        ]
      }),
      actions = [
        jsonencode({
          "targetValue" : "INFO",
          "type" : "SET_PROPERTY",
          "targetProperty" : "alertLevel"
        }),
        jsonencode({
          "type" : "CREATE_ALERT"
        }),
      ]
    }
  ]
}

Expected Behavior

The rule is updated without error.

Actual Behavior

What actually happened?

"input: Error updating rule instance"

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply as above.
  2. Uncomment question_id and remove or comment the query block.
  3. Attempt a terraform apply.

Important Factoids

This issue is mostly to keep track that the tests will need to be updated when the API bug is fixed.

References

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