Skip to content
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 gitlab integration #167

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading