Detector class

Provides a resource to manage an Amazon GuardDuty detector.

> NOTE: Deleting this resource is equivalent to "disabling" GuardDuty for an AWS region, which removes all existing findings. You can set the enable attribute to false to instead "suspend" monitoring and feedback reporting while keeping existing data. See the Suspending or Disabling Amazon GuardDuty documentation for more information.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const myDetector = new aws.guardduty.Detector("MyDetector", {
    datasources: {
        s3Logs: {
            enable: true,
        },
        kubernetes: {
            auditLogs: {
                enable: false,
            },
        },
        malwareProtection: {
            scanEc2InstanceWithFindings: {
                ebsVolumes: {
                    enable: true,
                },
            },
        },
    },
    enable: true,
});
import pulumi
import pulumi_aws as aws

my_detector = aws.guardduty.Detector("MyDetector",
    datasources={
        "s3_logs": {
            "enable": True,
        },
        "kubernetes": {
            "audit_logs": {
                "enable": False,
            },
        },
        "malware_protection": {
            "scan_ec2_instance_with_findings": {
                "ebs_volumes": {
                    "enable": True,
                },
            },
        },
    },
    enable=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var myDetector = new Aws.GuardDuty.Detector("MyDetector", new()
    {
        Datasources = new Aws.GuardDuty.Inputs.DetectorDatasourcesArgs
        {
            S3Logs = new Aws.GuardDuty.Inputs.DetectorDatasourcesS3LogsArgs
            {
                Enable = true,
            },
            Kubernetes = new Aws.GuardDuty.Inputs.DetectorDatasourcesKubernetesArgs
            {
                AuditLogs = new Aws.GuardDuty.Inputs.DetectorDatasourcesKubernetesAuditLogsArgs
                {
                    Enable = false,
                },
            },
            MalwareProtection = new Aws.GuardDuty.Inputs.DetectorDatasourcesMalwareProtectionArgs
            {
                ScanEc2InstanceWithFindings = new Aws.GuardDuty.Inputs.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsArgs
                {
                    EbsVolumes = new Aws.GuardDuty.Inputs.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesArgs
                    {
                        Enable = true,
                    },
                },
            },
        },
        Enable = true,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/guardduty"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := guardduty.NewDetector(ctx, "MyDetector", &guardduty.DetectorArgs{
			Datasources: &guardduty.DetectorDatasourcesArgs{
				S3Logs: &guardduty.DetectorDatasourcesS3LogsArgs{
					Enable: pulumi.Bool(true),
				},
				Kubernetes: &guardduty.DetectorDatasourcesKubernetesArgs{
					AuditLogs: &guardduty.DetectorDatasourcesKubernetesAuditLogsArgs{
						Enable: pulumi.Bool(false),
					},
				},
				MalwareProtection: &guardduty.DetectorDatasourcesMalwareProtectionArgs{
					ScanEc2InstanceWithFindings: &guardduty.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsArgs{
						EbsVolumes: &guardduty.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesArgs{
							Enable: pulumi.Bool(true),
						},
					},
				},
			},
			Enable: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_guardduty_detector" "MyDetector" {
  datasources = {
    s3_logs = {
      enable = true
    }
    kubernetes = {
      audit_logs = {
        enable = false
      }
    }
    malware_protection = {
      scan_ec2_instance_with_findings = {
        ebs_volumes = {
          enable = true
        }
      }
    }
  }
  enable = true
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.guardduty.Detector;
import com.pulumi.aws.guardduty.DetectorArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesS3LogsArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesKubernetesArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesKubernetesAuditLogsArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesMalwareProtectionArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsArgs;
import com.pulumi.aws.guardduty.inputs.DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var myDetector = new Detector("myDetector", DetectorArgs.builder()
            .datasources(DetectorDatasourcesArgs.builder()
                .s3Logs(DetectorDatasourcesS3LogsArgs.builder()
                    .enable(true)
                    .build())
                .kubernetes(DetectorDatasourcesKubernetesArgs.builder()
                    .auditLogs(DetectorDatasourcesKubernetesAuditLogsArgs.builder()
                        .enable(false)
                        .build())
                    .build())
                .malwareProtection(DetectorDatasourcesMalwareProtectionArgs.builder()
                    .scanEc2InstanceWithFindings(DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsArgs.builder()
                        .ebsVolumes(DetectorDatasourcesMalwareProtectionScanEc2InstanceWithFindingsEbsVolumesArgs.builder()
                            .enable(true)
                            .build())
                        .build())
                    .build())
                .build())
            .enable(true)
            .build());

    }
}
resources:
  myDetector:
    type: aws:guardduty:Detector
    name: MyDetector
    properties:
      datasources:
        s3Logs:
          enable: true
        kubernetes:
          auditLogs:
            enable: false
        malwareProtection:
          scanEc2InstanceWithFindings:
            ebsVolumes:
              enable: true
      enable: true

Import

Using pulumi import, import GuardDuty detectors using the detector ID. For example:

$ pulumi import aws:guardduty/detector:Detector MyDetector 00b00fd5aecc0ab60a708659477e9617

The ID of the detector can be retrieved via the AWS CLI using aws guardduty list-detectors.

Constructors

Detector(String name, {DetectorArgs? args, CustomResourceOptions? options})
Creates a new Detector. name The Pulumi resource name. args Arguments used to configure this Detector. The set of arguments for Detector. options Resource options controlling this resource's behavior.
Detector.reference(String urn)
Creates a typed reference to an existing Detector resource.

Properties

accountId ↔ Output<String>
The AWS account ID of the GuardDuty detector
latefinal
arn ↔ Output<String>
ARN of the GuardDuty detector
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
datasources ↔ Output<DetectorDatasources>
Describes which data sources will be enabled for the detector. See Data Sources below for more details. Deprecated in favor of aws.guardduty.DetectorFeature resources.
latefinal
enable ↔ Output<bool?>
Enable monitoring and feedback reporting. Setting to false is equivalent to "suspending" GuardDuty. Defaults to true.
latefinal
findingPublishingFrequency ↔ Output<String>
Specifies the frequency of notifications sent for subsequent finding occurrences. If the detector is a GuardDuty member account, the value is determined by the GuardDuty primary account and cannot be modified, otherwise defaults to SIX_HOURS. For standalone and GuardDuty primary accounts, it must be configured in this provider to enable drift detection. Valid values for standalone and primary accounts: FIFTEEN_MINUTES, ONE_HOUR, SIX_HOURS. See AWS Documentation for more information.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {DetectorState? state, CustomResourceOptions? options}) → Detector
Gets an existing Detector resource's state with the given name and id.