Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions aws/aws_scheduler_schedule/.stackgen/stackgen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: 1.0

representation:
side_panel:
label: CloudWatch Event Rule
node:
label:
static: CloudWatch Event Rule
template: CloudWatch Event Rule
display_type: default

variables:
state:
description: Indicates whether the rule is enabled or disabled
type: string
options:
- ENABLED
- DISABLED
- ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS
ui_control: select

discovery:
type: aws_scheduler_schedule
dnd_supported: false
5 changes: 5 additions & 0 deletions aws/aws_scheduler_schedule/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# aws_scheduler_schedule

Discovery module scaffold for issue #23.

Copied from sibling aws_cloudwatch_event_rule and adapted for workflow validation.
21 changes: 21 additions & 0 deletions aws/aws_scheduler_schedule/aws_scheduler_schedule.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "aws_scheduler_schedule" "this" {
name = var.name
description = var.description
schedule_expression = var.schedule_expression
flexible_time_window {
mode = var.flexible_time_window_mode
}

group_name = var.group_name
start_date = var.start_date
end_date = var.end_date
schedule_expression_timezone = var.schedule_expression_timezone
kms_key_arn = var.kms_key_arn
state = var.state

target {
arn = var.target_arn
role_arn = var.target_role_arn
input = var.target_input
}
}
26 changes: 26 additions & 0 deletions aws/aws_scheduler_schedule/basic.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
mock_provider "aws" {}

variables {
name = "test-schedule"
schedule_expression = "rate(5 minutes)"
target_arn = "arn:aws:sqs:us-east-1:123456789012:test-queue"
target_role_arn = "arn:aws:iam::123456789012:role/test-role"
}

run "basic_plan" {
command = plan

assert {
condition = aws_scheduler_schedule.this.name == "test-schedule"
error_message = "schedule name should match input variable"
}
}

run "schedule_expression_check" {
command = plan

assert {
condition = aws_scheduler_schedule.this.schedule_expression == "rate(5 minutes)"
error_message = "schedule expression should match input variable"
}
}
22 changes: 22 additions & 0 deletions aws/aws_scheduler_schedule/outputs.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"output": {
"id": [
{
"description": "The ARN of the scheduler schedule.",
"value": "${aws_scheduler_schedule.this.id}"
}
],
"arn": [
{
"description": "The ARN of the scheduler schedule.",
"value": "${aws_scheduler_schedule.this.arn}"
}
],
"name": [
{
"description": "The name of the scheduler schedule.",
"value": "${aws_scheduler_schedule.this.name}"
}
]
}
}
104 changes: 104 additions & 0 deletions aws/aws_scheduler_schedule/variables.tf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"variable": {
"name": [
{
"description": "The name of the scheduler schedule.",
"type": "string",
"nullable": false
}
],
"description": [
{
"description": "The description of the scheduler schedule.",
"type": "string",
"default": null,
"nullable": true
}
],
"schedule_expression": [
{
"description": "The schedule expression (e.g. rate(5 minutes) or cron(0 20 * * ? *)).",
"type": "string",
"nullable": false
}
],
"flexible_time_window_mode": [
{
"description": "Determines whether the schedule is invoked within a flexible time window. Valid values: OFF, FLEXIBLE.",
"type": "string",
"default": "OFF",
"nullable": false
}
],
"group_name": [
{
"description": "The name of the schedule group to associate with the schedule.",
"type": "string",
"default": null,
"nullable": true
}
],
"start_date": [
{
"description": "The date, in UTC, after which the schedule can begin invoking its target.",
"type": "string",
"default": null,
"nullable": true
}
],
"end_date": [
{
"description": "The date, in UTC, before which the schedule can invoke its target.",
"type": "string",
"default": null,
"nullable": true
}
],
"schedule_expression_timezone": [
{
"description": "The timezone in which the scheduling expression is evaluated.",
"type": "string",
"default": "UTC",
"nullable": false
}
],
"kms_key_arn": [
{
"description": "The ARN of the KMS key to use for encryption.",
"type": "string",
"default": null,
"nullable": true
}
],
"state": [
{
"description": "Specifies whether the schedule is enabled or disabled. Valid values: ENABLED, DISABLED.",
"type": "string",
"default": "ENABLED",
"nullable": false
}
],
"target_arn": [
{
"description": "The ARN of the target for the schedule.",
"type": "string",
"nullable": false
}
],
"target_role_arn": [
{
"description": "The ARN of the IAM role that the scheduler assumes when invoking the target.",
"type": "string",
"nullable": false
}
],
"target_input": [
{
"description": "The JSON text passed to the target. If not set, no input is passed.",
"type": "string",
"default": null,
"nullable": true
}
]
}
}
9 changes: 9 additions & 0 deletions aws/aws_scheduler_schedule/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.0.0, < 2.0.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}