PublishingDestination class

Provides a resource to manage a GuardDuty PublishingDestination. Requires an existing GuardDuty Detector.

Example Usage

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

const current = aws.getCallerIdentity({});
const currentGetRegion = aws.getRegion({});
const gdBucket = new aws.s3.Bucket("gd_bucket", {
    bucket: "example",
    forceDestroy: true,
});
const bucketPol = aws.iam.getPolicyDocumentOutput({
    statements: [
        {
            principals: [{
                type: "Service",
                identifiers: ["guardduty.amazonaws.com"],
            }],
            sid: "Allow PutObject",
            actions: ["s3:PutObject"],
            resources: [pulumi.interpolate`${gdBucket.arn}/*`],
        },
        {
            principals: [{
                type: "Service",
                identifiers: ["guardduty.amazonaws.com"],
            }],
            sid: "Allow GetBucketLocation",
            actions: ["s3:GetBucketLocation"],
            resources: [gdBucket.arn],
        },
    ],
});
const kmsPol = Promise.all([currentGetRegion, current]).then(([currentGetRegion, current]) => aws.iam.getPolicyDocument({
    statements: [
        {
            principals: [{
                type: "Service",
                identifiers: ["guardduty.amazonaws.com"],
            }],
            sid: "Allow GuardDuty to encrypt findings",
            actions: ["kms:GenerateDataKey"],
            resources: [`arn:aws:kms:${currentGetRegion.region}:${current.accountId}:key/*`],
        },
        {
            principals: [{
                type: "AWS",
                identifiers: [`arn:aws:iam::${current.accountId}:root`],
            }],
            sid: "Allow all users to modify/delete key (test only)",
            actions: ["kms:*"],
            resources: [`arn:aws:kms:${currentGetRegion.region}:${current.accountId}:key/*`],
        },
    ],
}));
const testGd = new aws.guardduty.Detector("test_gd", {enable: true});
const gdBucketAcl = new aws.s3.BucketAcl("gd_bucket_acl", {
    bucket: gdBucket.id,
    acl: "private",
});
const gdBucketPolicy = new aws.s3.BucketPolicy("gd_bucket_policy", {
    bucket: gdBucket.id,
    policy: bucketPol.json,
});
const gdKey = new aws.kms.Key("gd_key", {
    description: "Temporary key for AccTest of TF",
    deletionWindowInDays: 7,
    policy: kmsPol.then(kmsPol => kmsPol.json),
});
const test = new aws.guardduty.PublishingDestination("test", {
    detectorId: testGd.id,
    destinationArn: gdBucket.arn,
    kmsKeyArn: gdKey.arn,
}, {
    dependsOn: [gdBucketPolicy],
});
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
current_get_region = aws.get_region()
gd_bucket = aws.s3.Bucket("gd_bucket",
    bucket="example",
    force_destroy=True)
bucket_pol = aws.iam.get_policy_document_output(statements=[
    {
        "principals": [{
            "type": "Service",
            "identifiers": ["guardduty.amazonaws.com"],
        }],
        "sid": "Allow PutObject",
        "actions": ["s3:PutObject"],
        "resources": [gd_bucket.arn.apply(lambda arn: f"{arn}/*")],
    },
    {
        "principals": [{
            "type": "Service",
            "identifiers": ["guardduty.amazonaws.com"],
        }],
        "sid": "Allow GetBucketLocation",
        "actions": ["s3:GetBucketLocation"],
        "resources": [gd_bucket.arn],
    },
])
kms_pol = aws.iam.get_policy_document(statements=[
    {
        "principals": [{
            "type": "Service",
            "identifiers": ["guardduty.amazonaws.com"],
        }],
        "sid": "Allow GuardDuty to encrypt findings",
        "actions": ["kms:GenerateDataKey"],
        "resources": [f"arn:aws:kms:{current_get_region.region}:{current.account_id}:key/*"],
    },
    {
        "principals": [{
            "type": "AWS",
            "identifiers": [f"arn:aws:iam::{current.account_id}:root"],
        }],
        "sid": "Allow all users to modify/delete key (test only)",
        "actions": ["kms:*"],
        "resources": [f"arn:aws:kms:{current_get_region.region}:{current.account_id}:key/*"],
    },
])
test_gd = aws.guardduty.Detector("test_gd", enable=True)
gd_bucket_acl = aws.s3.BucketAcl("gd_bucket_acl",
    bucket=gd_bucket.id,
    acl="private")
gd_bucket_policy = aws.s3.BucketPolicy("gd_bucket_policy",
    bucket=gd_bucket.id,
    policy=bucket_pol.json)
gd_key = aws.kms.Key("gd_key",
    description="Temporary key for AccTest of TF",
    deletion_window_in_days=7,
    policy=kms_pol.json)
test = aws.guardduty.PublishingDestination("test",
    detector_id=test_gd.id,
    destination_arn=gd_bucket.arn,
    kms_key_arn=gd_key.arn,
    opts = pulumi.ResourceOptions(depends_on=[gd_bucket_policy]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetCallerIdentity.Invoke();

    var currentGetRegion = Aws.GetRegion.Invoke();

    var gdBucket = new Aws.S3.Bucket("gd_bucket", new()
    {
        BucketName = "example",
        ForceDestroy = true,
    });

    var bucketPol = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "guardduty.amazonaws.com",
                        },
                    },
                },
                Sid = "Allow PutObject",
                Actions = new[]
                {
                    "s3:PutObject",
                },
                Resources = new[]
                {
                    $"{gdBucket.Arn}/*",
                },
            },
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "guardduty.amazonaws.com",
                        },
                    },
                },
                Sid = "Allow GetBucketLocation",
                Actions = new[]
                {
                    "s3:GetBucketLocation",
                },
                Resources = new[]
                {
                    gdBucket.Arn,
                },
            },
        },
    });

    var kmsPol = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "guardduty.amazonaws.com",
                        },
                    },
                },
                Sid = "Allow GuardDuty to encrypt findings",
                Actions = new[]
                {
                    "kms:GenerateDataKey",
                },
                Resources = new[]
                {
                    $"arn:aws:kms:{currentGetRegion.Apply(getRegionResult => getRegionResult.Region)}:{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:key/*",
                },
            },
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "AWS",
                        Identifiers = new[]
                        {
                            $"arn:aws:iam::{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:root",
                        },
                    },
                },
                Sid = "Allow all users to modify/delete key (test only)",
                Actions = new[]
                {
                    "kms:*",
                },
                Resources = new[]
                {
                    $"arn:aws:kms:{currentGetRegion.Apply(getRegionResult => getRegionResult.Region)}:{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:key/*",
                },
            },
        },
    });

    var testGd = new Aws.GuardDuty.Detector("test_gd", new()
    {
        Enable = true,
    });

    var gdBucketAcl = new Aws.S3.BucketAcl("gd_bucket_acl", new()
    {
        Bucket = gdBucket.Id,
        Acl = "private",
    });

    var gdBucketPolicy = new Aws.S3.BucketPolicy("gd_bucket_policy", new()
    {
        Bucket = gdBucket.Id,
        Policy = bucketPol.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var gdKey = new Aws.Kms.Key("gd_key", new()
    {
        Description = "Temporary key for AccTest of TF",
        DeletionWindowInDays = 7,
        Policy = kmsPol.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var test = new Aws.GuardDuty.PublishingDestination("test", new()
    {
        DetectorId = testGd.Id,
        DestinationArn = gdBucket.Arn,
        KmsKeyArn = gdKey.Arn,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            gdBucketPolicy,
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/guardduty"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
		if err != nil {
			return err
		}
		currentGetRegion, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
		if err != nil {
			return err
		}
		gdBucket, err := s3.NewBucket(ctx, "gd_bucket", &s3.BucketArgs{
			Bucket:       pulumi.String("example"),
			ForceDestroy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		bucketPol := iam.GetPolicyDocumentOutput(ctx, iam.GetPolicyDocumentOutputArgs{
			Statements: iam.GetPolicyDocumentStatementArray{
				&iam.GetPolicyDocumentStatementArgs{
					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
						&iam.GetPolicyDocumentStatementPrincipalArgs{
							Type: pulumi.String("Service"),
							Identifiers: pulumi.StringArray{
								pulumi.String("guardduty.amazonaws.com"),
							},
						},
					},
					Sid: pulumi.String("Allow PutObject"),
					Actions: pulumi.StringArray{
						pulumi.String("s3:PutObject"),
					},
					Resources: pulumi.StringArray{
						gdBucket.Arn.ApplyT(func(arn string) (string, error) {
							return fmt.Sprintf("%v/*", arn), nil
						}).(pulumi.StringOutput),
					},
				},
				&iam.GetPolicyDocumentStatementArgs{
					Principals: iam.GetPolicyDocumentStatementPrincipalArray{
						&iam.GetPolicyDocumentStatementPrincipalArgs{
							Type: pulumi.String("Service"),
							Identifiers: pulumi.StringArray{
								pulumi.String("guardduty.amazonaws.com"),
							},
						},
					},
					Sid: pulumi.String("Allow GetBucketLocation"),
					Actions: pulumi.StringArray{
						pulumi.String("s3:GetBucketLocation"),
					},
					Resources: pulumi.StringArray{
						gdBucket.Arn,
					},
				},
			},
		}, nil)
		kmsPol, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"guardduty.amazonaws.com",
							},
						},
					},
					Sid: pulumi.StringRef("Allow GuardDuty to encrypt findings"),
					Actions: []string{
						"kms:GenerateDataKey",
					},
					Resources: []string{
						fmt.Sprintf("arn:aws:kms:%v:%v:key/*", currentGetRegion.Region, current.AccountId),
					},
				},
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "AWS",
							Identifiers: []string{
								fmt.Sprintf("arn:aws:iam::%v:root", current.AccountId),
							},
						},
					},
					Sid: pulumi.StringRef("Allow all users to modify/delete key (test only)"),
					Actions: []string{
						"kms:*",
					},
					Resources: []string{
						fmt.Sprintf("arn:aws:kms:%v:%v:key/*", currentGetRegion.Region, current.AccountId),
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		testGd, err := guardduty.NewDetector(ctx, "test_gd", &guardduty.DetectorArgs{
			Enable: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAcl(ctx, "gd_bucket_acl", &s3.BucketAclArgs{
			Bucket: gdBucket.ID().ToIDOutput().ToStringOutput(),
			Acl:    pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		gdBucketPolicy, err := s3.NewBucketPolicy(ctx, "gd_bucket_policy", &s3.BucketPolicyArgs{
			Bucket: gdBucket.ID().ToIDOutput().ToStringOutput(),
			Policy: bucketPol.Json(),
		})
		if err != nil {
			return err
		}
		gdKey, err := kms.NewKey(ctx, "gd_key", &kms.KeyArgs{
			Description:          pulumi.String("Temporary key for AccTest of TF"),
			DeletionWindowInDays: pulumi.Int(7),
			Policy:               pulumi.String(kmsPol.Json),
		})
		if err != nil {
			return err
		}
		_, err = guardduty.NewPublishingDestination(ctx, "test", &guardduty.PublishingDestinationArgs{
			DetectorId:     testGd.ID().ToIDOutput().ToStringOutput(),
			DestinationArn: gdBucket.Arn,
			KmsKeyArn:      gdKey.Arn,
		}, pulumi.DependsOn([]pulumi.Resource{
			gdBucketPolicy,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getcalleridentity" "current" {
}
data "aws_getregion" "currentGetRegion" {
}
data "aws_iam_getpolicydocument" "bucketPol" {
  statements {
    principals {
      type        = "Service"
      identifiers = ["guardduty.amazonaws.com"]
    }
    sid       = "Allow PutObject"
    actions   = ["s3:PutObject"]
    resources = ["${aws_s3_bucket.gd_bucket.arn}/*"]
  }
  statements {
    principals {
      type        = "Service"
      identifiers = ["guardduty.amazonaws.com"]
    }
    sid       = "Allow GetBucketLocation"
    actions   = ["s3:GetBucketLocation"]
    resources = [aws_s3_bucket.gd_bucket.arn]
  }
}
data "aws_iam_getpolicydocument" "kmsPol" {
  statements {
    principals {
      type        = "Service"
      identifiers = ["guardduty.amazonaws.com"]
    }
    sid       = "Allow GuardDuty to encrypt findings"
    actions   = ["kms:GenerateDataKey"]
    resources = ["arn:aws:kms:${data.aws_getregion.currentGetRegion.region}:${data.aws_getcalleridentity.current.account_id}:key/*"]
  }
  statements {
    principals {
      type        = "AWS"
      identifiers = ["arn:aws:iam::${data.aws_getcalleridentity.current.account_id}:root"]
    }
    sid       = "Allow all users to modify/delete key (test only)"
    actions   = ["kms:*"]
    resources = ["arn:aws:kms:${data.aws_getregion.currentGetRegion.region}:${data.aws_getcalleridentity.current.account_id}:key/*"]
  }
}

resource "aws_guardduty_detector" "test_gd" {
  enable = true
}
resource "aws_s3_bucket" "gd_bucket" {
  bucket        = "example"
  force_destroy = true
}
resource "aws_s3_bucketacl" "gd_bucket_acl" {
  bucket = aws_s3_bucket.gd_bucket.id
  acl    = "private"
}
resource "aws_s3_bucketpolicy" "gd_bucket_policy" {
  bucket = aws_s3_bucket.gd_bucket.id
  policy = data.aws_iam_getpolicydocument.bucketPol.json
}
resource "aws_kms_key" "gd_key" {
  description             = "Temporary key for AccTest of TF"
  deletion_window_in_days = 7
  policy                  = data.aws_iam_getpolicydocument.kmsPol.json
}
resource "aws_guardduty_publishingdestination" "test" {
  depends_on      = [aws_s3_bucketpolicy.gd_bucket_policy]
  detector_id     = aws_guardduty_detector.test_gd.id
  destination_arn = aws_s3_bucket.gd_bucket.arn
  kms_key_arn     = aws_kms_key.gd_key.arn
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetCallerIdentityArgs;
import com.pulumi.aws.inputs.GetRegionArgs;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.s3.BucketArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.guardduty.Detector;
import com.pulumi.aws.guardduty.DetectorArgs;
import com.pulumi.aws.s3.BucketAcl;
import com.pulumi.aws.s3.BucketAclArgs;
import com.pulumi.aws.s3.BucketPolicy;
import com.pulumi.aws.s3.BucketPolicyArgs;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.guardduty.PublishingDestination;
import com.pulumi.aws.guardduty.PublishingDestinationArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
        final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
            .build());

        final var currentGetRegion = AwsFunctions.getRegion(GetRegionArgs.builder()
            .build());

        var gdBucket = new Bucket("gdBucket", BucketArgs.builder()
            .bucket("example")
            .forceDestroy(true)
            .build());

        final var bucketPol = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(
                GetPolicyDocumentStatementArgs.builder()
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("guardduty.amazonaws.com")
                        .build())
                    .sid("Allow PutObject")
                    .actions("s3:PutObject")
                    .resources(gdBucket.arn().applyValue(_arn -> String.format("%s/*", _arn)))
                    .build(),
                GetPolicyDocumentStatementArgs.builder()
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("guardduty.amazonaws.com")
                        .build())
                    .sid("Allow GetBucketLocation")
                    .actions("s3:GetBucketLocation")
                    .resources(gdBucket.arn())
                    .build())
            .build());

        final var kmsPol = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(
                GetPolicyDocumentStatementArgs.builder()
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("guardduty.amazonaws.com")
                        .build())
                    .sid("Allow GuardDuty to encrypt findings")
                    .actions("kms:GenerateDataKey")
                    .resources(String.format("arn:aws:kms:%s:%s:key/*", currentGetRegion.region(),current.accountId()))
                    .build(),
                GetPolicyDocumentStatementArgs.builder()
                    .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("AWS")
                        .identifiers(String.format("arn:aws:iam::%s:root", current.accountId()))
                        .build())
                    .sid("Allow all users to modify/delete key (test only)")
                    .actions("kms:*")
                    .resources(String.format("arn:aws:kms:%s:%s:key/*", currentGetRegion.region(),current.accountId()))
                    .build())
            .build());

        var testGd = new Detector("testGd", DetectorArgs.builder()
            .enable(true)
            .build());

        var gdBucketAcl = new BucketAcl("gdBucketAcl", BucketAclArgs.builder()
            .bucket(gdBucket.id())
            .acl("private")
            .build());

        var gdBucketPolicy = new BucketPolicy("gdBucketPolicy", BucketPolicyArgs.builder()
            .bucket(gdBucket.id())
            .policy(bucketPol.applyValue(_bucketPol -> _bucketPol.json()))
            .build());

        var gdKey = new Key("gdKey", KeyArgs.builder()
            .description("Temporary key for AccTest of TF")
            .deletionWindowInDays(7)
            .policy(kmsPol.json())
            .build());

        var test = new PublishingDestination("test", PublishingDestinationArgs.builder()
            .detectorId(testGd.id())
            .destinationArn(gdBucket.arn())
            .kmsKeyArn(gdKey.arn())
            .build(), CustomResourceOptions.builder()
                .dependsOn(gdBucketPolicy)
                .build());

    }
}
resources:
  testGd:
    type: aws:guardduty:Detector
    name: test_gd
    properties:
      enable: true
  gdBucket:
    type: aws:s3:Bucket
    name: gd_bucket
    properties:
      bucket: example
      forceDestroy: true
  gdBucketAcl:
    type: aws:s3:BucketAcl
    name: gd_bucket_acl
    properties:
      bucket: ${gdBucket.id}
      acl: private
  gdBucketPolicy:
    type: aws:s3:BucketPolicy
    name: gd_bucket_policy
    properties:
      bucket: ${gdBucket.id}
      policy: ${bucketPol.json}
  gdKey:
    type: aws:kms:Key
    name: gd_key
    properties:
      description: Temporary key for AccTest of TF
      deletionWindowInDays: 7
      policy: ${kmsPol.json}
  test:
    type: aws:guardduty:PublishingDestination
    properties:
      detectorId: ${testGd.id}
      destinationArn: ${gdBucket.arn}
      kmsKeyArn: ${gdKey.arn}
    options:
      dependsOn:
        - ${gdBucketPolicy}
