AllowedImagesSettings class
Provides EC2 allowed images settings for an AWS account. This feature allows you to control which AMIs can be used to launch EC2 instances in your account based on specified criteria.
For more information about the image criteria that can be set, see the AWS documentation on Allowed AMIs JSON configuration.
> NOTE: The AWS API does not delete this resource. When you run destroy, the provider will attempt to disable the setting.
> NOTE: There is only one allowed images settings configuration per AWS account and region. Creating this resource will configure the account-level settings.
Example Usage
Enable with Amazon AMIs only
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.AllowedImagesSettings("example", {
imageCriterions: [{
imageProviders: ["amazon"],
}],
state: "enabled",
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.AllowedImagesSettings("example",
image_criterions=[{
"image_providers": ["amazon"],
}],
state="enabled")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.AllowedImagesSettings("example", new()
{
ImageCriterions = new[]
{
new Aws.Ec2.Inputs.AllowedImagesSettingsImageCriterionArgs
{
ImageProviders = new[]
{
"amazon",
},
},
},
State = "enabled",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewAllowedImagesSettings(ctx, "example", &ec2.AllowedImagesSettingsArgs{
ImageCriterions: ec2.AllowedImagesSettingsImageCriterionArray{
&ec2.AllowedImagesSettingsImageCriterionArgs{
ImageProviders: pulumi.StringArray{
pulumi.String("amazon"),
},
},
},
State: pulumi.String("enabled"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_allowedimagessettings" "example" {
image_criterions {
image_providers = ["amazon"]
}
state = "enabled"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.AllowedImagesSettings;
import com.pulumi.aws.ec2.AllowedImagesSettingsArgs;
import com.pulumi.aws.ec2.inputs.AllowedImagesSettingsImageCriterionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 AllowedImagesSettings("example", AllowedImagesSettingsArgs.builder()
.imageCriterions(AllowedImagesSettingsImageCriterionArgs.builder()
.imageProviders("amazon")
.build())
.state("enabled")
.build());
}
}
resources:
example:
type: aws:ec2:AllowedImagesSettings
properties:
imageCriterions:
- imageProviders:
- amazon
state: enabled
Enable audit mode with specific account IDs
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.AllowedImagesSettings("example", {
imageCriterions: [{
imageProviders: [
"amazon",
"123456789012",
],
}],
state: "audit-mode",
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.AllowedImagesSettings("example",
image_criterions=[{
"image_providers": [
"amazon",
"123456789012",
],
}],
state="audit-mode")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.AllowedImagesSettings("example", new()
{
ImageCriterions = new[]
{
new Aws.Ec2.Inputs.AllowedImagesSettingsImageCriterionArgs
{
ImageProviders = new[]
{
"amazon",
"123456789012",
},
},
},
State = "audit-mode",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewAllowedImagesSettings(ctx, "example", &ec2.AllowedImagesSettingsArgs{
ImageCriterions: ec2.AllowedImagesSettingsImageCriterionArray{
&ec2.AllowedImagesSettingsImageCriterionArgs{
ImageProviders: pulumi.StringArray{
pulumi.String("amazon"),
pulumi.String("123456789012"),
},
},
},
State: pulumi.String("audit-mode"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_allowedimagessettings" "example" {
image_criterions {
image_providers = ["amazon", "123456789012"]
}
state = "audit-mode"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.AllowedImagesSettings;
import com.pulumi.aws.ec2.AllowedImagesSettingsArgs;
import com.pulumi.aws.ec2.inputs.AllowedImagesSettingsImageCriterionArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 AllowedImagesSettings("example", AllowedImagesSettingsArgs.builder()
.imageCriterions(AllowedImagesSettingsImageCriterionArgs.builder()
.imageProviders(
"amazon",
"123456789012")
.build())
.state("audit-mode")
.build());
}
}
resources:
example:
type: aws:ec2:AllowedImagesSettings
properties:
imageCriterions:
- imageProviders:
- amazon
- '123456789012'
state: audit-mode
Import
Using pulumi import, import EC2 allowed images settings. For example:
$ pulumi import aws:ec2/allowedImagesSettings:AllowedImagesSettings example us-east-1
Constructors
- AllowedImagesSettings(String name, {AllowedImagesSettingsArgs? args, CustomResourceOptions? options})
-
Creates a new AllowedImagesSettings.
nameThe Pulumi resource name.argsArguments used to configure this AllowedImagesSettings. The set of arguments for AllowedImagesSettings.optionsResource options controlling this resource's behavior. - AllowedImagesSettings.reference(String urn)
- Creates a typed reference to an existing AllowedImagesSettings resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
imageCriterions
↔ Output<
List< AllowedImagesSettingsImageCriterion> ?> -
List of image criteria. Maximum of 10 criterion blocks allowed. See
imageCriterionbelow.latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
↔ Output<
String> -
State of the allowed images settings. Valid values are
enabledoraudit-mode.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {AllowedImagesSettingsState? state, CustomResourceOptions? options}) → AllowedImagesSettings -
Gets an existing AllowedImagesSettings resource's state with the given
nameandid.