Skip to content

Commit

Permalink
Merge pull request #893 from GSA/revert-rest-of-terraform
Browse files Browse the repository at this point in the history
Revert the rest of our Terraform changes
  • Loading branch information
stvnrlly authored Apr 3, 2024
2 parents ecbe736 + af877ca commit 69c4066
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 65 deletions.
2 changes: 1 addition & 1 deletion terraform/bootstrap/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions terraform/development/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
locals {
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-local-dev"
key_name = "${var.username}-api-dev-key"
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-local-dev"
recursive_delete = true
key_name = "${var.username}-api-dev-key"
}

module "csv_upload_bucket" {
source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${var.username}-csv-upload-bucket"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
recursive_delete = local.recursive_delete
name = "${var.username}-csv-upload-bucket"
}
resource "cloudfoundry_service_key" "csv_key" {
name = local.key_name
Expand Down
2 changes: 1 addition & 1 deletion terraform/development/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}
}
Expand Down
36 changes: 21 additions & 15 deletions terraform/sandbox/main.tf
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
locals {
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-sandbox"
env = "sandbox"
app_name = "notify-api"
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-sandbox"
env = "sandbox"
app_name = "notify-api"
recursive_delete = true
}

module "database" {
source = "github.com/18f/terraform-cloudgov//database?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-rds-${local.env}"
rds_plan_name = "micro-psql"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-rds-${local.env}"
recursive_delete = local.recursive_delete
rds_plan_name = "micro-psql"
}

module "redis" {
source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-redis-${local.env}"
redis_plan_name = "redis-dev"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-redis-${local.env}"
recursive_delete = local.recursive_delete
redis_plan_name = "redis-dev"
}

module "csv_upload_bucket" {
source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-csv-upload-bucket-${local.env}"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
recursive_delete = local.recursive_delete
name = "${local.app_name}-csv-upload-bucket-${local.env}"
}

module "egress-space" {
Expand All @@ -49,6 +53,7 @@ module "ses_email" {
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-ses-${local.env}"
recursive_delete = local.recursive_delete
aws_region = "us-west-2"
email_receipt_error = "notify-support@gsa.gov"
}
Expand All @@ -59,6 +64,7 @@ module "sns_sms" {
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-east-2"
monthly_spend_limit = 1
}
2 changes: 1 addition & 1 deletion terraform/sandbox/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}

Expand Down
6 changes: 2 additions & 4 deletions terraform/shared/egress_space/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ data "cloudfoundry_org" "org" {
###

resource "cloudfoundry_space" "public_egress" {
allow_ssh = var.allow_ssh
delete_recursive_allowed = var.delete_recursive_allowed
name = "${var.cf_restricted_space_name}-egress"
org = data.cloudfoundry_org.org.id
name = "${var.cf_restricted_space_name}-egress"
org = data.cloudfoundry_org.org.id
}

###
Expand Down
2 changes: 1 addition & 1 deletion terraform/shared/egress_space/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}
}
12 changes: 0 additions & 12 deletions terraform/shared/egress_space/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,3 @@ variable "cf_restricted_space_name" {}
variable "deployers" {
type = set(string)
}

variable "delete_recursive_allowed" {
type = bool
default = true
description = "Flag for allowing resources to be recursively deleted - not recommended in production environments"
}

variable "allow_ssh" {
type = bool
default = true
description = "Flag for allowing SSH access in a space - not recommended in production environments"
}
7 changes: 4 additions & 3 deletions terraform/shared/ses/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ data "cloudfoundry_service" "ses" {
}

resource "cloudfoundry_service_instance" "ses" {
name = var.name
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.ses.service_plans["base"]
name = var.name
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.ses.service_plans["base"]
recursive_delete = var.recursive_delete
json_params = jsonencode({
region = var.aws_region
domain = var.email_domain
Expand Down
2 changes: 1 addition & 1 deletion terraform/shared/ses/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}
}
6 changes: 6 additions & 0 deletions terraform/shared/ses/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ variable "name" {
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 SES instance is in"
Expand Down
7 changes: 4 additions & 3 deletions terraform/shared/sns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ data "cloudfoundry_service" "sns" {
}

resource "cloudfoundry_service_instance" "sns" {
name = var.name
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.sns.service_plans["base"]
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
Expand Down
2 changes: 1 addition & 1 deletion terraform/shared/sns/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}
}
6 changes: 6 additions & 0 deletions terraform/shared/sns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ variable "name" {
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"
Expand Down
36 changes: 21 additions & 15 deletions terraform/staging/main.tf
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
locals {
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-staging"
env = "staging"
app_name = "notify-api"
cf_org_name = "gsa-tts-benefits-studio"
cf_space_name = "notify-staging"
env = "staging"
app_name = "notify-api"
recursive_delete = true
}

module "database" {
source = "github.com/18f/terraform-cloudgov//database?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-rds-${local.env}"
rds_plan_name = "micro-psql"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-rds-${local.env}"
recursive_delete = local.recursive_delete
rds_plan_name = "micro-psql"
}

module "redis" {
source = "github.com/18f/terraform-cloudgov//redis?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-redis-${local.env}"
redis_plan_name = "redis-dev"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-redis-${local.env}"
recursive_delete = local.recursive_delete
redis_plan_name = "redis-dev"
}

module "csv_upload_bucket" {
source = "github.com/18f/terraform-cloudgov//s3?ref=v0.7.1"

cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-csv-upload-bucket-${local.env}"
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
recursive_delete = local.recursive_delete
name = "${local.app_name}-csv-upload-bucket-${local.env}"
}

module "egress-space" {
Expand All @@ -49,6 +53,7 @@ module "ses_email" {
cf_org_name = local.cf_org_name
cf_space_name = local.cf_space_name
name = "${local.app_name}-ses-${local.env}"
recursive_delete = local.recursive_delete
aws_region = "us-west-2"
mail_from_subdomain = "mail"
email_receipt_error = "notify-support@gsa.gov"
Expand All @@ -60,6 +65,7 @@ module "sns_sms" {
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
}
2 changes: 1 addition & 1 deletion terraform/staging/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
cloudfoundry = {
source = "cloudfoundry-community/cloudfoundry"
version = "0.53.1"
version = "0.53.0"
}
}

Expand Down

0 comments on commit 69c4066

Please sign in to comment.