Resource: aws_imagebuilder_component

Manages an Image Builder Component.

Example Usage

Inline Data Document

resource "aws_imagebuilder_component" "example" {
  data = yamlencode({
    phases = [{
      name = "build"
      steps = [{
        action = "ExecuteBash"
        inputs = {
          commands = ["echo 'hello world'"]
        }
        name      = "example"
        onFailure = "Continue"
      }]
    }]
    schemaVersion = 1.0
  })
  name     = "example"
  platform = "Linux"
  version  = "1.0.0"
}

URI Document

resource "aws_imagebuilder_component" "example" {
  name     = "example"
  platform = "Linux"
  uri      = "s3://${aws_s3_object.example.bucket}/${aws_s3_object.example.key}"
  version  = "1.0.0"
}

Argument Reference

The following arguments are required:

The following attributes are optional:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import aws_imagebuilder_components resources using the Amazon Resource Name (ARN). For example:

import {
  to = aws_imagebuilder_component.example
  id = "arn:aws:imagebuilder:us-east-1:123456789012:component/example/1.0.0/1"
}

Using terraform import, import aws_imagebuilder_components resources using the Amazon Resource Name (ARN). For example:

% terraform import aws_imagebuilder_component.example arn:aws:imagebuilder:us-east-1:123456789012:component/example/1.0.0/1

Certain resource arguments, such as uri, cannot be read via the API and imported into Terraform. Terraform will display a difference for these arguments the first run after import if declared in the Terraform configuration for an imported resource.