An open API service indexing awesome lists of open source software.

https://github.com/launchbynttdata/tf-aws-module_primitive-scheduler_schedule


https://github.com/launchbynttdata/tf-aws-module_primitive-scheduler_schedule

Last synced: 13 days ago
JSON representation

Awesome Lists containing this project

README

          

# Terraform AWS Module - EventBridge Scheduler Schedule

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## Overview

This Terraform module creates an [AWS EventBridge Scheduler Schedule](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html) resource. EventBridge Scheduler allows you to create schedules that invoke targets such as SQS queues, Lambda functions, ECS tasks, and more on a recurring or one-time basis.

## Usage

```hcl
module "scheduler_schedule" {
source = "terraform.registry.launch.nttdata.com/module_primitive/scheduler_schedule/aws"
version = "~> 1.0"

name = "my-schedule"
group_name = "default"

schedule_expression = "rate(1 hour)"

flexible_time_window = {
mode = "OFF"
}

schedule_target = {
arn = aws_sqs_queue.example.arn
role_arn = aws_iam_role.scheduler.arn
}
}
```

## Examples

See the [examples/complete](./examples/complete) directory for a full working example that creates an SQS queue, IAM role, and scheduler schedule.

## Documentation

- [AWS EventBridge Scheduler User Guide](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html)
- [Terraform aws_scheduler_schedule resource](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule)

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | ~> 1.5 |
| [aws](#requirement\_aws) | ~> 5.14 |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 5.100.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_scheduler_schedule.schedule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/scheduler_schedule) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [name](#input\_name) | Name of the schedule. If omitted, Terraform will assign a random, unique name. Conflicts with name\_prefix. | `string` | `null` | no |
| [name\_prefix](#input\_name\_prefix) | Creates a unique name beginning with the specified prefix. Conflicts with name. | `string` | `null` | no |
| [group\_name](#input\_group\_name) | Name of the schedule group to associate with this schedule. When omitted, the default schedule group is used. | `string` | `"default"` | no |
| [schedule\_expression](#input\_schedule\_expression) | Defines when the schedule runs. See Schedule types on EventBridge Scheduler. | `string` | n/a | yes |
| [schedule\_expression\_timezone](#input\_schedule\_expression\_timezone) | Timezone in which the scheduling expression is evaluated. Defaults to UTC. | `string` | `"UTC"` | no |
| [description](#input\_description) | Brief description of the schedule. | `string` | `null` | no |
| [state](#input\_state) | Specifies whether the schedule is enabled or disabled. One of: ENABLED (default), DISABLED. | `string` | `"ENABLED"` | no |
| [start\_date](#input\_start\_date) | The date, in UTC, after which the schedule can begin invoking its target. Example: 2030-01-01T01:00:00Z. | `string` | `null` | no |
| [end\_date](#input\_end\_date) | The date, in UTC, before which the schedule can invoke its target. Example: 2030-01-01T01:00:00Z. | `string` | `null` | no |
| [kms\_key\_arn](#input\_kms\_key\_arn) | ARN for the customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data. | `string` | `null` | no |
| [flexible\_time\_window](#input\_flexible\_time\_window) | Configures a time window during which EventBridge Scheduler invokes the schedule.
- mode: OFF or FLEXIBLE (required)
- maximum\_window\_in\_minutes: 1 to 1440 (optional, for FLEXIBLE mode) |

object({
mode = string
maximum_window_in_minutes = optional(number)
})
| n/a | yes |
| [schedule\_target](#input\_schedule\_target) | Configures the target of the schedule.
Required: arn, role\_arn
Optional: input, dead\_letter\_config, retry\_policy, ecs\_parameters, eventbridge\_parameters, kinesis\_parameters, sagemaker\_pipeline\_parameters, sqs\_parameters |
object({
arn = string
role_arn = string
input = optional(string)

dead_letter_config = optional(object({
arn = string
}))

retry_policy = optional(object({
maximum_event_age_in_seconds = optional(number)
maximum_retry_attempts = optional(number)
}))

ecs_parameters = optional(object({
task_definition_arn = string
group = optional(string)
launch_type = optional(string)
platform_version = optional(string)
propagate_tags = optional(string)
reference_id = optional(string)
task_count = optional(number)
enable_ecs_managed_tags = optional(bool)
enable_execute_command = optional(bool)

capacity_provider_strategy = optional(list(object({
base = optional(number)
capacity_provider = string
weight = optional(number)
})))

network_configuration = optional(object({
assign_public_ip = optional(bool)
security_groups = optional(list(string))
subnets = optional(list(string))
}))

placement_constraints = optional(list(object({
expression = optional(string)
type = string
})))

placement_strategy = optional(list(object({
field = optional(string)
type = string
})))

tags = optional(map(string))
}))

eventbridge_parameters = optional(object({
detail_type = string
source = string
}))

kinesis_parameters = optional(object({
partition_key = string
}))

sagemaker_pipeline_parameters = optional(object({
pipeline_parameter = optional(list(object({
name = string
value = string
})))
}))

sqs_parameters = optional(object({
message_group_id = optional(string)
}))
})
| n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [id](#output\_id) | The ID of the schedule (group\_name/name format). |
| [arn](#output\_arn) | The ARN of the schedule. |
| [name](#output\_name) | The name of the schedule. |
| [group\_name](#output\_group\_name) | The schedule group name. |