Skip to content

Commit

Permalink
feat: added serveless integration for aws
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Theuermann <[email protected]>
  • Loading branch information
mati007thm committed May 23, 2024
1 parent 2b7019f commit fbda83c
Show file tree
Hide file tree
Showing 4 changed files with 495 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/resources/mondoo_integration_aws_serverless/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
required_providers {
mondoo = {
source = "mondoohq/mondoo"
version = ">= 0.4.0"
}
aws = {
source = "hashicorp/aws"
version = "5.50.0"
}
}
}
77 changes: 77 additions & 0 deletions examples/resources/mondoo_integration_aws_serverless/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
variable "mondoo_org" {
description = "Mondoo Organization"
type = string
}

variable "mondoo_token" {
description = "Mondoo API Token"
type = string
}

variable "origin_aws_account" {
description = "Origin AWS Account"
type = string
default = "764453172858"
}

provider "mondoo" {
region = "eu"
}

provider "aws" {
region = "us-east-1"
}

data "aws_region" "current" {}

# Create a new space
resource "mondoo_space" "my_space" {
name = "AWS Terraform"
org_id = var.mondoo_org
}

# Setup the AWS integration
resource "mondoo_integration_aws_serverless" "example" {
space_id = mondoo_space.my_space.id
name = "AWS Integration"
region = data.aws_region.current.name
# account_ids = ["123456789012"]
is_organization = true
console_sign_in_trigger = true
instance_state_change_trigger = false

scan_configuration {
account_scan = true
ec2_scan = true
ecr_scan = false
ecs_scan = false
cron_scanin_hours = 24

ec2_scan_options {
ssm = true
# instance_ids_filter = ["i-1234567890abcdef0"]
# regions_filter = ["us-west-1", "us-west-2"]
# tags_filter = {
# "Environment" = "Production"
# }
ebs_volume_scan = true
ebs_scan_options {
target_instances_per_scanner = 5
max_asg_instances = 10
}
instance_connect = false
}
}
}

resource "aws_cloudformation_stack" "mondoo_stack" {
name = "mondoo-stack"
# region = "us-east-1"
template_url = "https://s3.amazonaws.com/mondoo.${data.aws_region.current.name}/mondoo-lambda-stackset-cf.json"
parameters = {
MondooIntegrationMrn = mondoo_integration_aws_serverless.example.mrn
MondooToken = var.mondoo_token
OriginAwsAccount = var.origin_aws_account

}
}
Loading

0 comments on commit fbda83c

Please sign in to comment.