Skip to content

dod-iac/terraform-aws-image-builder-component

Repository files navigation

Usage

Creates a component for EC2 Image Builder.

module "image_builder_component" {
  source = "dod-iac/image-builder-component/aws"

  name     = format("app-%s-component-%s", var.application, var.environment)
  platform = "Linux"
  data     = yamlencode(yamldecode(file(format("%s/data.yml", path.module))))
}

Creates a component from a template file for EC2 Image Builder.

module "image_builder_component" {
  source = "dod-iac/image-builder-component/aws"

  name     = format("app-%s-component-%s", var.application, var.environment)
  platform = "Linux"
  data = templatefile(format("%s/component.yml.tpl", path.module), {
    account_id = data.aws_caller_identity.current.account_id
    bucket     = var.bucket
  })
}

Create a series of components for EC2 Image Builder.

module "image_builder_component" {
  source = "dod-iac/image-builder-component/aws"

  for_each = toset(["component-a", "component-b", "component-c"])

  name     = format("app-%s-%s-%s", var.application, each.key, var.environment)
  platform = "Linux"
  data     = yamlencode(yamldecode(file(format("%s/%s.yml", path.module, each.key))))
}

Terraform Version

Terraform 0.13. Pin module version to ~> 1.0.0 . Submit pull-requests to main branch.

Terraform 0.11 and 0.12 are not supported.

License

This project constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. However, because the project utilizes code licensed from contributors and other third parties, it therefore is licensed under the MIT License. See LICENSE file for more information.

Requirements

Name Version
terraform >= 0.13
aws >= 3.0, < 5.0

Providers

Name Version
aws >= 3.0, < 5.0

Modules

No modules.

Resources

Name Type
aws_imagebuilder_component.main resource

Inputs

Name Description Type Default Required
component_version The version of the component. string "1.0.0" no
data Inline YAML string with data of the component. Exactly one of data and uri can be specified. string "" no
description The description of the component. string "An component for EC2 Image Builder." no
name The name of the component. string n/a yes
platform The platform of the component. string n/a yes
tags The tags applied to the component. map(string) {} no
uri S3 URI with data of the component. Exactly one of data and uri can be specified. string "" no

Outputs

Name Description
arn The ARN of the EC2 Image Builder component.