Skip to content

Commit

Permalink
add example for opslevel_check_code_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss committed Oct 24, 2024
1 parent 5eed1ac commit 7c2f494
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/resources/opslevel_check_code_issue/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import opslevel_check_code_issue.example Z2lkOi8vb3BzbGV2ZWwvU2VydmljZS82MDI0
59 changes: 59 additions & 0 deletions examples/resources/opslevel_check_code_issue/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
data "opslevel_rubric_category" "security" {
filter {
field = "name"
value = "Security"
}
}

data "opslevel_rubric_level" "bronze" {
filter {
field = "name"
value = "Bronze"
}
}

data "opslevel_team" "devs" {
alias = "developers"
}

data "opslevel_filter" "tier1" {
filter {
field = "name"
value = "Tier 1"
}
}

resource "opslevel_check_code_issue" "example" {
name = "foo"
pass_pending = true
enabled = true
# To set a future enable date remove field 'enabled' and use 'enable_on'
# enable_on = "2022-05-23T14:14:18.782000Z"
category = data.opslevel_rubric_category.security.id
level = data.opslevel_rubric_level.bronze.id
owner = data.opslevel_team.devs.id
filter = data.opslevel_filter.tier1.id
notes = "Optional additional info on why this check is run or how to fix it"

constraint = "any"
issue_name = "CVE-2024-0001"
issue_type = [
"snyk:code",
"snyk:cloud",
"snyk:config",
"snyk:custom",
"snyk:license",
"snyk:package_vulnerability",
]
max_allowed = 5
resolution_time = {
unit = "day"
value = 3
}
severity = [
"snyk:critical",
"snyk:low",
"snyk:medium",
"snyk:high",
]
}
4 changes: 2 additions & 2 deletions tests/check_code_issue.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ variables {
constraint = "any"

# optional fields
issue_name = "idk"
issue_type = ["snyk:code"]
issue_name = "CVE-2024-0001"
issue_type = ["snyk:code", "snyk:cloud", "snyk:config", "snyk:custom", "snyk:license", "snyk:package_vulnerability"]
max_allowed = 5
resolution_time = {
unit = "week"
Expand Down

0 comments on commit 7c2f494

Please sign in to comment.