Manages an Image Builder Component.
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"
}
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"
}
The following arguments are required:
name
- (Required) Name of the component.platform
- (Required) Platform of the component.version
- (Required) Version of the component.The following attributes are optional:
change_description
- (Optional) Change description of the component.data
- (Optional) Inline YAML string with data of the component. Exactly one of data
and uri
can be specified. Terraform will only perform drift detection of its value when present in a configuration.description
- (Optional) Description of the component.kms_key_id
- (Optional) Amazon Resource Name (ARN) of the Key Management Service (KMS) Key used to encrypt the component.skip_destroy
- (Optional) Whether to retain the old version when the resource is destroyed or replacement is necessary. Defaults to false
.supported_os_versions
- (Optional) Set of Operating Systems (OS) supported by the component.tags
- (Optional) Key-value map of resource tags for the component. If configured with a provider default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.uri
- (Optional) S3 URI with data of the component. Exactly one of data
and uri
can be specified.This resource exports the following attributes in addition to the arguments above:
arn
- (Required) Amazon Resource Name (ARN) of the component.date_created
- Date the component was created.encrypted
- Encryption status of the component.owner
- Owner of the component.tags_all
- A map of tags assigned to the resource, including those inherited from the provider default_tags
configuration block.type
- Type of the component.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.