Skip to content

Rule can't be created using question_id #137

Description

@asaba-hashi

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v1.3.7
on darwin_arm64
+ provider registry.terraform.io/jupiterone/jupiterone v0.5.0

Affected Resource(s)

Please list the resources as a list, for example:

  • jupiterone_rule

Terraform Configuration Files

resource "jupiterone_question" "test_1" {
  title       = "TEST: Testing j1 terraform provider"
  description = "Test query for terraform provider can be deleted at any a time"

  tags = ["test-tag-1", "test-compliance-tag"]

  query {
    name    = "query0"
    version = "v1"
    query   = "find aws_account as a return count(a)"
  }

}

resource "jupiterone_rule" "test_1" {
  name        = "TEST: Testing j1 terraform provider rule"
  description = "Test rule for terraform provider can be deleted at any a time"

  tags = ["test-tag-1", "test-compliance-tag"]

  question_id = jupiterone_question.test_1.id

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

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Expected Behavior

What should have happened?

The resource_rule should have been created.

Actual Behavior

What actually happened?

jupiterone_rule.test_1: Creating...
╷
│ Error: failed to create question rule instance: graphql: Error creating rule instance
│ 
│   with jupiterone_rule.test_1,
│   on main.tf line 16, in resource "jupiterone_rule" "test_1":
│   16: resource "jupiterone_rule" "test_1" {
│ 

question_id does not appear to be a documented part of the alert schema.

Steps to Reproduce

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions