Skip to content

Commit dc0deba

Browse files
⭐️ added data source for compliance frameworks (#119)
* feat: added data source for compliance frameworks Signed-off-by: Matthias Theuermann <mtheuermann@infralovers.com> * Update internal/provider/gql.go Co-authored-by: Christoph Hartmann <chris@lollyrock.com> * fix: merge conflict Signed-off-by: Matthias Theuermann <mtheuermann@infralovers.com> * fix: removed duplicated file Signed-off-by: Matthias Theuermann <mtheuermann@infralovers.com> * fix: limit for policies Signed-off-by: Matthias Theuermann <mtheuermann@infralovers.com> --------- Signed-off-by: Matthias Theuermann <mtheuermann@infralovers.com> Co-authored-by: Christoph Hartmann <chris@lollyrock.com>
1 parent baebea9 commit dc0deba

16 files changed

Lines changed: 461 additions & 63 deletions

File tree

docs/data-sources/frameworks.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mondoo_frameworks Data Source - terraform-provider-mondoo"
4+
subcategory: ""
5+
description: |-
6+
Data source to return compliance frameworks in a Space
7+
---
8+
9+
# mondoo_frameworks (Data Source)
10+
11+
Data source to return compliance frameworks in a Space
12+
13+
## Example Usage
14+
15+
```terraform
16+
data "mondoo_frameworks" "frameworks_data" {
17+
space_id = "your-space-1234567"
18+
}
19+
20+
output "framework_mrn" {
21+
value = [for framework in data.mondoo_frameworks.frameworks_data.frameworks : framework.mrn]
22+
description = "The MRN of the frameworks in the space."
23+
}
24+
```
25+
26+
<!-- schema generated by tfplugindocs -->
27+
## Schema
28+
29+
### Optional
30+
31+
- `space_id` (String) Space ID
32+
- `space_mrn` (String) Space MRN
33+
34+
### Read-Only
35+
36+
- `frameworks` (Attributes List) List of compliance frameworks (see [below for nested schema](#nestedatt--frameworks))
37+
38+
<a id="nestedatt--frameworks"></a>
39+
### Nested Schema for `frameworks`
40+
41+
Read-Only:
42+
43+
- `authors` (Attributes List) List of authors (see [below for nested schema](#nestedatt--frameworks--authors))
44+
- `mrn` (String) Compliance framework MRN
45+
- `name` (String) Compliance framework name
46+
- `previous_completion_scores` (Attributes List) List of previous completion scores (see [below for nested schema](#nestedatt--frameworks--previous_completion_scores))
47+
- `state` (String) Compliance framework state is either `PREVIEW` or `ACTIVE`
48+
- `tags` (Attributes List) List of tags (see [below for nested schema](#nestedatt--frameworks--tags))
49+
50+
<a id="nestedatt--frameworks--authors"></a>
51+
### Nested Schema for `frameworks.authors`
52+
53+
Read-Only:
54+
55+
- `email` (String) Author email
56+
- `name` (String) Author name
57+
58+
59+
<a id="nestedatt--frameworks--previous_completion_scores"></a>
60+
### Nested Schema for `frameworks.previous_completion_scores`
61+
62+
Read-Only:
63+
64+
- `score` (Number) Score
65+
- `timestamp` (String) Timestamp
66+
67+
68+
<a id="nestedatt--frameworks--tags"></a>
69+
### Nested Schema for `frameworks.tags`
70+
71+
Read-Only:
72+
73+
- `key` (String) Tag key
74+
- `value` (String) Tag value
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
3-
page_title: "mondoo_policy Data Source - terraform-provider-mondoo"
3+
page_title: "mondoo_policies Data Source - terraform-provider-mondoo"
44
subcategory: ""
55
description: |-
66
Data source for policies and querypacks
77
---
88

9-
# mondoo_policy (Data Source)
9+
# mondoo_policies (Data Source)
1010

1111
Data source for policies and querypacks
1212

1313
## Example Usage
1414

1515
```terraform
16-
data "mondoo_policy" "policy" {
16+
data "mondoo_policies" "policies_data" {
1717
space_id = "your-space-1234567"
1818
catalog_type = "ALL" # available options: "ALL", "POLICY", "QUERYPACK"
1919
assigned_only = true
2020
}
2121
2222
output "policies_mrn" {
23-
value = [for policy in data.mondoo_policy.policy.policies : policy.policy_mrn]
23+
value = [for policy in data.mondoo_policies.policies_data.policies : policy.policy_mrn]
2424
description = "The MRN of the policies in the space according to the filter criteria."
2525
}
2626
```

docs/resources/custom_framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ resource "mondoo_space" "my_space" {
3535
org_id = var.mondoo_org
3636
}
3737
38-
resource "mondoo_custom_framework" "compliance_framework_example" {
38+
resource "mondoo_custom_framework" "custom_framework" {
3939
space_id = mondoo_space.my_space.id
4040
data_url = var.my_custom_framework
4141
}

docs/resources/framework_assignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ resource "mondoo_space" "my_space" {
2929
org_id = var.mondoo_org
3030
}
3131
32-
resource "mondoo_framework_assignment" "compliance_framework_example" {
32+
resource "mondoo_framework_assignment" "framework_assignment" {
3333
space_id = mondoo_space.my_space.id
3434
framework_mrn = ["//policy.api.mondoo.app/frameworks/cis-controls-8",
3535
"//policy.api.mondoo.app/frameworks/iso-27001-2022"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
data "mondoo_frameworks" "frameworks_data" {
2+
space_id = "your-space-1234567"
3+
}
4+
5+
output "framework_mrn" {
6+
value = [for framework in data.mondoo_frameworks.frameworks_data.frameworks : framework.mrn]
7+
description = "The MRN of the frameworks in the space."
8+
}
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
data "mondoo_policy" "policy" {
1+
data "mondoo_policies" "policies_data" {
22
space_id = "your-space-1234567"
33
catalog_type = "ALL" # available options: "ALL", "POLICY", "QUERYPACK"
44
assigned_only = true
55
}
66

77
output "policies_mrn" {
8-
value = [for policy in data.mondoo_policy.policy.policies : policy.policy_mrn]
8+
value = [for policy in data.mondoo_policies.policies_data.policies : policy.policy_mrn]
99
description = "The MRN of the policies in the space according to the filter criteria."
1010
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
terraform {
2+
required_providers {
3+
mondoo = {
4+
source = "mondoohq/mondoo"
5+
version = ">= 0.4.0"
6+
}
7+
}
8+
}

examples/resources/mondoo_custom_framework/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ resource "mondoo_space" "my_space" {
2020
org_id = var.mondoo_org
2121
}
2222

23-
resource "mondoo_custom_framework" "compliance_framework_example" {
23+
resource "mondoo_custom_framework" "custom_framework" {
2424
space_id = mondoo_space.my_space.id
2525
data_url = var.my_custom_framework
2626
}

examples/resources/mondoo_framework_assignment/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ resource "mondoo_space" "my_space" {
1414
org_id = var.mondoo_org
1515
}
1616

17-
resource "mondoo_framework_assignment" "compliance_framework_example" {
17+
resource "mondoo_framework_assignment" "framework_assignment" {
1818
space_id = mondoo_space.my_space.id
1919
framework_mrn = ["//policy.api.mondoo.app/frameworks/cis-controls-8",
2020
"//policy.api.mondoo.app/frameworks/iso-27001-2022"]

0 commit comments

Comments
 (0)