Skip to content

Resource: awsImagebuilderContainerRecipe

Manages an Image Builder Container Recipe.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.imagebuilderContainerRecipe.ImagebuilderContainerRecipe(
  this,
  "example",
  {
    component: [
      {
        componentArn: "${aws_imagebuilder_component.example.arn}",
        parameter: [
          {
            name: "Parameter1",
            value: "Value1",
          },
          {
            name: "Parameter2",
            value: "Value2",
          },
        ],
      },
    ],
    containerType: "DOCKER",
    dockerfileTemplateData:
      "FROM {{{ imagebuilder:parentImage }}}\n{{{ imagebuilder:environments }}}\n{{{ imagebuilder:components }}}\n",
    name: "example",
    parentImage:
      "arn:aws:imagebuilder:eu-central-1:aws:image/amazon-linux-x86-latest/x.x.x",
    targetRepository: {
      repositoryName: "${aws_ecr_repository.example.name}",
      service: "ECR",
    },
    version: "1.0.0",
  }
);

Argument Reference

The following arguments are required:

  • component - (Required) Ordered configuration block(s) with components for the container recipe. Detailed below.
  • containerType - (Required) The type of the container to create. Valid values: docker.
  • name - (Required) The name of the container recipe.
  • parentImage (Required) The base image for the container recipe.
  • targetRepository (Required) The destination repository for the container image. Detailed below.
  • version (Required) Version of the container recipe.

The following attributes are optional:

  • description - (Optional) The description of the container recipe.
  • dockerfileTemplateData - (Optional) The Dockerfile template used to build the image as an inline data blob.
  • dockerfileTemplateUri - (Optional) The Amazon S3 URI for the Dockerfile that will be used to build the container image.
  • instanceConfiguration - (Optional) Configuration block used to configure an instance for building and testing container images. Detailed below.
  • kmsKeyId - (Optional) The KMS key used to encrypt the container image.
  • tags - (Optional) Key-value map of resource tags for the container recipe. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • workingDirectory - (Optional) The working directory to be used during build and test workflows.

component

The component block supports the following arguments:

  • componentArn - (Required) Amazon Resource Name (ARN) of the Image Builder Component to associate.
  • parameter - (Optional) Configuration block(s) for parameters to configure the component. Detailed below.

parameter

The following arguments are required:

  • name - (Required) The name of the component parameter.
  • value - (Required) The value for the named component parameter.

targetRepository

The following arguments are required:

  • repositoryName - (Required) The name of the container repository where the output container image is stored. This name is prefixed by the repository location.
  • service - (Required) The service in which this image is registered. Valid values: ecr.

instanceConfiguration

The following arguments are optional:

  • blockDeviceMapping - (Optional) Configuration block(s) with block device mappings for the container recipe. Detailed below.
  • image - (Optional) The AMI ID to use as the base image for a container build and test instance. If not specified, Image Builder will use the appropriate ECS-optimized AMI as a base image.

blockDeviceMapping

The following arguments are optional:

  • deviceName - (Optional) Name of the device. For example, /dev/sda or /dev/xvdb.
  • ebs - (Optional) Configuration block with Elastic Block Storage (EBS) block device mapping settings. Detailed below.
  • noDevice - (Optional) Set to true to remove a mapping from the parent image.
  • virtualName - (Optional) Virtual device name. For example, ephemeral0. Instance store volumes are numbered starting from 0.

ebs

The following arguments are optional:

  • deleteOnTermination - (Optional) Whether to delete the volume on termination. Defaults to unset, which is the value inherited from the parent image.
  • encrypted - (Optional) Whether to encrypt the volume. Defaults to unset, which is the value inherited from the parent image.
  • iops - (Optional) Number of Input/Output (I/O) operations per second to provision for an io1 or io2 volume.
  • kmsKeyId - (Optional) Amazon Resource Name (ARN) of the Key Management Service (KMS) Key for encryption.
  • snapshotId - (Optional) Identifier of the EC2 Volume Snapshot.
  • throughput - (Optional) For GP3 volumes only. The throughput in MiB/s that the volume supports.
  • volumeSize - (Optional) Size of the volume, in GiB.
  • volumeType - (Optional) Type of the volume. For example, gp2 or io2.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - (Required) Amazon Resource Name (ARN) of the container recipe.
  • dateCreated - Date the container recipe was created.
  • encrypted - A flag that indicates if the target container is encrypted.
  • owner - Owner of the container recipe.
  • platform - Platform of the container recipe.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

awsImagebuilderContainerRecipe resources can be imported by using the Amazon Resource Name (ARN), e.g.,

$ terraform import aws_imagebuilder_container_recipe.example arn:aws:imagebuilder:us-east-1:123456789012:container-recipe/example/1.0.0