Skip to content

schedule resource

Source: internal/service/scheduler/schedule_rsrc.go:109

Example usage:

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

resources: {
  example: aws-scheduler.schedule {
    # Set input fields here.
  }
}

Inputs

action-after-completion

optional(string)

description

optional(string)

end-date

optional(string)

flexible-time-window

object
object({
  mode: string
  maximum-window-in-minutes: optional(integer)
})

required

group-name

optional(string)

kms-key-arn

optional(string)

name

optional(string)

schedule-expression

string

required

schedule-expression-timezone

optional(string)

start-date

optional(string)

state

optional(string)

target

object
object({
  arn: string
  role-arn: string
  dead-letter-config: optional(
    object({
      arn: string
    })
  )
  ecs-parameters: optional(
    object({
      task-definition-arn: string
      task-count: optional(integer)
      launch-type: optional(string)
      network-configuration: optional(
        object({
          subnets: list(string)
          security-groups: optional(list(string))
          assign-public-ip: optional(boolean)
        })
      )
      platform-version: optional(string)
      group: optional(string)
      capacity-provider-strategy: optional(
        list(
          object({
            capacity-provider: string
            base: optional(integer)
            weight: optional(integer)
          })
        )
      )
      enable-ecs-managed-tags: optional(boolean)
      enable-execute-command: optional(boolean)
      placement-constraints: optional(
        list(
          object({
            type: string
            expression: optional(string)
          })
        )
      )
      placement-strategy: optional(
        list(
          object({
            type: string
            field: optional(string)
          })
        )
      )
      propagate-tags: optional(string)
      reference-id: optional(string)
      tags: optional(map(string))
    })
  )
  eventbridge-parameters: optional(
    object({
      detail-type: string
      source: string
    })
  )
  input: optional(string)
  kinesis-parameters: optional(
    object({
      partition-key: string
    })
  )
  retry-policy: optional(
    object({
      maximum-event-age-in-seconds: optional(integer)
      maximum-retry-attempts: optional(integer)
    })
  )
  sage-maker-pipeline-parameters: optional(
    object({
      pipeline-parameter-list: optional(
        list(
          object({
            name: string
            value: string
          })
        )
      )
    })
  )
  sqs-parameters: optional(
    object({
      message-group-id: optional(string)
    })
  )
})

required

Input Constraints

Action after completion rules

action-after-completion must be DELETE or NONE.

Rule logic
When
input.action-after-completion != null
Require
input.action-after-completion == 'DELETE'
|| input.action-after-completion == 'NONE'

Flexible time window rules

flexible-time-window mode must be OFF or FLEXIBLE.

Rule logic
Require
input.flexible-time-window.mode == 'OFF'
|| input.flexible-time-window.mode == 'FLEXIBLE'

maximum-window-in-minutes must be between 1 and 1440.

Rule logic
When
input.flexible-time-window.maximum-window-in-minutes != null
Require
input.flexible-time-window.maximum-window-in-minutes >= 1
&& input.flexible-time-window.maximum-window-in-minutes <= 1440

FLEXIBLE mode requires maximum-window-in-minutes.

Rule logic
When
input.flexible-time-window.mode == 'FLEXIBLE'
Require
input.flexible-time-window.maximum-window-in-minutes != null

State rules

state must be ENABLED or DISABLED.

Rule logic
When
input.state != null
Require
input.state == 'ENABLED'
|| input.state == 'DISABLED'

Target rules

At most one of target.ecs-parameters, target.eventbridge-parameters, target.kinesis-parameters, target.sage-maker-pipeline-parameters, or target.sqs-parameters.

target input must not be empty.

Rule logic
When
input.target.input != null
Require
@core.length(input.target.input) >= 1

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

Rule logic
When
input.target.retry-policy.maximum-event-age-in-seconds != null
Require
input.target.retry-policy.maximum-event-age-in-seconds >= 60
&& input.target.retry-policy.maximum-event-age-in-seconds <= 86400

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

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

task-count must be between 1 and 10.

Rule logic
When
input.target.ecs-parameters.task-count != null
Require
input.target.ecs-parameters.task-count >= 1
&& input.target.ecs-parameters.task-count <= 10

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

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

Forbidden with target.ecs-parameters.launch-type: target.ecs-parameters.capacity-provider-strategy.

capacity-provider-strategy holds at most 6 entries.

Rule logic
Require
@core.length(input.target.ecs-parameters.capacity-provider-strategy ?? []) <= 6

capacity provider base must be between 0 and 100000.

Rule logic
For each
input.target.ecs-parameters.capacity-provider-strategy ?? []
When
@each.value.base != null
Require
@each.value.base >= 0
&& @each.value.base <= 100000

capacity provider weight must be between 0 and 1000.

Rule logic
For each
input.target.ecs-parameters.capacity-provider-strategy ?? []
When
@each.value.weight != null
Require
@each.value.weight >= 0
&& @each.value.weight <= 1000

FARGATE requires networking and forbids placement constraints.

Rule logic
When
input.target.ecs-parameters.launch-type == 'FARGATE'
Require
input.target.ecs-parameters.network-configuration != null
&& input.target.ecs-parameters.placement-constraints == null

assign-public-ip true requires FARGATE.

Rule logic
When
input.target.ecs-parameters.network-configuration.assign-public-ip == true
Require
input.target.ecs-parameters.launch-type == 'FARGATE'

platform-version requires FARGATE.

Rule logic
When
input.target.ecs-parameters.platform-version != null
Require
input.target.ecs-parameters.launch-type == 'FARGATE'

networking requires 1 to 16 subnets and at most 5 security groups.

Rule logic
When
input.target.ecs-parameters.network-configuration != null
Require
(input.target.ecs-parameters.network-configuration.subnets == null || @core.length(input.target.ecs-parameters.network-configuration.subnets) >= 1)
&& @core.length(input.target.ecs-parameters.network-configuration.subnets ?? []) <= 16
&& (input.target.ecs-parameters.network-configuration.security-groups == null || @core.length(input.target.ecs-parameters.network-configuration.security-groups) >= 1)
&& @core.length(input.target.ecs-parameters.network-configuration.security-groups ?? []) <= 5

placement-constraints holds at most 10 entries.

Rule logic
Require
@core.length(input.target.ecs-parameters.placement-constraints ?? []) <= 10

placement constraint type must be distinctInstance or memberOf.

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

memberOf requires an expression.

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

distinctInstance forbids an expression.

Rule logic
For each
input.target.ecs-parameters.placement-constraints ?? []
When
@each.value.type == 'distinctInstance'
Require
@each.value.expression == null

placement-strategy holds at most 5 entries.

Rule logic
Require
@core.length(input.target.ecs-parameters.placement-strategy ?? []) <= 5

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

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

propagate-tags must be TASK_DEFINITION.

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

ECS tags holds at most 50 entries.

Rule logic
Require
@core.length(input.target.ecs-parameters.tags ?? {}) <= 50

pipeline-parameter-list holds at most 200 entries.

Rule logic
Require
@core.length(input.target.sage-maker-pipeline-parameters.pipeline-parameter-list ?? []) <= 200

Outputs

arn

string