aws.inspector2.Enabler
Explore with Pulumi AI
Resource for enabling Amazon Inspector resource scans.
This resource must be created in the Organization’s Administrator Account.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.inspector2.Enabler("example", {
    accountIds: ["123456789012"],
    resourceTypes: ["EC2"],
});
import pulumi
import pulumi_aws as aws
example = aws.inspector2.Enabler("example",
    account_ids=["123456789012"],
    resource_types=["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
	})
}
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 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());
    }
}
resources:
  example:
    type: aws:inspector2:Enabler
    properties:
      accountIds:
        - '123456789012'
      resourceTypes:
        - EC2
For the Calling Account
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",
    ],
});
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",
    ])
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, &aws.GetCallerIdentityArgs{}, 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
	})
}
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 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());
    }
}
resources:
  test:
    type: aws:inspector2:Enabler
    properties:
      accountIds:
        - ${current.accountId}
      resourceTypes:
        - ECR
        - EC2
variables:
  current:
    fn::invoke:
      function: aws:getCallerIdentity
      arguments: {}
Create Enabler Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Enabler(name: string, args: EnablerArgs, opts?: CustomResourceOptions);@overload
def Enabler(resource_name: str,
            args: EnablerArgs,
            opts: Optional[ResourceOptions] = None)
@overload
def Enabler(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            account_ids: Optional[Sequence[str]] = None,
            resource_types: Optional[Sequence[str]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var enablerResource = new Aws.Inspector2.Enabler("enablerResource", new()
{
    AccountIds = new[]
    {
        "string",
    },
    ResourceTypes = new[]
    {
        "string",
    },
});
example, err := inspector2.NewEnabler(ctx, "enablerResource", &inspector2.EnablerArgs{
	AccountIds: pulumi.StringArray{
		pulumi.String("string"),
	},
	ResourceTypes: pulumi.StringArray{
		pulumi.String("string"),
	},
})
var enablerResource = new Enabler("enablerResource", EnablerArgs.builder()
    .accountIds("string")
    .resourceTypes("string")
    .build());
enabler_resource = aws.inspector2.Enabler("enablerResource",
    account_ids=["string"],
    resource_types=["string"])
const enablerResource = new aws.inspector2.Enabler("enablerResource", {
    accountIds: ["string"],
    resourceTypes: ["string"],
});
type: aws:inspector2:Enabler
properties:
    accountIds:
        - string
    resourceTypes:
        - string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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) -> Enablerfunc 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)resources:  _:    type: aws:inspector2:Enabler    get:      id: ${id}- 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.
- 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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,LAMBDAandLAMBDA_CODE. 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 awsTerraform Provider.