variables:
  current:
    fn::invoke:
      function: aws:getCallerIdentity
      arguments: {}
  currentGetRegion:
    fn::invoke:
      function: aws:getRegion
      arguments: {}
  bucketPol:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: Service
                identifiers:
                  - guardduty.amazonaws.com
            sid: Allow PutObject
            actions:
              - s3:PutObject
            resources:
              - ${gdBucket.arn}/*
          - principals:
              - type: Service
                identifiers:
                  - guardduty.amazonaws.com
            sid: Allow GetBucketLocation
            actions:
              - s3:GetBucketLocation
            resources:
              - ${gdBucket.arn}
  kmsPol:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: Service
                identifiers:
                  - guardduty.amazonaws.com
            sid: Allow GuardDuty to encrypt findings
            actions:
              - kms:GenerateDataKey
            resources:
              - arn:aws:kms:${currentGetRegion.region}:${current.accountId}:key/*
          - principals:
              - type: AWS
                identifiers:
                  - arn:aws:iam::${current.accountId}:root
            sid: Allow all users to modify/delete key (test only)
            actions:
              - kms:*
            resources:
              - arn:aws:kms:${currentGetRegion.region}:${current.accountId}:key/*

> Note: Please do not use this simple example for Bucket-Policy and KMS Key Policy in a production environment. It is much too open for such a use-case. Refer to the AWS documentation here: https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_exportfindings.html

Import

Using pulumi import, import GuardDuty PublishingDestination using the master GuardDuty detector ID and PublishingDestinationID. For example:

$ pulumi import aws:guardduty/publishingDestination:PublishingDestination test a4b86f26fa42e7e7cf0d1c333ea77777:a4b86f27a0e464e4a7e0516d242f1234

Constructors

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

Properties

arn ↔ Output<String>
Resource ARN.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
destinationArn ↔ Output<String>
The bucket arn and prefix under which the findings get exported. Bucket-ARN is required, the prefix is optional and will be AWSLogs/[Account-ID]/GuardDuty/[Region]/ if not provided
latefinal
destinationId ↔ Output<String>
Destination ID.
latefinal
destinationType ↔ Output<String?>
Currently there is only "S3" available as destination type which is also the default value
latefinal
detectorId ↔ Output<String>
The detector ID of the GuardDuty.
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
kmsKeyArn ↔ Output<String>
The ARN of the KMS key used to encrypt GuardDuty findings. GuardDuty enforces this to be encrypted.
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>?>
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, {PublishingDestinationState? state, CustomResourceOptions? options}) → PublishingDestination
Gets an existing PublishingDestination resource's state with the given name and id.