Skip to content

[Enhancement]: Allow aws_sns_topic_subscription to skip waiting for confirmation #30964

Open
@atorrescogollo

Description

Description

My use case is that I want to create an SNS topic in all my accounts. Then, I want to create an SQS in one of the accounts so that all messages that come to each SNS topic in every account are sent to the corresponding SQS queue for later processing.

The issue is that the SQS could not exist before creating the SNS topic. So I want the SNS subscriptions to keep on pending for confirmation and manually confirm the subscription as a separate step. Otherwise, I could have circular dependencies that I want to avoid.

I suggest having an argument in aws_sns_topic_subscription named wait_for_confirmation=true so that I could explicitly disable. For example:

resource "aws_sns_topic_subscription" "sqs_target" {
  topic_arn             = aws_sns_topic.this.arn
  protocol              = "sqs"
  endpoint              = var.sqs_arn
  wait_for_confirmation = false
}

Without this solution, I don't find a way to avoid that check:

╷
│ Error: waiting for SNS Topic Subscription (arn:aws:sns: ... ) confirmation: timeout while waiting for state to become 'false' (last state: 'true', timeout: 2m0s)

Affected Resource(s) and/or Data Source(s)

  • aws_sns_topic_subscription

Potential Terraform Configuration

resource "aws_sns_topic_subscription" "sqs_target" {
  topic_arn             = aws_sns_topic.this.arn
  protocol              = "sqs"
  endpoint              = var.sqs_arn
  wait_for_confirmation = false
}

References

No response

Would you like to implement a fix?

None

Metadata

Assignees

No one assigned

    Labels

    enhancementRequests to existing resources that expand the functionality or scope.service/snsIssues and PRs that pertain to the sns service.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions