This issue was originally opened by @heitorlessa as hashicorp/terraform#27568. It was migrated here as a result of the provider split. The original body of the issue is below.
Current Terraform Version
0.14.5 - Latest as of now
Use-cases
AWS launched support for setting a custom retry configuration on a per Event Target basis, including DLQ.
CloudFormation example: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#aws-resource-events-rule--examples
Attempted Solutions
Using aws_cloudformation_stack resource to make use of additional properties not available in Terraform.
resource "aws_cloudformation_stack" "stack_eventbridge_target_dlq" {
name = "stack_eventbridge_target_dlq"
parameters = {
DlqQueue = var.event_bridge_target_x_dlq_arn
}
template_body = <<STACK
{
"Parameters" : {
"DlqQueue" : {
"Type" : "String",
"Description" : "SQS DLQ Queue for sending events that couldn't reach their targets"
}
},
"RuleWithRetryAndDLQ": {
"Type": "AWS::Events::Rule",
"Properties": {
"Description": "Test Events Rule",
"Name": "mynewabc",
"EventPattern": {
"source": [
"aws.ec2"
]
},
"State": "ENABLED",
"Targets": [
{
"Arn": "arn:aws:sqs:us-west-2:081035103721:demoSQS",
"Id": "Id1234",
"RetryPolicy": {
"MaximumRetryAttempts": 2,
"MaximumEventAgeInSeconds": 400
},
"DeadLetterConfig": {
"Arn": { "Ref": "DlqQueue" }
}
}
]
}
}
}
STACK
}
Proposal
Here's an example using the same properties names in Terraform syntax:
resource "aws_cloudwatch_event_target" "ecs_scheduled_task" {
target_id = "run-scheduled-task-every-hour"
arn = aws_ecs_cluster.cluster_name.arn
rule = aws_cloudwatch_event_rule.every_hour.name
role_arn = aws_iam_role.ecs_events.arn
# HERE
retry_policy {
maximum_retry_attempts = 2,
maximum_age_in_seconds = 400
}
dead_letter_config {
arn = aws_sqs_dlq_queue.arn
}
References
This issue was originally opened by @heitorlessa as hashicorp/terraform#27568. It was migrated here as a result of the provider split. The original body of the issue is below.
Current Terraform Version
Use-cases
AWS launched support for setting a custom retry configuration on a per Event Target basis, including DLQ.
CloudFormation example: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#aws-resource-events-rule--examples
Attempted Solutions
Using
aws_cloudformation_stackresource to make use of additional properties not available in Terraform.Proposal
Here's an example using the same properties names in Terraform syntax:
References