mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 08:02:31 -05:00
Merge pull request #177 from GSA/sns-brokerpak
Provision sns via terraform in staging
This commit is contained in:
@@ -67,3 +67,18 @@ module "ses_email" {
|
|||||||
email_domain = "notify.sandbox.10x.gsa.gov"
|
email_domain = "notify.sandbox.10x.gsa.gov"
|
||||||
email_receipt_error = "notify-support@gsa.gov"
|
email_receipt_error = "notify-support@gsa.gov"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Wait for SNS is out of sandbox and spending limit is increased
|
||||||
|
# before activating this module
|
||||||
|
#########################################################################
|
||||||
|
# module "sns_sms" {
|
||||||
|
# source = "../shared/sns"
|
||||||
|
|
||||||
|
# cf_org_name = local.cf_org_name
|
||||||
|
# cf_space_name = local.cf_space_name
|
||||||
|
# name = "${local.app_name}-sns-${local.env}"
|
||||||
|
# recursive_delete = local.recursive_delete
|
||||||
|
# aws_region = "us-gov-east-1"
|
||||||
|
# monthly_spend_limit = 25
|
||||||
|
# }
|
||||||
|
|||||||
@@ -66,6 +66,21 @@ module "ses_email" {
|
|||||||
email_receipt_error = "notify-support@gsa.gov"
|
email_receipt_error = "notify-support@gsa.gov"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Wait for SNS is out of sandbox and spending limit is increased
|
||||||
|
# before activating this module
|
||||||
|
#########################################################################
|
||||||
|
# module "sns_sms" {
|
||||||
|
# source = "../shared/sns"
|
||||||
|
|
||||||
|
# cf_org_name = local.cf_org_name
|
||||||
|
# cf_space_name = local.cf_space_name
|
||||||
|
# name = "${local.app_name}-sns-${local.env}"
|
||||||
|
# recursive_delete = local.recursive_delete
|
||||||
|
# aws_region = "us-gov-west-1"
|
||||||
|
# monthly_spend_limit = 1000
|
||||||
|
# }
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# The following lines need to be commented out for the initial `terraform apply`
|
# The following lines need to be commented out for the initial `terraform apply`
|
||||||
# It can be re-enabled after:
|
# It can be re-enabled after:
|
||||||
|
|||||||
@@ -66,3 +66,18 @@ module "ses_email" {
|
|||||||
aws_region = "us-west-2"
|
aws_region = "us-west-2"
|
||||||
email_receipt_error = "notify-support@gsa.gov"
|
email_receipt_error = "notify-support@gsa.gov"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
# By default, sandbox uses the shared service instance from the
|
||||||
|
# staging space
|
||||||
|
###############################################################
|
||||||
|
# module "sns_sms" {
|
||||||
|
# source = "../shared/sns"
|
||||||
|
#
|
||||||
|
# cf_org_name = local.cf_org_name
|
||||||
|
# cf_space_name = local.cf_space_name
|
||||||
|
# name = "${local.app_name}-sns-${local.env}"
|
||||||
|
# recursive_delete = local.recursive_delete
|
||||||
|
# aws_region = "us-west-2"
|
||||||
|
# monthly_spend_limit = 1
|
||||||
|
# }
|
||||||
|
|||||||
27
terraform/shared/sns/main.tf
Normal file
27
terraform/shared/sns/main.tf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
###
|
||||||
|
# Target space/org
|
||||||
|
###
|
||||||
|
|
||||||
|
data "cloudfoundry_space" "space" {
|
||||||
|
org_name = var.cf_org_name
|
||||||
|
name = var.cf_space_name
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
# SES instance
|
||||||
|
###
|
||||||
|
|
||||||
|
data "cloudfoundry_service" "sns" {
|
||||||
|
name = "ttsnotify-sms"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "cloudfoundry_service_instance" "sns" {
|
||||||
|
name = var.name
|
||||||
|
space = data.cloudfoundry_space.space.id
|
||||||
|
service_plan = data.cloudfoundry_service.sns.service_plans["base"]
|
||||||
|
recursive_delete = var.recursive_delete
|
||||||
|
json_params = jsonencode({
|
||||||
|
region = var.aws_region
|
||||||
|
monthly_spend_limit = var.monthly_spend_limit
|
||||||
|
})
|
||||||
|
}
|
||||||
9
terraform/shared/sns/providers.tf
Normal file
9
terraform/shared/sns/providers.tf
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
terraform {
|
||||||
|
required_version = "~> 1.0"
|
||||||
|
required_providers {
|
||||||
|
cloudfoundry = {
|
||||||
|
source = "cloudfoundry-community/cloudfoundry"
|
||||||
|
version = "~> 0.15"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
terraform/shared/sns/variables.tf
Normal file
30
terraform/shared/sns/variables.tf
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
variable "cf_org_name" {
|
||||||
|
type = string
|
||||||
|
description = "cloud.gov organization name"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "cf_space_name" {
|
||||||
|
type = string
|
||||||
|
description = "cloud.gov space name (staging or prod)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "name" {
|
||||||
|
type = string
|
||||||
|
description = "name of the service instance"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "recursive_delete" {
|
||||||
|
type = bool
|
||||||
|
description = "when true, deletes service bindings attached to the resource (not recommended for production)"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "aws_region" {
|
||||||
|
type = string
|
||||||
|
description = "AWS region the SNS settings are set in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "monthly_spend_limit" {
|
||||||
|
type = number
|
||||||
|
description = "SMS budget limit in USD. Support request must be made before raising above 1"
|
||||||
|
}
|
||||||
@@ -66,3 +66,14 @@ module "ses_email" {
|
|||||||
aws_region = "us-west-2"
|
aws_region = "us-west-2"
|
||||||
email_receipt_error = "notify-support@gsa.gov"
|
email_receipt_error = "notify-support@gsa.gov"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module "sns_sms" {
|
||||||
|
source = "../shared/sns"
|
||||||
|
|
||||||
|
cf_org_name = local.cf_org_name
|
||||||
|
cf_space_name = local.cf_space_name
|
||||||
|
name = "${local.app_name}-sns-${local.env}"
|
||||||
|
recursive_delete = local.recursive_delete
|
||||||
|
aws_region = "us-west-2"
|
||||||
|
monthly_spend_limit = 25
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user