UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

248 lines (247 loc) • 10.1 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages an Image Builder Lifecycle Policy. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const current = aws.getRegion({}); * const currentGetPartition = aws.getPartition({}); * const example = new aws.iam.Role("example", { * assumeRolePolicy: JSON.stringify({ * Version: "2012-10-17", * Statement: [{ * Action: "sts:AssumeRole", * Effect: "Allow", * Principal: { * Service: currentGetPartition.then(currentGetPartition => `imagebuilder.${currentGetPartition.dnsSuffix}`), * }, * }], * }), * name: "example", * }); * const exampleRolePolicyAttachment = new aws.iam.RolePolicyAttachment("example", { * policyArn: currentGetPartition.then(currentGetPartition => `arn:${currentGetPartition.partition}:iam::aws:policy/service-role/EC2ImageBuilderLifecycleExecutionPolicy`), * role: example.name, * }); * const exampleLifecyclePolicy = new aws.imagebuilder.LifecyclePolicy("example", { * name: "name", * description: "Example description", * executionRole: example.arn, * resourceType: "AMI_IMAGE", * policyDetails: [{ * action: { * type: "DELETE", * }, * filter: { * type: "AGE", * value: 6, * retainAtLeast: 10, * unit: "YEARS", * }, * }], * resourceSelection: { * tagMap: { * key1: "value1", * key2: "value2", * }, * }, * }, { * dependsOn: [exampleRolePolicyAttachment], * }); * ``` * * ## Import * * ### Identity Schema * * #### Required * * - `arn` (String) Amazon Resource Name (ARN) of the Image Builder lifecycle policy. * * Using `pulumi import`, import `aws_imagebuilder_lifecycle_policy` using the Amazon Resource Name (ARN). For example: * * console * * % pulumi import aws_imagebuilder_lifecycle_policy.example arn:aws:imagebuilder:us-east-1:123456789012:lifecycle-policy/example */ export declare class LifecyclePolicy extends pulumi.CustomResource { /** * Get an existing LifecyclePolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: LifecyclePolicyState, opts?: pulumi.CustomResourceOptions): LifecyclePolicy; /** * Returns true if the given object is an instance of LifecyclePolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is LifecyclePolicy; /** * Amazon Resource Name (ARN) of the lifecycle policy. */ readonly arn: pulumi.Output<string>; /** * description for the lifecycle policy. */ readonly description: pulumi.Output<string | undefined>; /** * The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found [`here`](https://docs.aws.amazon.com/imagebuilder/latest/userguide/image-lifecycle-prerequisites.html#image-lifecycle-prereq-role). */ readonly executionRole: pulumi.Output<string>; /** * The name of the lifecycle policy to create. */ readonly name: pulumi.Output<string>; /** * Configuration block with policy details. Detailed below. */ readonly policyDetails: pulumi.Output<outputs.imagebuilder.LifecyclePolicyPolicyDetail[] | undefined>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Selection criteria for the resources that the lifecycle policy applies to. Detailed below. * * The following arguments are optional: */ readonly resourceSelection: pulumi.Output<outputs.imagebuilder.LifecyclePolicyResourceSelection | undefined>; /** * The type of Image Builder resource that the lifecycle policy applies to. Valid values: `AMI_IMAGE` or `CONTAINER_IMAGE`. */ readonly resourceType: pulumi.Output<string>; /** * The status of the lifecycle policy. */ readonly status: pulumi.Output<string>; /** * Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * Create a LifecyclePolicy resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: LifecyclePolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering LifecyclePolicy resources. */ export interface LifecyclePolicyState { /** * Amazon Resource Name (ARN) of the lifecycle policy. */ arn?: pulumi.Input<string>; /** * description for the lifecycle policy. */ description?: pulumi.Input<string>; /** * The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found [`here`](https://docs.aws.amazon.com/imagebuilder/latest/userguide/image-lifecycle-prerequisites.html#image-lifecycle-prereq-role). */ executionRole?: pulumi.Input<string>; /** * The name of the lifecycle policy to create. */ name?: pulumi.Input<string>; /** * Configuration block with policy details. Detailed below. */ policyDetails?: pulumi.Input<pulumi.Input<inputs.imagebuilder.LifecyclePolicyPolicyDetail>[]>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Selection criteria for the resources that the lifecycle policy applies to. Detailed below. * * The following arguments are optional: */ resourceSelection?: pulumi.Input<inputs.imagebuilder.LifecyclePolicyResourceSelection>; /** * The type of Image Builder resource that the lifecycle policy applies to. Valid values: `AMI_IMAGE` or `CONTAINER_IMAGE`. */ resourceType?: pulumi.Input<string>; /** * The status of the lifecycle policy. */ status?: pulumi.Input<string>; /** * Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a LifecyclePolicy resource. */ export interface LifecyclePolicyArgs { /** * description for the lifecycle policy. */ description?: pulumi.Input<string>; /** * The Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions. More information about this role can be found [`here`](https://docs.aws.amazon.com/imagebuilder/latest/userguide/image-lifecycle-prerequisites.html#image-lifecycle-prereq-role). */ executionRole: pulumi.Input<string>; /** * The name of the lifecycle policy to create. */ name?: pulumi.Input<string>; /** * Configuration block with policy details. Detailed below. */ policyDetails?: pulumi.Input<pulumi.Input<inputs.imagebuilder.LifecyclePolicyPolicyDetail>[]>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Selection criteria for the resources that the lifecycle policy applies to. Detailed below. * * The following arguments are optional: */ resourceSelection?: pulumi.Input<inputs.imagebuilder.LifecyclePolicyResourceSelection>; /** * The type of Image Builder resource that the lifecycle policy applies to. Valid values: `AMI_IMAGE` or `CONTAINER_IMAGE`. */ resourceType: pulumi.Input<string>; /** * The status of the lifecycle policy. */ status?: pulumi.Input<string>; /** * Key-value map of resource tags for the Image Builder Lifecycle Policy. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }