1. Packages
  2. AWS
  3. API Docs
  4. shield
  5. DrtAccessRoleArnAssociation
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.shield.DrtAccessRoleArnAssociation

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Authorizes the Shield Response Team (SRT) using the specified role, to access your AWS account to assist with DDoS attack mitigation during potential attacks. For more information see Configure AWS SRT Support

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const exampleRole = new aws.iam.Role("example", {
        name: "example-role",
        assumeRolePolicy: JSON.stringify({
            Version: "2012-10-17",
            Statement: [{
                Sid: "",
                Effect: "Allow",
                Principal: {
                    Service: "drt.shield.amazonaws.com",
                },
                Action: "sts:AssumeRole",
            }],
        }),
    });
    const example = new aws.shield.DrtAccessRoleArnAssociation("example", {roleArn: exampleRole.arn});
    const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", {
        role: exampleRole.name,
        policyArn: "arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy",
    });
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    example_role = aws.iam.Role("example",
        name="example-role",
        assume_role_policy=json.dumps({
            "Version": "2012-10-17",
            "Statement": [{
                "Sid": "",
                "Effect": "Allow",
                "Principal": {
                    "Service": "drt.shield.amazonaws.com",
                },
                "Action": "sts:AssumeRole",
            }],
        }))
    example = aws.shield.DrtAccessRoleArnAssociation("example", role_arn=example_role.arn)
    example_role_policy_attachment = aws.iam.RolePolicyAttachment("example",
        role=example_role.name,
        policy_arn="arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy")
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"Version": "2012-10-17",
    			"Statement": []map[string]interface{}{
    				map[string]interface{}{
    					"Sid":    "",
    					"Effect": "Allow",
    					"Principal": map[string]interface{}{
    						"Service": "drt.shield.amazonaws.com",
    					},
    					"Action": "sts:AssumeRole",
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		exampleRole, err := iam.NewRole(ctx, "example", &iam.RoleArgs{
    			Name:             pulumi.String("example-role"),
    			AssumeRolePolicy: pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = shield.NewDrtAccessRoleArnAssociation(ctx, "example", &shield.DrtAccessRoleArnAssociationArgs{
    			RoleArn: exampleRole.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewRolePolicyAttachment(ctx, "example", &iam.RolePolicyAttachmentArgs{
    			Role:      exampleRole.Name,
    			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleRole = new Aws.Iam.Role("example", new()
        {
            Name = "example-role",
            AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["Version"] = "2012-10-17",
                ["Statement"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["Sid"] = "",
                        ["Effect"] = "Allow",
                        ["Principal"] = new Dictionary<string, object?>
                        {
                            ["Service"] = "drt.shield.amazonaws.com",
                        },
                        ["Action"] = "sts:AssumeRole",
                    },
                },
            }),
        });
    
        var example = new Aws.Shield.DrtAccessRoleArnAssociation("example", new()
        {
            RoleArn = exampleRole.Arn,
        });
    
        var exampleRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("example", new()
        {
            Role = exampleRole.Name,
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iam.Role;
    import com.pulumi.aws.iam.RoleArgs;
    import com.pulumi.aws.shield.DrtAccessRoleArnAssociation;
    import com.pulumi.aws.shield.DrtAccessRoleArnAssociationArgs;
    import com.pulumi.aws.iam.RolePolicyAttachment;
    import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 exampleRole = new Role("exampleRole", RoleArgs.builder()
                .name("example-role")
                .assumeRolePolicy(serializeJson(
                    jsonObject(
                        jsonProperty("Version", "2012-10-17"),
                        jsonProperty("Statement", jsonArray(jsonObject(
                            jsonProperty("Sid", ""),
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", jsonObject(
                                jsonProperty("Service", "drt.shield.amazonaws.com")
                            )),
                            jsonProperty("Action", "sts:AssumeRole")
                        )))
                    )))
                .build());
    
            var example = new DrtAccessRoleArnAssociation("example", DrtAccessRoleArnAssociationArgs.builder()
                .roleArn(exampleRole.arn())
                .build());
    
            var exampleRolePolicyAttachment = new RolePolicyAttachment("exampleRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
                .role(exampleRole.name())
                .policyArn("arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy")
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:shield:DrtAccessRoleArnAssociation
        properties:
          roleArn: ${exampleRole.arn}
      exampleRole:
        type: aws:iam:Role
        name: example
        properties:
          name: example-role
          assumeRolePolicy:
            fn::toJSON:
              Version: 2012-10-17
              Statement:
                - Sid:
                  Effect: Allow
                  Principal:
                    Service: drt.shield.amazonaws.com
                  Action: sts:AssumeRole
      exampleRolePolicyAttachment:
        type: aws:iam:RolePolicyAttachment
        name: example
        properties:
          role: ${exampleRole.name}
          policyArn: arn:aws:iam::aws:policy/service-role/AWSShieldDRTAccessPolicy
    

    Create DrtAccessRoleArnAssociation Resource

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

    Constructor syntax

    new DrtAccessRoleArnAssociation(name: string, args: DrtAccessRoleArnAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def DrtAccessRoleArnAssociation(resource_name: str,
                                    args: DrtAccessRoleArnAssociationArgs,
                                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def DrtAccessRoleArnAssociation(resource_name: str,
                                    opts: Optional[ResourceOptions] = None,
                                    role_arn: Optional[str] = None,
                                    timeouts: Optional[DrtAccessRoleArnAssociationTimeoutsArgs] = None)
    func NewDrtAccessRoleArnAssociation(ctx *Context, name string, args DrtAccessRoleArnAssociationArgs, opts ...ResourceOption) (*DrtAccessRoleArnAssociation, error)
    public DrtAccessRoleArnAssociation(string name, DrtAccessRoleArnAssociationArgs args, CustomResourceOptions? opts = null)
    public DrtAccessRoleArnAssociation(String name, DrtAccessRoleArnAssociationArgs args)
    public DrtAccessRoleArnAssociation(String name, DrtAccessRoleArnAssociationArgs args, CustomResourceOptions options)
    
    type: aws:shield:DrtAccessRoleArnAssociation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DrtAccessRoleArnAssociationArgs
    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 DrtAccessRoleArnAssociationArgs
    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 DrtAccessRoleArnAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DrtAccessRoleArnAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DrtAccessRoleArnAssociationArgs
    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 drtAccessRoleArnAssociationResource = new Aws.Shield.DrtAccessRoleArnAssociation("drtAccessRoleArnAssociationResource", new()
    {
        RoleArn = "string",
        Timeouts = new Aws.Shield.Inputs.DrtAccessRoleArnAssociationTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
    });
    
    example, err := shield.NewDrtAccessRoleArnAssociation(ctx, "drtAccessRoleArnAssociationResource", &shield.DrtAccessRoleArnAssociationArgs{
    	RoleArn: pulumi.String("string"),
    	Timeouts: &shield.DrtAccessRoleArnAssociationTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var drtAccessRoleArnAssociationResource = new DrtAccessRoleArnAssociation("drtAccessRoleArnAssociationResource", DrtAccessRoleArnAssociationArgs.builder()
        .roleArn("string")
        .timeouts(DrtAccessRoleArnAssociationTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .build());
    
    drt_access_role_arn_association_resource = aws.shield.DrtAccessRoleArnAssociation("drtAccessRoleArnAssociationResource",
        role_arn="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        })
    
    const drtAccessRoleArnAssociationResource = new aws.shield.DrtAccessRoleArnAssociation("drtAccessRoleArnAssociationResource", {
        roleArn: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
    });
    
    type: aws:shield:DrtAccessRoleArnAssociation
    properties:
        roleArn: string
        timeouts:
            create: string
            delete: string
            update: string
    

    DrtAccessRoleArnAssociation 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 DrtAccessRoleArnAssociation resource accepts the following input properties:

    RoleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    Timeouts DrtAccessRoleArnAssociationTimeouts
    RoleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    Timeouts DrtAccessRoleArnAssociationTimeoutsArgs
    roleArn String
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeouts
    roleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeouts
    role_arn str
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeoutsArgs
    roleArn String
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DrtAccessRoleArnAssociation 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DrtAccessRoleArnAssociation Resource

    Get an existing DrtAccessRoleArnAssociation 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?: DrtAccessRoleArnAssociationState, opts?: CustomResourceOptions): DrtAccessRoleArnAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            role_arn: Optional[str] = None,
            timeouts: Optional[DrtAccessRoleArnAssociationTimeoutsArgs] = None) -> DrtAccessRoleArnAssociation
    func GetDrtAccessRoleArnAssociation(ctx *Context, name string, id IDInput, state *DrtAccessRoleArnAssociationState, opts ...ResourceOption) (*DrtAccessRoleArnAssociation, error)
    public static DrtAccessRoleArnAssociation Get(string name, Input<string> id, DrtAccessRoleArnAssociationState? state, CustomResourceOptions? opts = null)
    public static DrtAccessRoleArnAssociation get(String name, Output<String> id, DrtAccessRoleArnAssociationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    RoleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    Timeouts DrtAccessRoleArnAssociationTimeouts
    RoleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    Timeouts DrtAccessRoleArnAssociationTimeoutsArgs
    roleArn String
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeouts
    roleArn string
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeouts
    role_arn str
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts DrtAccessRoleArnAssociationTimeoutsArgs
    roleArn String
    The Amazon Resource Name (ARN) of the role the SRT will use to access your AWS account. Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role.
    timeouts Property Map

    Supporting Types

    DrtAccessRoleArnAssociationTimeouts, DrtAccessRoleArnAssociationTimeoutsArgs

    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

    Import

    Using pulumi import, import Shield DRT access role ARN association using the AWS account ID. For example:

    $ pulumi import aws:shield/drtAccessRoleArnAssociation:DrtAccessRoleArnAssociation example 123456789012
    

    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.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi