-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: added exception management #165
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5d5cf2b
feat: added exception management
mati007thm 2df7845
fix: type assertion
mati007thm 598c5aa
removed incorrect function
mati007thm 1f86698
fix: ease up dev workflow
mabunixda 222aff8
fix: list exception group
mati007thm 1771840
fix: updating exceptions
mati007thm 237bfca
fix: naming convention
mati007thm 7c3ecc4
fix: code errors
mati007thm fda1ba3
Update expect.txt
mati007thm d6d58ce
fix: added validation
mati007thm fb32908
fix: updated docs
mati007thm e55f2f8
fix; spelling mistake
mati007thm 584558a
fix: update docs
mati007thm 15b9f0e
Merge branch 'main' into mondoo_exception
mati007thm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ qpbi | |
querypack | ||
Qwc | ||
scim | ||
startswith | ||
Tcy | ||
testacc | ||
TEzu | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "mondoo_exception Resource - terraform-provider-mondoo" | ||
subcategory: "" | ||
description: |- | ||
Set custom exceptions for a Scope. | ||
--- | ||
|
||
# mondoo_exception (Resource) | ||
|
||
Set custom exceptions for a Scope. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
variable "space_id" { | ||
type = string | ||
description = "The ID of the mondoo space." | ||
} | ||
|
||
provider "mondoo" { | ||
region = "eu" | ||
space = var.space_id | ||
} | ||
|
||
data "mondoo_assets" "assets_data" { | ||
space_id = var.space_id | ||
} | ||
|
||
locals { | ||
ssl_asset = [for asset in data.mondoo_assets.assets_data.assets : asset if startswith(asset.name, "https")] | ||
asset_id = one(local.ssl_asset).id | ||
} | ||
|
||
|
||
resource "mondoo_exception" "exception" { | ||
scope_mrn = "//assets.api.mondoo.app/spaces/${var.space_id}/assets/${local.asset_id}" | ||
valid_until = "2024-12-11" | ||
justification = "testing" | ||
action = "SNOOZE" | ||
check_mrns = ["//policy.api.mondoo.app/queries/mondoo-tls-security-mitigate-beast"] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `action` (String) The action to perform. Default is `SNOOZE`. Other options are `ENABLE`, `DISABLE`, `OUT_OF_SCOPE`. | ||
- `check_mrns` (List of String) List of check MRNs to set exceptions for. If set, `vulnerability_mrns` must not be set. | ||
- `justification` (String) Description why the exception is required. | ||
- `scope_mrn` (String) The MRN of the scope (either asset mrn or space mrn). | ||
- `valid_until` (String) The timestamp until the exception is valid. | ||
- `vulnerability_mrns` (List of String) List of vulnerability MRNs to set exceptions for. If set, `check_mrns` must not be set. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
terraform { | ||
required_providers { | ||
mondoo = { | ||
source = "mondoohq/mondoo" | ||
version = ">= 0.19" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
variable "space_id" { | ||
type = string | ||
description = "The ID of the mondoo space." | ||
} | ||
|
||
provider "mondoo" { | ||
region = "eu" | ||
space = var.space_id | ||
} | ||
|
||
data "mondoo_assets" "assets_data" { | ||
space_id = var.space_id | ||
} | ||
|
||
locals { | ||
ssl_asset = [for asset in data.mondoo_assets.assets_data.assets : asset if startswith(asset.name, "https")] | ||
asset_id = one(local.ssl_asset).id | ||
} | ||
|
||
|
||
resource "mondoo_exception" "exception" { | ||
scope_mrn = "//assets.api.mondoo.app/spaces/${var.space_id}/assets/${local.asset_id}" | ||
valid_until = "2024-12-11" | ||
justification = "testing" | ||
action = "SNOOZE" | ||
check_mrns = ["//policy.api.mondoo.app/queries/mondoo-tls-security-mitigate-beast"] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
action is optional since SNOOZE is default
check_mrns conflicts with vulnerability_mrns and can therefore not be Required
justification is optional since it is simply not needed
scope_mrn is optional since it either can be declared here or the provider scope can be used
valid_until is optional since it can only be used by action SNOOZE