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 FIFO SNS Topics #35

Merged
merged 2 commits into from Jul 21, 2021
Merged

Support for FIFO SNS Topics #35

merged 2 commits into from Jul 21, 2021

Conversation

azec-pdx
Copy link
Contributor

what

  • Adds ability to support deploying FIFO - type SNS Topics

why

  • Customers might need FIFO SNS Topics with FIFO SQS queues subscribed
  • This allows them to use module in following way
     module "sns" {
         source = "git::https://github.com/cloudposse/terraform-aws-sns-topic.git//?ref=tags/<FUTURE_TAG>"
         
         fifo_topic                  = var.fifo_topic
         name                        = module.this.id # e.g. mytopic.fifo   
         regex_replace_chars         = var.regex_replace_chars     # e.g. "/[^.a-zA-Z0-9-]/"  - required to prevent removal of '.' char in '.fifo' suffix
         sqs_dlq_enabled             = false # Until valid case neeed for this and until CP fixes https://github.com/cloudposse/terraform-aws-sns-topic/blob/master/main.tf#L20
         subscribers                 = var.subscribers
         content_based_deduplication = var.content_based_deduplication
       
         # SNS Topic policies related variables
         sns_topic_policy_json                  = var.sns_topic_policy_json
         allowed_aws_services_for_sns_published = var.allowed_aws_services_for_sns_published
         allowed_iam_arns_for_sns_publish       = var.allowed_iam_arns_for_sns_publish
     }
    and then upstream to use this as:
     module "my_topic_and_subscribers" {
       source = "../../components/sns_topic_w_subscribers"
     
       environment                 = var.environment
       fifo_topic                  = true # has to be fifo for FIFO SQS queue subscribers (which all are)
       content_based_deduplication = true
       name                        = "my-topic.fifo" # suffix .fifo is required by AWS for this type of SNS Topic
       namespace                   = var.namespace
       regex_replace_chars         = "/[^.a-zA-Z0-9-]/" # required to prevent removal of '.' char in '.fifo' suffix
       region                      = var.region
       subscribers = {
         my_sqs_fifo = {
           endpoint               = module.my_queue_fifo.queue_arn # ARN of the SQS that will be subscribed to SNS topic
           endpoint_auto_confirms = true
           protocol               = "sqs",
           raw_message_delivery   = false
         }
       }
       sns_topic_policy_json = data.aws_iam_policy_document.my_topic_policy_document.json
     }
    

references

  • N/A

@azec-pdx azec-pdx requested review from a team as code owners July 17, 2021 00:15
@azec-pdx azec-pdx requested review from Gowiem and Benbentwo July 17, 2021 00:20
@azec-pdx
Copy link
Contributor Author

/test all

1 similar comment
@aknysh
Copy link
Member

aknysh commented Jul 17, 2021

/test all

@aknysh
Copy link
Member

aknysh commented Jul 19, 2021

/test all

variables.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @azec-pdx please see comments

@azec-pdx
Copy link
Contributor Author

thanks @azec-pdx please see comments

Hey @aknysh , I have addressed your comments....

@aknysh
Copy link
Member

aknysh commented Jul 21, 2021

/test all

Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @azec-pdx

@aknysh aknysh merged commit bb0955c into cloudposse:master Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants