AWS Classic

v4.30.0 published on Tuesday, Nov 30, 2021 by Pulumi

InviteAccepter

Provides a resource to accept a pending GuardDuty invite on creation, ensure the detector has the correct primary account on read, and disassociate with the primary account upon removal.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var primary = new Aws.Provider("primary", new Aws.ProviderArgs
        {
        });
        var member = new Aws.Provider("member", new Aws.ProviderArgs
        {
        });
        var primaryDetector = new Aws.GuardDuty.Detector("primaryDetector", new Aws.GuardDuty.DetectorArgs
        {
        }, new CustomResourceOptions
        {
            Provider = aws.Primary,
        });
        var memberDetector = new Aws.GuardDuty.Detector("memberDetector", new Aws.GuardDuty.DetectorArgs
        {
        }, new CustomResourceOptions
        {
            Provider = aws.Member,
        });
        var memberMember = new Aws.GuardDuty.Member("memberMember", new Aws.GuardDuty.MemberArgs
        {
            AccountId = memberDetector.AccountId,
            DetectorId = primaryDetector.Id,
            Email = "required@example.com",
            Invite = true,
        }, new CustomResourceOptions
        {
            Provider = aws.Primary,
        });
        var memberInviteAccepter = new Aws.GuardDuty.InviteAccepter("memberInviteAccepter", new Aws.GuardDuty.InviteAccepterArgs
        {
            DetectorId = memberDetector.Id,
            MasterAccountId = primaryDetector.AccountId,
        }, new CustomResourceOptions
        {
            Provider = aws.Member,
            DependsOn = 
            {
                memberMember,
            },
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := providers.Newaws(ctx, "primary", nil)
		if err != nil {
			return err
		}
		_, err = providers.Newaws(ctx, "member", nil)
		if err != nil {
			return err
		}
		primaryDetector, err := guardduty.NewDetector(ctx, "primaryDetector", nil, pulumi.Provider(aws.Primary))
		if err != nil {
			return err
		}
		memberDetector, err := guardduty.NewDetector(ctx, "memberDetector", nil, pulumi.Provider(aws.Member))
		if err != nil {
			return err
		}
		memberMember, err := guardduty.NewMember(ctx, "memberMember", &guardduty.MemberArgs{
			AccountId:  memberDetector.AccountId,
			DetectorId: primaryDetector.ID(),
			Email:      pulumi.String("required@example.com"),
			Invite:     pulumi.Bool(true),
		}, pulumi.Provider(aws.Primary))
		if err != nil {
			return err
		}
		_, err = guardduty.NewInviteAccepter(ctx, "memberInviteAccepter", &guardduty.InviteAccepterArgs{
			DetectorId:      memberDetector.ID(),
			MasterAccountId: primaryDetector.AccountId,
		}, pulumi.Provider(aws.Member), pulumi.DependsOn([]pulumi.Resource{
			memberMember,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws
import pulumi_pulumi as pulumi

primary = pulumi.providers.Aws("primary")
member = pulumi.providers.Aws("member")
primary_detector = aws.guardduty.Detector("primaryDetector", opts=pulumi.ResourceOptions(provider=aws["primary"]))
member_detector = aws.guardduty.Detector("memberDetector", opts=pulumi.ResourceOptions(provider=aws["member"]))
member_member = aws.guardduty.Member("memberMember",
    account_id=member_detector.account_id,
    detector_id=primary_detector.id,
    email="required@example.com",
    invite=True,
    opts=pulumi.ResourceOptions(provider=aws["primary"]))
member_invite_accepter = aws.guardduty.InviteAccepter("memberInviteAccepter",
    detector_id=member_detector.id,
    master_account_id=primary_detector.account_id,
    opts=pulumi.ResourceOptions(provider=aws["member"],
        depends_on=[member_member]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const primary = new aws.Provider("primary", {});
const member = new aws.Provider("member", {});
const primaryDetector = new aws.guardduty.Detector("primaryDetector", {}, {
    provider: aws.primary,
});
const memberDetector = new aws.guardduty.Detector("memberDetector", {}, {
    provider: aws.member,
});
const memberMember = new aws.guardduty.Member("memberMember", {
    accountId: memberDetector.accountId,
    detectorId: primaryDetector.id,
    email: "required@example.com",
    invite: true,
}, {
    provider: aws.primary,
});
const memberInviteAccepter = new aws.guardduty.InviteAccepter("memberInviteAccepter", {
    detectorId: memberDetector.id,
    masterAccountId: primaryDetector.accountId,
}, {
    provider: aws.member,
    dependsOn: [memberMember],
});

Create a InviteAccepter Resource

new InviteAccepter(name: string, args: InviteAccepterArgs, opts?: CustomResourceOptions);
@overload
def InviteAccepter(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   detector_id: Optional[str] = None,
                   master_account_id: Optional[str] = None)
@overload
def InviteAccepter(resource_name: str,
                   args: InviteAccepterArgs,
                   opts: Optional[ResourceOptions] = None)
func NewInviteAccepter(ctx *Context, name string, args InviteAccepterArgs, opts ...ResourceOption) (*InviteAccepter, error)
public InviteAccepter(string name, InviteAccepterArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args InviteAccepterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args InviteAccepterArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args InviteAccepterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args InviteAccepterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

InviteAccepter Resource Properties

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

Inputs

The InviteAccepter resource accepts the following input properties:

DetectorId string
The detector ID of the member GuardDuty account.
MasterAccountId string
AWS account ID for primary account.
DetectorId string
The detector ID of the member GuardDuty account.
MasterAccountId string
AWS account ID for primary account.
detectorId string
The detector ID of the member GuardDuty account.
masterAccountId string
AWS account ID for primary account.
detector_id str
The detector ID of the member GuardDuty account.
master_account_id str
AWS account ID for primary account.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing InviteAccepter Resource

Get an existing InviteAccepter 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?: InviteAccepterState, opts?: CustomResourceOptions): InviteAccepter
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        detector_id: Optional[str] = None,
        master_account_id: Optional[str] = None) -> InviteAccepter
func GetInviteAccepter(ctx *Context, name string, id IDInput, state *InviteAccepterState, opts ...ResourceOption) (*InviteAccepter, error)
public static InviteAccepter Get(string name, Input<string> id, InviteAccepterState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:

DetectorId string
The detector ID of the member GuardDuty account.
MasterAccountId string
AWS account ID for primary account.
DetectorId string
The detector ID of the member GuardDuty account.
MasterAccountId string
AWS account ID for primary account.
detectorId string
The detector ID of the member GuardDuty account.
masterAccountId string
AWS account ID for primary account.
detector_id str
The detector ID of the member GuardDuty account.
master_account_id str
AWS account ID for primary account.

Import

aws_guardduty_invite_accepter can be imported using the the member GuardDuty detector ID, e.g.,

 $ pulumi import aws:guardduty/inviteAccepter:InviteAccepter member 00b00fd5aecc0ab60a708659477e9617

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.