marcus-bcl / cloud-platform-terraform-sns-topic

Cloud Platform SNS terraform module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cloud-platform-terraform-sns-topic

Releases

Terraform module that will create an SNS Topic in AWS, along with an IAM User to access it.

Usage

module "example_sns_topic" {
  source = "github.com/ministryofjustice/cloud-platform-terraform-sns?ref=version"

  team_name          = "example-team"
  topic_display_name = "example-topic-display-name"
  
  providers = {
    aws = aws.london
  }
}

SQS Subscription

For an SQS queue defined in the same namespace's /resources, a subscription can be added with a syntax like

resource "aws_sns_topic_subscription" "example-queue-subscription" {
  provider      = "aws.london"
  topic_arn     = "${module.example_sns_topic.topic_arn}"
  protocol      = "sqs"
  endpoint      = "${module.example_sqs.sqs_arn}"
  filter_policy = "{\"field_name\": [\"string_pattern\", \"string_pattern\", \"...\"]}"
}

Requirements

Name Version
terraform >= 0.14
aws >= 4.27.0
random >= 2.0.0

Providers

Name Version
aws >= 4.27.0
random >= 2.0.0

Modules

No modules.

Resources

Name Type
aws_iam_access_key.user resource
aws_iam_user.user resource
aws_iam_user_policy.policy resource
aws_kms_alias.alias resource
aws_kms_key.kms resource
aws_sns_topic.new_topic resource
random_id.id resource
aws_caller_identity.current data source
aws_iam_policy_document.policy data source

Inputs

Name Description Type Default Required
application Application name string n/a yes
business_unit Area of the MOJ responsible for the service string n/a yes
encrypt_sns_kms If set to true, this will create aws_kms_key and aws_kms_alias resources and add kms_master_key_id in aws_sns_topic resource bool false no
environment_name Environment name string n/a yes
infrastructure_support The team responsible for managing the infrastructure. Should be of the form () string n/a yes
is_production Whether the environment is production or not string "false" no
namespace Namespace name string n/a yes
team_name Team name string n/a yes
topic_display_name The display name of your SNS Topic. MUST BE UNDER 10 CHARS string n/a yes

Outputs

Name Description
access_key_id The access key ID
secret_access_key The secret access key ID
topic_arn ARN for the topic
topic_name ARN for the topic
user_name IAM user with access to the topic

About

Cloud Platform SNS terraform module

License:MIT License


Languages

Language:HCL 93.2%Language:Go 6.8%