This repository contains a Terraform module that provisions an AWS SNS Platform Application specifically configured for Firebase Cloud Messaging (FCM). The module leverages AWS SNS's support for Google Cloud Messaging (GCM) to enable push notifications via FCM.
SNS Platform Application for FCM: Creates an SNS Platform Application using the required platform_application_name, platform (set to "GCM" for FCM), and platform_credential (the FCM API key).
- Optional Event Notifications: Supports configuration of event notification topics using the following optional parameters:
- event_endpoint_created_topic_arn
- event_endpoint_deleted_topic_arn
- event_endpoint_updated_topic_arn
Allows you to create an SNS Topic with customizable topic_name and topic_display_name.
- Optional SNS Topic Policy and Data Protection Policy: You can attach a fully formed JSON policy to the SNS Topic and define a data protection policy if needed.
- Optional SNS Topic Subscription: Supports subscribing an endpoint (such as an email, HTTP endpoint, or Lambda function) to the SNS Topic with configurable protocol and endpoint.
- Optional SMS Preferences: Enables the configuration of SMS preferences at the account level (e.g., setting the default sender ID, SMS type, and monthly spend limit).
Configure the module by passing in the required variables (such as your FCM API key) along with any optional parameters. The module is designed to be integrated into a larger infrastructure-as-code setup and can be deployed using tools like Terragrunt for multi-environment management.
Name | Version |
---|---|
terraform | > 1.1.7 |
aws | ~> 4.67.0 |
Name | Version |
---|---|
aws | ~> 4.67.0 |
No modules.
Name | Type |
---|---|
aws_iam_role.sns_logging | resource |
aws_iam_role_policy_attachment.sns_logging_attachment | resource |
aws_sns_platform_application.fcm | resource |
aws_sns_sms_preferences.this | resource |
aws_sns_topic.this | resource |
aws_sns_topic_data_protection_policy.this | resource |
aws_sns_topic_policy.this | resource |
aws_sns_topic_subscription.this | resource |
aws_caller_identity.current | data source |
aws_partition.current | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
additional_platform_attributes | Map of additional attributes for the platform application (e.g., for delivery status tracking or other special parameters). | map(string) |
{} |
no |
create_platform_application | Determines if the Platform Application for FCM should be created. | bool |
true |
no |
create_sms_preferences | Determines if SMS preferences are configured at the account level. | bool |
false |
no |
create_topic | Determines if an additional SNS Topic should be created. | bool |
false |
no |
create_topic_data_protection_policy | Determines if a data protection policy for the SNS Topic should be created. | bool |
false |
no |
create_topic_policy | Determines if a policy for the SNS Topic should be created. | bool |
false |
no |
create_topic_subscription | Determines if a subscription to the SNS Topic should be created. | bool |
false |
no |
enable_delivery_status_logging | Enables the creation of the IAM role for SNS feedback logging. | bool |
false |
no |
event_endpoint_created_topic_arn | ARN of the SNS Topic for endpoint creation notifications (optional). | string |
"" |
no |
event_endpoint_deleted_topic_arn | ARN of the SNS Topic for endpoint deletion notifications (optional). | string |
"" |
no |
event_endpoint_updated_topic_arn | ARN of the SNS Topic for endpoint update notifications (optional). | string |
"" |
no |
fcm_credentials_json | JSON file content with FCM connection secrets; used instead of fcm_api_key if provided. | string |
"" |
no |
http_failure_feedback_role_arn | IAM role ARN for HTTP/HTTPS failure feedback logging. | string |
"" |
no |
http_success_feedback_role_arn | IAM role ARN for HTTP/HTTPS success feedback logging. | string |
"" |
no |
http_success_feedback_sample_rate | Percentage (0-100) of successful HTTP/HTTPS deliveries to log. | number |
null |
no |
lambda_failure_feedback_role_arn | IAM role ARN for Lambda failure feedback logging. | string |
"" |
no |
lambda_success_feedback_role_arn | IAM role ARN for Lambda success feedback logging. | string |
"" |
no |
lambda_success_feedback_sample_rate | Percentage (0-100) of successful Lambda deliveries to log. | number |
null |
no |
platform | Platform for the application; use 'GCM' for FCM. | string |
"GCM" |
no |
platform_application_name | Name for the SNS application (Platform Application). | string |
n/a | yes |
sms_default_sender_id | Default sender ID for SMS. | string |
"" |
no |
sms_default_sms_type | Default SMS type; can be 'Promotional' or 'Transactional'. | string |
"" |
no |
sms_monthly_spend_limit | Monthly spending limit for SMS (in USD, as a string). | string |
"" |
no |
subscription_endpoint | Endpoint for the SNS Topic subscription (email, URL, Lambda ARN, etc.). | string |
"" |
no |
subscription_protocol | Protocol for the SNS Topic subscription (e.g., email, https, lambda). | string |
"" |
no |
tags | Map of tags for resources. | map(string) |
{} |
no |
topic_data_protection_policy | Data protection policy in JSON format for the SNS Topic. | string |
"" |
no |
topic_display_name | Display name of the SNS Topic. | string |
"" |
no |
topic_name | Name of the SNS Topic. | string |
"" |
no |
topic_policy | Policy in JSON format for the SNS Topic. | string |
"" |
no |
Name | Description |
---|---|
logging_role_arn | ARN of the IAM role for SNS logging, if enabled. |
platform_application_arn | ARN of the SNS platform application for FCM. |
sms_preferences | SMS preferences configuration (if set). |
topic_arn | ARN of the SNS topic (if created). |
topic_policy_id | ID of the SNS topic policy (if created). |