Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for RetryPolicy and DeadLetterConfig in aws_cloudwatch_event_target #17240

Closed
ghost opened this issue Jan 22, 2021 · 2 comments · Fixed by #17241
Closed

Support for RetryPolicy and DeadLetterConfig in aws_cloudwatch_event_target #17240

ghost opened this issue Jan 22, 2021 · 2 comments · Fixed by #17241
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudformation Issues and PRs that pertain to the cloudformation service. service/cloudwatch Issues and PRs that pertain to the cloudwatch service.
Milestone

Comments

@ghost
Copy link

ghost commented Jan 22, 2021

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

@ghost ghost added enhancement Requests to existing resources that expand the functionality or scope. service/cloudformation Issues and PRs that pertain to the cloudformation service. service/cloudwatchevents service/cloudwatch Issues and PRs that pertain to the cloudwatch service. labels Jan 22, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 22, 2021
@github-actions github-actions bot added this to the v3.29.0 milestone Feb 18, 2021
@ghost
Copy link
Author

ghost commented Feb 19, 2021

This has been released in version 3.29.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link
Author

ghost commented Mar 21, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 21, 2021
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudformation Issues and PRs that pertain to the cloudformation service. service/cloudwatch Issues and PRs that pertain to the cloudwatch service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant