Skip to content

aws.eventbridge-target resource

Description

Target attaches one destination to an EventBridge rule, the way AWS::Events::Target's underlying model treats a single entry in the rule's target list. There is no separate target API object: a target is written, read, and removed as a member of its rule through PutTargets, ListTargetsByRule, and RemoveTargets. Every parameter is a field on that one target reconciled by PutTargets, which is an upsert keyed by the target id, so an update is the same call with no follow-on operations. The rule, event bus, and target id form the identity, so a change to any of them replaces the target; the destination ARN and every parameter block update in place. The input or input transformation comes from at most one of three mutually exclusive forms.

Source: internal/service/eventbridge/target_rsrc.go:36

Example usage:

imports: {
  aws: 'github.com/cloudboss/unobin-library-aws'
}

resources: {
  example: aws.eventbridge-target {
    # Set input fields here.
  }
}

Inputs

rule

string

required

arn

string

required

event-bus-name

optional(string)

target-id

optional(string)

role-arn

optional(string)

input

optional(string)

input-path

optional(string)

input-transformer

optional(object)
optional(
  object({
    input-template: string
    input-paths: map(string)
  })
)

retry-policy

optional(object)
optional(
  object({
    maximum-event-age-in-seconds: optional(integer)
    maximum-retry-attempts: optional(integer)
  })
)

dead-letter-config

optional(object)
optional(
  object({
    arn: optional(string)
  })
)

ecs-parameters

optional(object)
optional(
  object({
    task-definition-arn: string
    task-count: optional(integer)
    launch-type: optional(string)
    platform-version: optional(string)
    group: optional(string)
    enable-ecs-managed-tags: optional(boolean)
    enable-execute-command: optional(boolean)
    propagate-tags: optional(string)
    network-configuration: optional(
      object({
        subnets: list(string)
        security-groups: list(string)
        assign-public-ip: optional(boolean)
      })
    )
    capacity-provider-strategy: list(
      object({
        capacity-provider: string
        base: optional(integer)
        weight: optional(integer)
      })
    )
    placement-constraints: list(
      object({
        type: string
        expression: optional(string)
      })
    )
    placement-strategy: list(
      object({
        type: string
        field: optional(string)
      })
    )
    tags: map(string)
  })
)

batch-parameters

optional(object)
optional(
  object({
    job-definition: string
    job-name: string
    array-size: optional(integer)
    job-attempts: optional(integer)
  })
)

kinesis-parameters

optional(object)
optional(
  object({
    partition-key-path: optional(string)
  })
)

sqs-parameters

optional(object)
optional(
  object({
    message-group-id: optional(string)
  })
)

http-parameters

optional(object)
optional(
  object({
    header-parameters: map(string)
    query-string-parameters: map(string)
    path-parameter-values: list(string)
  })
)

redshift-data-parameters

optional(object)
optional(
  object({
    database: string
    sql: string
    db-user: optional(string)
    statement-name: optional(string)
    secrets-manager-arn: optional(string)
    with-event: optional(boolean)
  })
)

run-command-parameters

optional(object)
optional(
  object({
    run-command-targets: list(
      object({
        key: string
        values: list(string)
      })
    )
  })
)

sage-maker-pipeline-parameters

optional(object)
optional(
  object({
    pipeline-parameter-list: list(
      object({
        name: string
        value: string
      })
    )
  })
)

app-sync-parameters

optional(object)
optional(
  object({
    graphql-operation: optional(string)
  })
)

force-destroy

optional(boolean)

Input Constraints

Field combinations

At most one of input, input-path, or input-transformer.

Input transformer rules

input-paths holds at most 100 entries.

Rule logic
Require
input.input-transformer.input-paths == null
|| @core.length(input.input-transformer.input-paths) <= 100

Retry policy rules

maximum-event-age-in-seconds must be between 0 and 86400.

