Resource: aws_imagebuilder_workflow

Terraform resource for managing an AWS EC2 Image Builder Workflow.

Example Usage

Basic Usage

resource "aws_imagebuilder_workflow" "example" {
  name    = "example"
  version = "1.0.0"
  type    = "TEST"

  data = <<-EOT
  name: example
  description: Workflow to test an image
  schemaVersion: 1.0

  parameters:
    - name: waitForActionAtEnd
      type: boolean

  steps:
    - name: LaunchTestInstance
      action: LaunchInstance
      onFailure: Abort
      inputs:
        waitFor: "ssmAgent"

    - name: TerminateTestInstance
      action: TerminateInstance
      onFailure: Continue
      inputs:
        instanceId.$: "$.stepOutputs.LaunchTestInstance.instanceId"

    - name: WaitForActionAtEnd
      action: WaitForAction
      if:
        booleanEquals: true
        value: "$.parameters.waitForActionAtEnd"
  EOT
}

Argument Reference

The following arguments are required:

The following arguments 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 EC2 Image Builder Workflow using the example_id_arg. For example:

import {
  to = aws_imagebuilder_workflow.example
  id = "workflow-id-12345678"
}

Using terraform import, import EC2 Image Builder Workflow using the example_id_arg. For example:

% terraform import aws_imagebuilder_workflow.example arn:aws:imagebuilder:us-east-1:aws:workflow/test/example/1.0.1/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.