AWS GuardDuty Detector

This page shows how to write Terraform and CloudFormation for GuardDuty Detector and write them securely.

aws_guardduty_detector (Terraform)

The Detector in GuardDuty can be configured in Terraform with the resource name aws_guardduty_detector. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L5
resource "aws_guardduty_detector" "eu_west_1" {
  enable   = true
  provider = aws.eu-west-1
}

resource "aws_guardduty_detector" "eu_west_2" {
detector.tf#L1
resource "aws_guardduty_detector" "eu_west_1" {
  enable                       = true
  provider                     = aws.eu-west-1
  finding_publishing_frequency = var.publishing_frequency
}

main.tf#L9
resource "aws_guardduty_detector" "us-east-1" {
  count    = contains(var.regions, "us-east-1") ? 1 : 0
  provider = aws.us-east-1
  enable   = true
}

main.tf#L1
resource "aws_guardduty_detector" "ok" {
  enable = true
}

resource "aws_guardduty_detector" "not_ok" {
  enable = true
guardduty.tf#L1
resource "aws_guardduty_detector" "primary" {
  enable = true
}

resource "aws_guardduty_detector" "member" {
  count  = var.guardduty ? 1 : 0

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a resource to manage a 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.

AWS::GuardDuty::Detector (CloudFormation)

The Detector in GuardDuty can be configured in CloudFormation with the resource name AWS::GuardDuty::Detector. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

The AWS::GuardDuty::Detector resource specifies a new Amazon GuardDuty detector. A detector is an object that represents the Amazon GuardDuty service. A detector is required for Amazon GuardDuty to become operational.

Frequently asked questions

What is AWS GuardDuty Detector?

AWS GuardDuty Detector is a resource for GuardDuty of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS GuardDuty Detector?

For Terraform, the UKHomeOffice/acp-guardduty-detector-tf, UKHomeOffice/acp-tf-GuardDuty-Masteraccount and ArtiomL/aws-sec-controls source code examples are useful. See the Terraform Example section for further details.