Skip to content

Commit eb84668

Browse files
authored
⭐️ add Github integration (#97)
1 parent ae11ef3 commit eb84668

7 files changed

Lines changed: 395 additions & 3 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "mondoo_integration_github Resource - terraform-provider-mondoo"
4+
subcategory: ""
5+
description: |-
6+
Continuously scan GitHub organizations and repositories for misconfigurations.
7+
---
8+
9+
# mondoo_integration_github (Resource)
10+
11+
Continuously scan GitHub organizations and repositories for misconfigurations.
12+
13+
## Example Usage
14+
15+
```terraform
16+
variable "mondoo_org" {
17+
description = "The Mondoo Organization ID"
18+
type = string
19+
}
20+
21+
variable "github_token" {
22+
description = "The GitHub Token"
23+
type = string
24+
}
25+
26+
provider "mondoo" {
27+
region = "us"
28+
}
29+
30+
# Create a new space
31+
resource "mondoo_space" "gh_space" {
32+
name = "My GitHub Space Name"
33+
org_id = var.mondoo_org
34+
}
35+
36+
# Setup the GitHub integration
37+
resource "mondoo_integration_github" "gh_integration" {
38+
space_id = mondoo_space.gh_space.id
39+
name = "GitHub Integration"
40+
41+
owner = "lunalectric"
42+
43+
# define a repository if you want to restrict scan to a single repository
44+
# repository = "repo1"
45+
46+
# alternatively, you can define a list of repositories to allow or deny scanning
47+
# repository_allow_list= ["repo1", "repo2"]
48+
# repository_deny_list = ["repo1", "repo2"]
49+
50+
credentials = {
51+
token = var.github_token
52+
}
53+
}
54+
```
55+
56+
<!-- schema generated by tfplugindocs -->
57+
## Schema
58+
59+
### Required
60+
61+
- `credentials` (Attributes) (see [below for nested schema](#nestedatt--credentials))
62+
- `name` (String) Name of the integration.
63+
- `owner` (String) GitHub Owner.
64+
- `space_id` (String) Mondoo Space Identifier.
65+
66+
### Optional
67+
68+
- `repository` (String) GitHub Repository.
69+
- `repository_allow_list` (List of String) List of GitHub repositories to scan.
70+
- `repository_deny_list` (List of String) List of GitHub repositories to exclude from scanning.
71+
72+
### Read-Only
73+
74+
- `mrn` (String) Integration identifier
75+
76+
<a id="nestedatt--credentials"></a>
77+
### Nested Schema for `credentials`
78+
79+
Required:
80+
81+
- `token` (String, Sensitive) Token for GitHub integration.
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+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
variable "mondoo_org" {
2+
description = "The Mondoo Organization ID"
3+
type = string
4+
}
5+
6+
variable "github_token" {
7+
description = "The GitHub Token"
8+
type = string
9+
}
10+
11+
provider "mondoo" {
12+
region = "us"
13+
}
14+
15+
# Create a new space
16+
resource "mondoo_space" "gh_space" {
17+
name = "My GitHub Space Name"
18+
org_id = var.mondoo_org
19+
}
20+
21+
# Setup the GitHub integration
22+
resource "mondoo_integration_github" "gh_integration" {
23+
space_id = mondoo_space.gh_space.id
24+
name = "GitHub Integration"
25+
26+
owner = "lunalectric"
27+
28+
# define a repository if you want to restrict scan to a single repository
29+
# repository = "repo1"
30+
31+
# alternatively, you can define a list of repositories to allow or deny scanning
32+
# repository_allow_list= ["repo1", "repo2"]
33+
# repository_deny_list = ["repo1", "repo2"]
34+
35+
credentials = {
36+
token = var.github_token
37+
}
38+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-log v0.9.0
1212
github.com/hashicorp/terraform-plugin-testing v1.7.0
1313
github.com/stretchr/testify v1.9.0
14-
go.mondoo.com/mondoo-go v0.0.0-20240506203204-3376c6ce3451
14+
go.mondoo.com/mondoo-go v0.0.0-20240507081602-aa7a34bcb66d
1515
)
1616

1717
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,8 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px
493493
go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
494494
go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
495495
go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=
496-
go.mondoo.com/mondoo-go v0.0.0-20240506203204-3376c6ce3451 h1:uqvo/cgqwYj+NNizV5/7WtSBaZf/wWV5sXde928RL80=
497-
go.mondoo.com/mondoo-go v0.0.0-20240506203204-3376c6ce3451/go.mod h1:5HuspbubnZpXwjDu26q296sbnGYMprCztVShCIUchyw=
496+
go.mondoo.com/mondoo-go v0.0.0-20240507081602-aa7a34bcb66d h1:f/vvw9UYM/iZ3XODFcndiHiu5ikV35vLw1m+lOYxYtY=
497+
go.mondoo.com/mondoo-go v0.0.0-20240507081602-aa7a34bcb66d/go.mod h1:XY+tOP6vBFJKw5F3WLYEHNQxc+6YmfQ+hEbw3yRy3HI=
498498
go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUSLc=
499499
go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
500500
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=

0 commit comments

Comments
 (0)