1. Packages
  2. AWS
  3. API Docs
  4. guardduty
  5. IPSet
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.guardduty.IPSet

Explore with Pulumi AI

Provides a resource to manage a GuardDuty IPSet.

Note: Currently in GuardDuty, users from member accounts cannot upload and further manage IPSets. IPSets that are uploaded by the primary account are imposed on GuardDuty functionality in its member accounts. See the GuardDuty API Documentation

Example Usage

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

const primary = new aws.guardduty.Detector("primary", {enable: true});
const bucket = new aws.s3.BucketV2("bucket", {});
const myIPSet = new aws.s3.BucketObjectv2("MyIPSet", {
    content: "10.0.0.0/8\n",
    bucket: bucket.id,
    key: "MyIPSet",
});
const example = new aws.guardduty.IPSet("example", {
    activate: true,
    detectorId: primary.id,
    format: "TXT",
    location: pulumi.interpolate`https://s3.amazonaws.com/${myIPSet.bucket}/${myIPSet.key}`,
    name: "MyIPSet",
});
const bucketAcl = new aws.s3.BucketAclV2("bucket_acl", {
    bucket: bucket.id,
    acl: "private",
});
Copy
import pulumi
import pulumi_aws as aws

primary = aws.guardduty.Detector("primary", enable=True)
bucket = aws.s3.BucketV2("bucket")
my_ip_set = aws.s3.BucketObjectv2("MyIPSet",
    content="10.0.0.0/8\n",
    bucket=bucket.id,
    key="MyIPSet")
example = aws.guardduty.IPSet("example",
    activate=True,
    detector_id=primary.id,
    format="TXT",
    location=pulumi.Output.all(
        bucket=my_ip_set.bucket,
        key=my_ip_set.key
).apply(lambda resolved_outputs: f"https://s3.amazonaws.com/{resolved_outputs['bucket']}/{resolved_outputs['key']}")
,
    name="MyIPSet")
bucket_acl = aws.s3.BucketAclV2("bucket_acl",
    bucket=bucket.id,
    acl="private")
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/guardduty"
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		primary, err := guardduty.NewDetector(ctx, "primary", &guardduty.DetectorArgs{
			Enable: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		myIPSet, err := s3.NewBucketObjectv2(ctx, "MyIPSet", &s3.BucketObjectv2Args{
			Content: pulumi.String("10.0.0.0/8\n"),
			Bucket:  bucket.ID(),
			Key:     pulumi.String("MyIPSet"),
		})
		if err != nil {
			return err
		}
		_, err = guardduty.NewIPSet(ctx, "example", &guardduty.IPSetArgs{
			Activate:   pulumi.Bool(true),
			DetectorId: primary.ID(),
			Format:     pulumi.String("TXT"),
			Location: pulumi.All(myIPSet.Bucket, myIPSet.Key).ApplyT(func(_args []interface{}) (string, error) {
				bucket := _args[0].(string)
				key := _args[1].(string)
				return fmt.Sprintf("https://s3.amazonaws.com/%v/%v", bucket, key), nil
			}).(pulumi.StringOutput),
			Name: pulumi.String("MyIPSet"),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAclV2(ctx, "bucket_acl", &s3.BucketAclV2Args{
			Bucket: bucket.ID(),
			Acl:    pulumi.String("private"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var primary = new Aws.GuardDuty.Detector("primary", new()
    {
        Enable = true,
    });

    var bucket = new Aws.S3.BucketV2("bucket");

    var myIPSet = new Aws.S3.BucketObjectv2("MyIPSet", new()
    {
        Content = @"10.0.0.0/8
",
        Bucket = bucket.Id,
        Key = "MyIPSet",
    });

    var example = new Aws.GuardDuty.IPSet("example", new()
    {
        Activate = true,
        DetectorId = primary.Id,
        Format = "TXT",
        Location = Output.Tuple(myIPSet.Bucket, myIPSet.Key).Apply(values =>
        {
            var bucket = values.Item1;
            var key = values.Item2;
            return $"https://s3.amazonaws.com/{bucket}/{key}";
        }),
        Name = "MyIPSet",
    });

    var bucketAcl = new Aws.S3.BucketAclV2("bucket_acl", new()
    {
        Bucket = bucket.Id,
        Acl = "private",
    });

});
Copy
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.s3.BucketV2;
import com.pulumi.aws.s3.BucketObjectv2;
import com.pulumi.aws.s3.BucketObjectv2Args;
import com.pulumi.aws.guardduty.IPSet;
import com.pulumi.aws.guardduty.IPSetArgs;
import com.pulumi.aws.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import java.util.List;
import java.util.ArrayList;
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 primary = new Detector("primary", DetectorArgs.builder()
            .enable(true)
            .build());

        var bucket = new BucketV2("bucket");

        var myIPSet = new BucketObjectv2("myIPSet", BucketObjectv2Args.builder()
            .content("""
10.0.0.0/8
            """)
            .bucket(bucket.id())
            .key("MyIPSet")
            .build());

        var example = new IPSet("example", IPSetArgs.builder()
            .activate(true)
            .detectorId(primary.id())
            .format("TXT")
            .location(Output.tuple(myIPSet.bucket(), myIPSet.key()).applyValue(values -> {
                var bucket = values.t1;
                var key = values.t2;
                return String.format("https://s3.amazonaws.com/%s/%s", bucket,key);
            }))
            .name("MyIPSet")
            .build());

        var bucketAcl = new BucketAclV2("bucketAcl", BucketAclV2Args.builder()
            .bucket(bucket.id())
            .acl("private")
            .build());

    }
}
Copy
resources:
  example:
    type: aws:guardduty:IPSet
    properties:
      activate: true
      detectorId: ${primary.id}
      format: TXT
      location: https://s3.amazonaws.com/${myIPSet.bucket}/${myIPSet.key}
      name: MyIPSet
  primary:
    type: aws:guardduty:Detector
    properties:
      enable: true
  bucket:
    type: aws:s3:BucketV2
  bucketAcl:
    type: aws:s3:BucketAclV2
    name: bucket_acl
    properties:
      bucket: ${bucket.id}
      acl: private
  myIPSet:
    type: aws:s3:BucketObjectv2
    name: MyIPSet
    properties:
      content: |
        10.0.0.0/8        
      bucket: ${bucket.id}
      key: MyIPSet
Copy

Create IPSet Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new IPSet(name: string, args: IPSetArgs, opts?: CustomResourceOptions);
@overload
def IPSet(resource_name: str,
          args: IPSetArgs,
          opts: Optional[ResourceOptions] = None)

@overload
def IPSet(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          activate: Optional[bool] = None,
          detector_id: Optional[str] = None,
          format: Optional[str] = None,
          location: Optional[str] = None,
          name: Optional[str] = None,
          tags: Optional[Mapping[str, str]] = None)
func NewIPSet(ctx *Context, name string, args IPSetArgs, opts ...ResourceOption) (*IPSet, error)
public IPSet(string name, IPSetArgs args, CustomResourceOptions? opts = null)
public IPSet(String name, IPSetArgs args)
public IPSet(String name, IPSetArgs args, CustomResourceOptions options)
type: aws:guardduty:IPSet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. IPSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. IPSetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. IPSetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. IPSetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. IPSetArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var ipsetResource = new Aws.GuardDuty.IPSet("ipsetResource", new()
{
    Activate = false,
    DetectorId = "string",
    Format = "string",
    Location = "string",
    Name = "string",
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := guardduty.NewIPSet(ctx, "ipsetResource", &guardduty.IPSetArgs{
	Activate:   pulumi.Bool(false),
	DetectorId: pulumi.String("string"),
	Format:     pulumi.String("string"),
	Location:   pulumi.String("string"),
	Name:       pulumi.String("string"),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var ipsetResource = new IPSet("ipsetResource", IPSetArgs.builder()
    .activate(false)
    .detectorId("string")
    .format("string")
    .location("string")
    .name("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
ipset_resource = aws.guardduty.IPSet("ipsetResource",
    activate=False,
    detector_id="string",
    format="string",
    location="string",
    name="string",
    tags={
        "string": "string",
    })
Copy
const ipsetResource = new aws.guardduty.IPSet("ipsetResource", {
    activate: false,
    detectorId: "string",
    format: "string",
    location: "string",
    name: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:guardduty:IPSet
properties:
    activate: false
    detectorId: string
    format: string
    location: string
    name: string
    tags:
        string: string
Copy

IPSet Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The IPSet resource accepts the following input properties:

Activate This property is required. bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
DetectorId
This property is required.
Changes to this property will trigger replacement.
string
The detector ID of the GuardDuty.
Format
This property is required.
Changes to this property will trigger replacement.
string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
Location This property is required. string
The URI of the file that contains the IPSet.
Name string
The friendly name to identify the IPSet.
Tags Dictionary<string, string>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Activate This property is required. bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
DetectorId
This property is required.
Changes to this property will trigger replacement.
string
The detector ID of the GuardDuty.
Format
This property is required.
Changes to this property will trigger replacement.
string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
Location This property is required. string
The URI of the file that contains the IPSet.
Name string
The friendly name to identify the IPSet.
Tags map[string]string
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
activate This property is required. Boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
detectorId
This property is required.
Changes to this property will trigger replacement.
String
The detector ID of the GuardDuty.
format
This property is required.
Changes to this property will trigger replacement.
String
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location This property is required. String
The URI of the file that contains the IPSet.
name String
The friendly name to identify the IPSet.
tags Map<String,String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
activate This property is required. boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
detectorId
This property is required.
Changes to this property will trigger replacement.
string
The detector ID of the GuardDuty.
format
This property is required.
Changes to this property will trigger replacement.
string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location This property is required. string
The URI of the file that contains the IPSet.
name string
The friendly name to identify the IPSet.
tags {[key: string]: string}
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
activate This property is required. bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
detector_id
This property is required.
Changes to this property will trigger replacement.
str
The detector ID of the GuardDuty.
format
This property is required.
Changes to this property will trigger replacement.
str
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location This property is required. str
The URI of the file that contains the IPSet.
name str
The friendly name to identify the IPSet.
tags Mapping[str, str]
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
activate This property is required. Boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
detectorId
This property is required.
Changes to this property will trigger replacement.
String
The detector ID of the GuardDuty.
format
This property is required.
Changes to this property will trigger replacement.
String
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location This property is required. String
The URI of the file that contains the IPSet.
name String
The friendly name to identify the IPSet.
tags Map<String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the IPSet resource produces the following output properties:

Arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the GuardDuty IPSet.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
id string
The provider-assigned unique ID for this managed resource.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
Amazon Resource Name (ARN) of the GuardDuty IPSet.
id str
The provider-assigned unique ID for this managed resource.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
Amazon Resource Name (ARN) of the GuardDuty IPSet.
id String
The provider-assigned unique ID for this managed resource.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Look up Existing IPSet Resource

Get an existing IPSet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: IPSetState, opts?: CustomResourceOptions): IPSet
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        activate: Optional[bool] = None,
        arn: Optional[str] = None,
        detector_id: Optional[str] = None,
        format: Optional[str] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> IPSet
func GetIPSet(ctx *Context, name string, id IDInput, state *IPSetState, opts ...ResourceOption) (*IPSet, error)
public static IPSet Get(string name, Input<string> id, IPSetState? state, CustomResourceOptions? opts = null)
public static IPSet get(String name, Output<String> id, IPSetState state, CustomResourceOptions options)
resources:  _:    type: aws:guardduty:IPSet    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Activate bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
Arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
DetectorId Changes to this property will trigger replacement. string
The detector ID of the GuardDuty.
Format Changes to this property will trigger replacement. string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
Location string
The URI of the file that contains the IPSet.
Name string
The friendly name to identify the IPSet.
Tags Dictionary<string, string>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Activate bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
Arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
DetectorId Changes to this property will trigger replacement. string
The detector ID of the GuardDuty.
Format Changes to this property will trigger replacement. string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
Location string
The URI of the file that contains the IPSet.
Name string
The friendly name to identify the IPSet.
Tags map[string]string
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

activate Boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
arn String
Amazon Resource Name (ARN) of the GuardDuty IPSet.
detectorId Changes to this property will trigger replacement. String
The detector ID of the GuardDuty.
format Changes to this property will trigger replacement. String
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location String
The URI of the file that contains the IPSet.
name String
The friendly name to identify the IPSet.
tags Map<String,String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

activate boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
arn string
Amazon Resource Name (ARN) of the GuardDuty IPSet.
detectorId Changes to this property will trigger replacement. string
The detector ID of the GuardDuty.
format Changes to this property will trigger replacement. string
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location string
The URI of the file that contains the IPSet.
name string
The friendly name to identify the IPSet.
tags {[key: string]: string}
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

activate bool
Specifies whether GuardDuty is to start using the uploaded IPSet.
arn str
Amazon Resource Name (ARN) of the GuardDuty IPSet.
detector_id Changes to this property will trigger replacement. str
The detector ID of the GuardDuty.
format Changes to this property will trigger replacement. str
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location str
The URI of the file that contains the IPSet.
name str
The friendly name to identify the IPSet.
tags Mapping[str, str]
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

activate Boolean
Specifies whether GuardDuty is to start using the uploaded IPSet.
arn String
Amazon Resource Name (ARN) of the GuardDuty IPSet.
detectorId Changes to this property will trigger replacement. String
The detector ID of the GuardDuty.
format Changes to this property will trigger replacement. String
The format of the file that contains the IPSet. Valid values: TXT | STIX | OTX_CSV | ALIEN_VAULT | PROOF_POINT | FIRE_EYE
location String
The URI of the file that contains the IPSet.
name String
The friendly name to identify the IPSet.
tags Map<String>
Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
tagsAll Map<String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Import

Using pulumi import, import GuardDuty IPSet using the primary GuardDuty detector ID and IPSet ID. For example:

$ pulumi import aws:guardduty/iPSet:IPSet MyIPSet 00b00fd5aecc0ab60a708659477e9617:123456789012
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.