Skip to content

Commit

Permalink
Terraform: Create S3 bucket for doc upload (#72)
Browse files Browse the repository at this point in the history
* add service instance

* add binding

* correct service binding

* add bucket to sand, stag, prod

* take out rds bind

Co-authored-by: Sarah-Jaine Szekeresh <[email protected]>
  • Loading branch information
SarahJaine and SarahJaine authored Nov 23, 2020
1 parent 02071b8 commit 5f5fc52
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ parameters:
default: "main"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "sj-bind-rds"
default: "sj-tf-s3-init"
type: string
jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions deployment_config/dev_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ NODE_ENV: production
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-dev.app.cloud.gov
rds_instance: ttahub-dev
s3_doc_upload_bucket: ttahub-document-upload-dev
SESSION_SECRET: ((SESSION_SECRET))
TTA_SMART_HUB_URI: https://tta-smarthub-dev.app.cloud.gov
1 change: 1 addition & 0 deletions deployment_config/prod_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ NODE_ENV: production
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-prod.app.cloud.gov
rds_instance: ttahub-prod
s3_doc_upload_bucket: ttahub-document-upload-prod
SESSION_SECRET: ((SESSION_SECRET))
TTA_SMART_HUB_URI: https://tta-smarthub-prod.app.cloud.gov
1 change: 1 addition & 0 deletions deployment_config/sandbox_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ NODE_ENV: production
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-sandbox.app.cloud.gov
rds_instance: ttahub-sandbox
s3_doc_upload_bucket: ttahub-document-upload-sandbox
SESSION_SECRET: ((SESSION_SECRET))
TTA_SMART_HUB_URI: https://tta-smarthub-sandbox.app.cloud.gov
1 change: 1 addition & 0 deletions deployment_config/staging_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ NODE_ENV: production
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-staging.app.cloud.gov
rds_instance: ttahub-staging
s3_doc_upload_bucket: ttahub-document-upload-staging
SESSION_SECRET: ((SESSION_SECRET))
TTA_SMART_HUB_URI: https://tta-smarthub-staging.app.cloud.gov
3 changes: 2 additions & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ applications:
NODE_ENV: ((NODE_ENV))
# Soon to be removed in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: ((REDIRECT_URI_HOST))
TTA_SMART_HUB_URI: ((TTA_SMART_HUB_URI))
SESSION_SECRET: ((SESSION_SECRET))
TTA_SMART_HUB_URI: ((TTA_SMART_HUB_URI))
services:
- ((rds_instance))
- ((s3_doc_upload_bucket))
14 changes: 14 additions & 0 deletions terraform/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ resource "cloudfoundry_service_instance" "database" {
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.rds.service_plans["micro-psql"]
}

###
# S3 bucket
###

data "cloudfoundry_service" "s3" {
name = "s3"
}

resource "cloudfoundry_service_instance" "document_upload_bucket" {
name = "ttahub-document-upload-${var.env}"
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.s3.service_plans["basic"]
}
14 changes: 14 additions & 0 deletions terraform/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ resource "cloudfoundry_service_instance" "database" {
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.rds.service_plans["small-psql"]
}

###
# S3 bucket
###

data "cloudfoundry_service" "s3" {
name = "s3"
}

resource "cloudfoundry_service_instance" "document_upload_bucket" {
name = "ttahub-document-upload-${var.env}"
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.s3.service_plans["basic"]
}
14 changes: 14 additions & 0 deletions terraform/sandbox/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ resource "cloudfoundry_service_instance" "database" {
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.rds.service_plans["micro-psql"]
}

###
# S3 bucket
###

data "cloudfoundry_service" "s3" {
name = "s3"
}

resource "cloudfoundry_service_instance" "document_upload_bucket" {
name = "ttahub-document-upload-${var.env}"
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.s3.service_plans["basic"]
}
14 changes: 14 additions & 0 deletions terraform/staging/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,17 @@ resource "cloudfoundry_service_instance" "database" {
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.rds.service_plans["micro-psql"]
}

###
# S3 bucket
###

data "cloudfoundry_service" "s3" {
name = "s3"
}

resource "cloudfoundry_service_instance" "document_upload_bucket" {
name = "ttahub-document-upload-${var.env}"
space = data.cloudfoundry_space.space.id
service_plan = data.cloudfoundry_service.s3.service_plans["basic"]
}

0 comments on commit 5f5fc52

Please sign in to comment.