Skip to content

Resource: awsGlueTrigger

Manages a Glue Trigger resource.

Example Usage

Conditional Trigger

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.glueTrigger.GlueTrigger(this, "example", {
  actions: [
    {
      jobName: "${aws_glue_job.example1.name}",
    },
  ],
  name: "example",
  predicate: {
    conditions: [
      {
        jobName: "${aws_glue_job.example2.name}",
        state: "SUCCEEDED",
      },
    ],
  },
  type: "CONDITIONAL",
});

On-Demand Trigger

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.glueTrigger.GlueTrigger(this, "example", {
  actions: [
    {
      jobName: "${aws_glue_job.example.name}",
    },
  ],
  name: "example",
  type: "ON_DEMAND",
});

Scheduled Trigger

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.glueTrigger.GlueTrigger(this, "example", {
  actions: [
    {
      jobName: "${aws_glue_job.example.name}",
    },
  ],
  name: "example",
  schedule: "cron(15 12 * * ? *)",
  type: "SCHEDULED",
});

Conditional Trigger with Crawler Action

Note: Triggers can have both a crawler action and a crawler condition, just no example provided.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.glueTrigger.GlueTrigger(this, "example", {
  actions: [
    {
      crawlerName: "${aws_glue_crawler.example1.name}",
    },
  ],
  name: "example",
  predicate: {
    conditions: [
      {
        jobName: "${aws_glue_job.example2.name}",
        state: "SUCCEEDED",
      },
    ],
  },
  type: "CONDITIONAL",
});

Conditional Trigger with Crawler Condition

Note: Triggers can have both a crawler action and a crawler condition, just no example provided.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.glueTrigger.GlueTrigger(this, "example", {
  actions: [
    {
      jobName: "${aws_glue_job.example1.name}",
    },
  ],
  name: "example",
  predicate: {
    conditions: [
      {
        crawlState: "SUCCEEDED",
        crawlerName: "${aws_glue_crawler.example2.name}",
      },
    ],
  },
  type: "CONDITIONAL",
});

Argument Reference

The following arguments are supported:

  • actions – (Required) List of actions initiated by this trigger when it fires. See Actions Below.
  • description – (Optional) A description of the new trigger.
  • enabled – (Optional) Start the trigger. Defaults to true.
  • name – (Required) The name of the trigger.
  • predicate – (Optional) A predicate to specify when the new trigger should fire. Required when trigger type is conditional. See Predicate Below.
  • schedule – (Optional) A cron expression used to specify the schedule. Time-Based Schedules for Jobs and Crawlers
  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
  • startOnCreation – (Optional) Set to true to start scheduled and conditional triggers when created. True is not supported for ON_DEMAND triggers.
  • type – (Required) The type of trigger. Valid values are conditional, event, ON_DEMAND, and scheduled.
  • workflowName - (Optional) A workflow to which the trigger should be associated to. Every workflow graph (DAG) needs a starting trigger (ON_DEMAND or scheduled type) and can contain multiple additional conditional triggers.
  • eventBatchingCondition - (Optional) Batch condition that must be met (specified number of events received or batch time window expired) before EventBridge event trigger fires. See Event Batching Condition.

Actions

  • arguments - (Optional) Arguments to be passed to the job. You can specify arguments here that your own job-execution script consumes, as well as arguments that AWS Glue itself consumes.
  • crawlerName - (Optional) The name of the crawler to be executed. Conflicts with jobName.
  • jobName - (Optional) The name of a job to be executed. Conflicts with crawlerName.
  • timeout - (Optional) The job run timeout in minutes. It overrides the timeout value of the job.
  • securityConfiguration - (Optional) The name of the Security Configuration structure to be used with this action.
  • notificationProperty - (Optional) Specifies configuration properties of a job run notification. See Notification Property details below.

Notification Property

  • notifyDelayAfter - (Optional) After a job run starts, the number of minutes to wait before sending a job run delay notification.

Predicate

  • conditions - (Required) A list of the conditions that determine when the trigger will fire. See Conditions.
  • logical - (Optional) How to handle multiple conditions. Defaults to and. Valid values are and or any.

Conditions

  • jobName - (Optional) The name of the job to watch. If this is specified, state must also be specified. Conflicts with crawlerName.
  • state - (Optional) The condition job state. Currently, the values supported are succeeded, stopped, timeout and failed. If this is specified, jobName must also be specified. Conflicts with crawlerState.
  • crawlerName - (Optional) The name of the crawler to watch. If this is specified, crawlState must also be specified. Conflicts with jobName.
  • crawlState - (Optional) The condition crawl state. Currently, the values supported are running, succeeded, cancelled, and failed. If this is specified, crawlerName must also be specified. Conflicts with state.
  • logicalOperator - (Optional) A logical operator. Defaults to equals.

Event Batching Condition

  • batchSize - (Required)Number of events that must be received from Amazon EventBridge before EventBridge event trigger fires.
  • batchWindow - (Optional) Window of time in seconds after which EventBridge event trigger fires. Window starts when first event is received. Default value is 900.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - Amazon Resource Name (ARN) of Glue Trigger
  • id - Trigger name
  • state - The current state of the trigger.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 5M)
  • delete - (Default 5M)

Import

Glue Triggers can be imported using name, e.g.,

$ terraform import aws_glue_trigger.MyTrigger MyTrigger