aws logo
AWS Classic v5.33.0, Mar 24 23

aws.inspector2.Enabler

Resource for enabling AWS Inspector V2 resource scans.

NOTE: Due to testing limitations, we provide this resource as best effort. If you use it or have the ability to test it, and notice problems, please consider reaching out to us on GitHub.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Inspector2.Enabler("example", new()
    {
        AccountIds = new[]
        {
            "012345678901",
        },
        ResourceTypes = new[]
        {
            "EC2",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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("012345678901"),
			},
			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("012345678901")
            .resourceTypes("EC2")
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.inspector2.Enabler("example",
    account_ids=["012345678901"],
    resource_types=["EC2"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.inspector2.Enabler("example", {
    accountIds: ["012345678901"],
    resourceTypes: ["EC2"],
});
resources:
  example:
    type: aws:inspector2:Enabler
    properties:
      accountIds:
        - '012345678901'
      resourceTypes:
        - EC2

For the Calling Account

using System.Collections.Generic;
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/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/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.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.

ResourceTypes List<string>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

AccountIds []string

Set of account IDs.

ResourceTypes []string

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds List<String>

Set of account IDs.

resourceTypes List<String>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds string[]

Set of account IDs.

resourceTypes string[]

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

account_ids Sequence[str]

Set of account IDs.

resource_types Sequence[str]

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds List<String>

Set of account IDs.

resourceTypes List<String>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

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.

ResourceTypes List<string>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

AccountIds []string

Set of account IDs.

ResourceTypes []string

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds List<String>

Set of account IDs.

resourceTypes List<String>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds string[]

Set of account IDs.

resourceTypes string[]

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

account_ids Sequence[str]

Set of account IDs.

resource_types Sequence[str]

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

accountIds List<String>

Set of account IDs.

resourceTypes List<String>

Type of resources to scan. Valid values are EC2, ECR, and LAMBDA. If you only use one type, the provider will ignore the status of the other type.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.