Skip to content

Commit

Permalink
⭐️ new resource mondoo_integration_gitlab (#167)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Theuermann <[email protected]>
  • Loading branch information
mati007thm authored Dec 5, 2024
1 parent 708004c commit 8272dc9
Show file tree
Hide file tree
Showing 6 changed files with 459 additions and 1 deletion.
82 changes: 82 additions & 0 deletions docs/resources/integration_gitlab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "mondoo_integration_gitlab Resource - terraform-provider-mondoo"
subcategory: ""
description: |-
Continuously scan GitLab for misconfigurations.
---

# mondoo_integration_gitlab (Resource)

Continuously scan GitLab for misconfigurations.

## Example Usage

```terraform
variable "gitlab_token" {
description = "The GitLab Token"
type = string
sensitive = true
}
provider "mondoo" {
space = "hungry-poet-123456"
}
# Setup the GitLab integration
resource "mondoo_integration_gitlab" "gitlab_integration" {
name = "GitLab Integration"
# base_url = "https://my-self-hosted-gitlab.com"
# group = "my-group"
# configure discovery options
discovery = {
groups = true
projects = true
terraform = true
k8s_manifests = true
}
credentials = {
token = var.gitlab_token
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `credentials` (Attributes) (see [below for nested schema](#nestedatt--credentials))
- `name` (String) Name of the integration.

### Optional

- `base_url` (String) Base URL of the GitLab instance (only set this if your instance is self-hosted).
- `discovery` (Attributes) (see [below for nested schema](#nestedatt--discovery))
- `group` (String) Group to assign the integration to (by default all groups are discovered).
- `space_id` (String) Mondoo Space Identifier. If it is not provided, the provider space is used.

### Read-Only

- `mrn` (String) Integration identifier

<a id="nestedatt--credentials"></a>
### Nested Schema for `credentials`

Required:

- `token` (String, Sensitive) Token for GitLab integration.


<a id="nestedatt--discovery"></a>
### Nested Schema for `discovery`

Optional:

- `groups` (Boolean) Enable discovery of GitLab groups.
- `k8s_manifests` (Boolean) Enable discovery of Kubernetes manifests.
- `projects` (Boolean) Enable discovery of GitLab projects.
- `terraform` (Boolean) Enable discovery of Terraform configurations.
8 changes: 8 additions & 0 deletions examples/resources/mondoo_integration_gitlab/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
mondoo = {
source = "mondoohq/mondoo"
version = ">= 0.19"
}
}
}
29 changes: 29 additions & 0 deletions examples/resources/mondoo_integration_gitlab/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "gitlab_token" {
description = "The GitLab Token"
type = string
sensitive = true
}

provider "mondoo" {
space = "hungry-poet-123456"
}

# Setup the GitLab integration
resource "mondoo_integration_gitlab" "gitlab_integration" {
name = "GitLab Integration"

# base_url = "https://my-self-hosted-gitlab.com"
# group = "my-group"

# configure discovery options
discovery = {
groups = true
projects = true
terraform = true
k8s_manifests = true
}

credentials = {
token = var.gitlab_token
}
}
11 changes: 10 additions & 1 deletion internal/provider/gql.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,19 @@ type GithubConfigurationOptions struct {
Owner string
Repository string
Organization string
Type string
ReposAllowList []string
ReposDenyList []string
}

type GitlabConfigurationOptions struct {
Group string
DiscoverGroups bool
DiscoverProjects bool
DiscoverTerraform bool
DiscoverK8sManifests bool
BaseURL string
}

type Ms365ConfigurationOptions struct {
TenantId string
ClientId string
Expand Down Expand Up @@ -618,6 +626,7 @@ type ClientIntegrationConfigurationOptions struct {
GithubConfigurationOptions GithubConfigurationOptions `graphql:"... on GithubConfigurationOptions"`
HostedAwsConfigurationOptions HostedAwsConfigurationOptions `graphql:"... on HostedAwsConfigurationOptions"`
ShodanConfigurationOptions ShodanConfigurationOptions `graphql:"... on ShodanConfigurationOptions"`
GitlabConfigurationOptions GitlabConfigurationOptions `graphql:"... on GitlabConfigurationOptions"`
// Add other configuration options here
}

Expand Down
Loading

0 comments on commit 8272dc9

Please sign in to comment.