Filter class

Provides a resource to manage a GuardDuty filter.

Example Usage

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

const myFilter = new aws.guardduty.Filter("MyFilter", {
    findingCriteria: {
        criterions: [
            {
                field: "region",
                equals: ["eu-west-1"],
            },
            {
                field: "service.additionalInfo.threatListName",
                notEquals: [
                    "some-threat",
                    "another-threat",
                ],
            },
            {
                field: "updatedAt",
                greaterThan: "2020-01-01T00:00:00Z",
                lessThan: "2020-02-01T00:00:00Z",
            },
            {
                field: "severity",
                greaterThanOrEqual: "4",
            },
        ],
    },
    name: "MyFilter",
    action: "ARCHIVE",
    detectorId: example.id,
    rank: 1,
});
import pulumi
import pulumi_aws as aws

my_filter = aws.guardduty.Filter("MyFilter",
    finding_criteria={
        "criterions": [
            {
                "field": "region",
                "equals": ["eu-west-1"],
            },
            {
                "field": "service.additionalInfo.threatListName",
                "not_equals": [
                    "some-threat",
                    "another-threat",
                ],
            },
            {
                "field": "updatedAt",
                "greater_than": "2020-01-01T00:00:00Z",
                "less_than": "2020-02-01T00:00:00Z",
            },
            {
                "field": "severity",
                "greater_than_or_equal": "4",
            },
        ],
    },
    name="MyFilter",
    action="ARCHIVE",
    detector_id=example["id"],
    rank=1)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var myFilter = new Aws.GuardDuty.Filter("MyFilter", new()
    {
        FindingCriteria = new Aws.GuardDuty.Inputs.FilterFindingCriteriaArgs
        {
            Criterions = new[]
            {
                new Aws.GuardDuty.Inputs.FilterFindingCriteriaCriterionArgs
                {
                    Field = "region",
                    Equals = new[]
                    {
                        "eu-west-1",
                    },
                },
                new Aws.GuardDuty.Inputs.FilterFindingCriteriaCriterionArgs
                {
                    Field = "service.additionalInfo.threatListName",
                    NotEquals = new[]
                    {
                        "some-threat",
                        "another-threat",
                    },
                },
                new Aws.GuardDuty.Inputs.FilterFindingCriteriaCriterionArgs
                {
                    Field = "updatedAt",
                    GreaterThan = "2020-01-01T00:00:00Z",
                    LessThan = "2020-02-01T00:00:00Z",
                },
                new Aws.GuardDuty.Inputs.FilterFindingCriteriaCriterionArgs
                {
                    Field = "severity",
                    GreaterThanOrEqual = "4",
                },
            },
        },
        Name = "MyFilter",
        Action = "ARCHIVE",
        DetectorId = example.Id,
        Rank = 1,
    });

});
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.NewFilter(ctx, "MyFilter", &guardduty.FilterArgs{
			FindingCriteria: &guardduty.FilterFindingCriteriaArgs{
				Criterions: guardduty.FilterFindingCriteriaCriterionArray{
					&guardduty.FilterFindingCriteriaCriterionArgs{
						Field: pulumi.String("region"),
						Equals: pulumi.StringArray{
							pulumi.String("eu-west-1"),
						},
					},
					&guardduty.FilterFindingCriteriaCriterionArgs{
						Field: pulumi.String("service.additionalInfo.threatListName"),
						NotEquals: pulumi.StringArray{
							pulumi.String("some-threat"),
							pulumi.String("another-threat"),
						},
					},
					&guardduty.FilterFindingCriteriaCriterionArgs{
						Field:       pulumi.String("updatedAt"),
						GreaterThan: pulumi.String("2020-01-01T00:00:00Z"),
						LessThan:    pulumi.String("2020-02-01T00:00:00Z"),
					},
					&guardduty.FilterFindingCriteriaCriterionArgs{
						Field:              pulumi.String("severity"),
						GreaterThanOrEqual: pulumi.String("4"),
					},
				},
			},
			Name:       pulumi.String("MyFilter"),
			Action:     pulumi.String("ARCHIVE"),
			DetectorId: pulumi.Any(example.Id),
			Rank:       pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_guardduty_filter" "MyFilter" {
  finding_criteria = {
    criterions = [{
      "field"  = "region"
      "equals" = ["eu-west-1"]
      }, {
      "field"     = "service.additionalInfo.threatListName"
      "notEquals" = ["some-threat", "another-threat"]
      }, {
      "field"       = "updatedAt"
      "greaterThan" = "2020-01-01T00:00:00Z"
      "lessThan"    = "2020-02-01T00:00:00Z"
      }, {
      "field"              = "severity"
      "greaterThanOrEqual" = "4"
    }]
  }
  name        = "MyFilter"
  action      = "ARCHIVE"
  detector_id = example.id
  rank        = 1
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.guardduty.Filter;
import com.pulumi.aws.guardduty.FilterArgs;
import com.pulumi.aws.guardduty.inputs.FilterFindingCriteriaArgs;
import com.pulumi.aws.guardduty.inputs.FilterFindingCriteriaCriterionArgs;
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 myFilter = new Filter("myFilter", FilterArgs.builder()
            .findingCriteria(FilterFindingCriteriaArgs.builder()
                .criterions(
                    FilterFindingCriteriaCriterionArgs.builder()
                        .field("region")
                        .equals("eu-west-1")
                        .build(),
                    FilterFindingCriteriaCriterionArgs.builder()
                        .field("service.additionalInfo.threatListName")
                        .notEquals(
                            "some-threat",
                            "another-threat")
                        .build(),
                    FilterFindingCriteriaCriterionArgs.builder()
                        .field("updatedAt")
                        .greaterThan("2020-01-01T00:00:00Z")
                        .lessThan("2020-02-01T00:00:00Z")
                        .build(),
                    FilterFindingCriteriaCriterionArgs.builder()
                        .field("severity")
                        .greaterThanOrEqual("4")
                        .build())
                .build())
            .name("MyFilter")
            .action("ARCHIVE")
            .detectorId(example.id())
            .rank(1)
            .build());

    }
}
resources:
  myFilter:
    type: aws:guardduty:Filter
    name: MyFilter
    properties:
      findingCriteria:
        criterions:
          - field: region
            equals:
              - eu-west-1
          - field: service.additionalInfo.threatListName
            notEquals:
              - some-threat
              - another-threat
          - field: updatedAt
            greaterThan: 2020-01-01T00:00:00Z
            lessThan: 2020-02-01T00:00:00Z
          - field: severity
            greaterThanOrEqual: '4'
      name: MyFilter
      action: ARCHIVE
      detectorId: ${example.id}
      rank: 1

Import

Using pulumi import, import GuardDuty filters using the detector ID and filter's name separated by a colon. For example:

$ pulumi import aws:guardduty/filter:Filter MyFilter 00b00fd5aecc0ab60a708659477e9617:MyFilter

Constructors

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

Properties

action ↔ Output<String>
Specifies the action that is to be applied to the findings that match the filter. Can be one of ARCHIVE or NOOP.
latefinal
arn ↔ Output<String>
The ARN of the GuardDuty filter.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
description ↔ Output<String?>
Description of the filter.
latefinal
detectorId ↔ Output<String>
ID of a GuardDuty detector, attached to your account.
latefinal
findingCriteria ↔ Output<FilterFindingCriteria>
Represents the criteria to be used in the filter for querying findings. Contains one or more criterion blocks, documented below.
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
name ↔ Output<String>
The name of your filter.
latefinal
rank ↔ Output<int>
Specifies the position of the filter in the list of current filters. Also specifies the order in which this filter is applied to the findings.
latefinal
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>?>
The tags that you want to add to the Filter resource. A tag consists of a key and a value. .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, {FilterState? state, CustomResourceOptions? options}) → Filter
Gets an existing Filter resource's state with the given name and id.