Rule logic
When
input.retry-policy.maximum-event-age-in-seconds != null
Require
(input.retry-policy.maximum-event-age-in-seconds == null || input.retry-policy.maximum-event-age-in-seconds >= 0)
&& (input.retry-policy.maximum-event-age-in-seconds == null || input.retry-policy.maximum-event-age-in-seconds <= 86400)

maximum-retry-attempts must be between 0 and 185.

Rule logic
When
input.retry-policy.maximum-retry-attempts != null
Require
(input.retry-policy.maximum-retry-attempts == null || input.retry-policy.maximum-retry-attempts >= 0)
&& (input.retry-policy.maximum-retry-attempts == null || input.retry-policy.maximum-retry-attempts <= 185)

Batch parameters rules

array-size must be between 2 and 10000.

Rule logic
When
input.batch-parameters.array-size != null
Require
(input.batch-parameters.array-size == null || input.batch-parameters.array-size >= 2)
&& (input.batch-parameters.array-size == null || input.batch-parameters.array-size <= 10000)

job-attempts must be between 1 and 10.

Rule logic
When
input.batch-parameters.job-attempts != null
Require
(input.batch-parameters.job-attempts == null || input.batch-parameters.job-attempts >= 1)
&& (input.batch-parameters.job-attempts == null || input.batch-parameters.job-attempts <= 10)

Ecs parameters rules

launch-type must be EC2, FARGATE, or EXTERNAL.

Rule logic
When
input.ecs-parameters.launch-type != null
Require
input.ecs-parameters.launch-type == 'EC2'
|| input.ecs-parameters.launch-type == 'FARGATE'
|| input.ecs-parameters.launch-type == 'EXTERNAL'

propagate-tags must be TASK_DEFINITION.

Rule logic
When
input.ecs-parameters.propagate-tags != null
Require
input.ecs-parameters.propagate-tags == 'TASK_DEFINITION'

an ECS network configuration requires subnets.

Rule logic
When
input.ecs-parameters.network-configuration != null
Require
input.ecs-parameters.network-configuration.subnets != null

a capacity provider base must be between 0 and 100000.

Rule logic
For each
input.ecs-parameters.capacity-provider-strategy
When
@each.value.base != null
Require
(@each.value.base == null || @each.value.base >= 0)
&& (@each.value.base == null || @each.value.base <= 100000)

a capacity provider weight must be between 0 and 1000.

Rule logic
For each
input.ecs-parameters.capacity-provider-strategy
When
@each.value.weight != null
Require
(@each.value.weight == null || @each.value.weight >= 0)
&& (@each.value.weight == null || @each.value.weight <= 1000)

a placement constraint type must be distinctInstance or memberOf.

Rule logic
For each
input.ecs-parameters.placement-constraints
Require
@each.value.type == 'distinctInstance'
|| @each.value.type == 'memberOf'

a memberOf placement constraint requires an expression.

Rule logic
For each
input.ecs-parameters.placement-constraints
When
@each.value.type == 'memberOf'
Require
@each.value.expression != null

a placement strategy type must be random, spread, or binpack.

Rule logic
For each
input.ecs-parameters.placement-strategy
Require
@each.value.type == 'random'
|| @each.value.type == 'spread'
|| @each.value.type == 'binpack'

Run command parameters rules

run-command-targets holds at most 5 entries.

Rule logic
Require
input.run-command-parameters.run-command-targets == null
|| @core.length(input.run-command-parameters.run-command-targets) <= 5

a run command target takes 1 to 50 values.

Rule logic
For each
input.run-command-parameters.run-command-targets
Require
((@each.value.values != null) && (@core.length(@each.value.values) >= 1))
&& (@each.value.values == null || @core.length(@each.value.values) <= 50)

Sage maker pipeline parameters rules

pipeline-parameter-list holds at most 200 entries.

Rule logic
Require
input.sage-maker-pipeline-parameters.pipeline-parameter-list == null
|| @core.length(input.sage-maker-pipeline-parameters.pipeline-parameter-list) <= 200

Outputs

target-id

string