1. Packages
  2. AWS Classic
  3. API Docs
  4. inspector2
  5. Enabler

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

aws.inspector2.Enabler

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi

    Resource for enabling Amazon Inspector resource scans.

    This resource must be created in the Organization’s Administrator Account.

    Example Usage

    Basic Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Inspector2.Enabler("example", new()
        {
            AccountIds = new[]
            {
                "123456789012",
            },
            ResourceTypes = new[]
            {
                "EC2",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/inspector2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := inspector2.NewEnabler(ctx, "example", &inspector2.EnablerArgs{
    			AccountIds: pulumi.StringArray{
    				pulumi.String("123456789012"),
    			},
    			ResourceTypes: pulumi.StringArray{
    				pulumi.String("EC2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.inspector2.Enabler;
    import com.pulumi.aws.inspector2.EnablerArgs;
    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 example = new Enabler("example", EnablerArgs.builder()        
                .accountIds("123456789012")
                .resourceTypes("EC2")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.inspector2.Enabler("example",
        account_ids=["123456789012"],
        resource_types=["EC2"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.inspector2.Enabler("example", {
        accountIds: ["123456789012"],
        resourceTypes: ["EC2"],
    });
    
    resources:
      example:
        type: aws:inspector2:Enabler
        properties:
          accountIds:
            - '123456789012'
          resourceTypes:
            - EC2
    

    For the Calling Account

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Aws.GetCallerIdentity.Invoke();
    
        var test = new Aws.Inspector2.Enabler("test", new()
        {
            AccountIds = new[]
            {
                current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId),
            },
            ResourceTypes = new[]
            {
                "ECR",
                "EC2",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/inspector2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := aws.GetCallerIdentity(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = inspector2.NewEnabler(ctx, "test", &inspector2.EnablerArgs{
    			AccountIds: pulumi.StringArray{
    				*pulumi.String(current.AccountId),
    			},
    			ResourceTypes: pulumi.StringArray{
    				pulumi.String("ECR"),
    				pulumi.String("EC2"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.inspector2.Enabler;
    import com.pulumi.aws.inspector2.EnablerArgs;
    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) {
            final var current = AwsFunctions.getCallerIdentity();
    
            var test = new Enabler("test", EnablerArgs.builder()        
                .accountIds(current.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))
                .resourceTypes(            
                    "ECR",
                    "EC2")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.get_caller_identity()
    test = aws.inspector2.Enabler("test",
        account_ids=[current.account_id],
        resource_types=[
            "ECR",
            "EC2",
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.getCallerIdentity({});
    const test = new aws.inspector2.Enabler("test", {
        accountIds: [current.then(current => current.accountId)],
        resourceTypes: [
            "ECR",
            "EC2",
        ],
    });
    
    resources:
      test:
        type: aws:inspector2:Enabler
        properties:
          accountIds:
            - ${current.accountId}
          resourceTypes:
            - ECR
            - EC2
    variables:
      current:
        fn::invoke:
          Function: aws:getCallerIdentity
          Arguments: {}
    

    Create Enabler Resource

    new Enabler(name: string, args: EnablerArgs, opts?: CustomResourceOptions);
    @overload
    def Enabler(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                account_ids: Optional[Sequence[str]] = None,
                resource_types: Optional[Sequence[str]] = None)
    @overload
    def Enabler(resource_name: str,
                args: EnablerArgs,
                opts: Optional[ResourceOptions] = None)
    func NewEnabler(ctx *Context, name string, args EnablerArgs, opts ...ResourceOption) (*Enabler, error)
    public Enabler(string name, EnablerArgs args, CustomResourceOptions? opts = null)
    public Enabler(String name, EnablerArgs args)
    public Enabler(String name, EnablerArgs args, CustomResourceOptions options)
    
    type: aws:inspector2:Enabler
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args EnablerArgs
    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 EnablerArgs
    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 EnablerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EnablerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EnablerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AccountIds List<string>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    ResourceTypes List<string>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    AccountIds []string

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    ResourceTypes []string

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds List<String>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes List<String>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds string[]

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes string[]

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    account_ids Sequence[str]

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resource_types Sequence[str]

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds List<String>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes List<String>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Enabler 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 Enabler Resource

    Get an existing Enabler 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?: EnablerState, opts?: CustomResourceOptions): Enabler
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_ids: Optional[Sequence[str]] = None,
            resource_types: Optional[Sequence[str]] = None) -> Enabler
    func GetEnabler(ctx *Context, name string, id IDInput, state *EnablerState, opts ...ResourceOption) (*Enabler, error)
    public static Enabler Get(string name, Input<string> id, EnablerState? state, CustomResourceOptions? opts = null)
    public static Enabler get(String name, Output<String> id, EnablerState 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:
    AccountIds List<string>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    ResourceTypes List<string>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    AccountIds []string

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    ResourceTypes []string

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds List<String>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes List<String>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds string[]

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes string[]

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    account_ids Sequence[str]

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resource_types Sequence[str]

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    accountIds List<String>

    Set of account IDs. Can contain one of: the Organization's Administrator Account, or one or more Member Accounts.

    resourceTypes List<String>

    Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. At least one item is required.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.2.1 published on Friday, Sep 22, 2023 by Pulumi