Provision sns via terraform in staging

This commit is contained in:
Ryan Ahearn
2023-02-09 16:23:37 -05:00
parent 573c028988
commit 52e6d25b13
7 changed files with 123 additions and 0 deletions

View 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
})
}

View File

@@ -0,0 +1,9 @@
terraform {
required_version = "~> 1.0"
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "~> 0.15"
}
}
}

View 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"
}