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

Allow passing of a new variable aws_sns_topic_arn and not create an SNS topic #35

Closed
wants to merge 1 commit into from

Conversation

bogdanbarna
Copy link

what

  • Add variable aws_sns_topic_arn
  • This extends the current module, allowing users to pass the ARN of an existing SNS topic
  • The locals block in main.tf handles the logic of whether to create aws_sns_topic.default.

why

  • Some teams use one SNS topic for multiple CloudWatch alarms

references

Closes #34.

@bogdanbarna bogdanbarna requested review from a team as code owners July 12, 2021 15:47
@bogdanbarna bogdanbarna requested review from florian0410 and brcnblc and removed request for a team July 12, 2021 15:47
Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

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

Bridgecrew has found 1 infrastructure configuration error in this PR ⬇️

create_sns_topic = var.aws_sns_topic_arn == ""
aws_sns_topic_arn = local.create_sns_topic ? aws_sns_topic.default.*.arn : [var.aws_sns_topic_arn]
}

resource "aws_sns_topic" "default" {
Copy link

@bridgecrew bridgecrew bot Jul 12, 2021

Choose a reason for hiding this comment

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

MEDIUM   Ensure all data stored in the SNS topic is encrypted
    Resource: aws_sns_topic.default | ID: BC_AWS_GENERAL_15

How to Fix

resource "aws_sns_topic" "user_updates" {
  name              = "user-updates-topic"
+ kms_master_key_id = "alias/aws/sns"
}

Description

Amazon SNS is a publishers and subscribers messaging service. When you publish messages to encrypted topics, customer master keys (CMK), powered by AWS KMS, can be used to encrypt your messages.

If you operate in a regulated market, such as HIPAA for healthcare, PCI DSS for finance, or FedRAMP for government, you need to ensure sensitive data messages passed in this service are encrypted at rest.

Benchmarks

  • PCI-DSS V3.2 3
  • FEDRAMP (MODERATE) SC-28
Dependent Resources

Path Resource Connecting Attribute
/alarms.tf aws_cloudwatch_metric_alarm.burst_balance_too_low ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.cpu_utilization_too_high ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.cpu_credit_balance_too_low ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.disk_queue_depth_too_high ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.freeable_memory_too_low ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.free_storage_space_too_low ok_actions
/alarms.tf aws_cloudwatch_metric_alarm.swap_usage_too_high ok_actions
/main.tf aws_db_event_subscription.default sns_topic
/main.tf aws_sns_topic_policy.default arn

Copy link
Author

Choose a reason for hiding this comment

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

This seems like an underlying issue.

@bogdanbarna
Copy link
Author

Closing this for #36, I couldn't change the fork branch on this existing PR.

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.

Allow to not generate a new SNS topic
1 participant