rails_template_18f 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile.lock +92 -70
  4. data/README.md +60 -63
  5. data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +3 -3
  6. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +1 -1
  7. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +1 -1
  8. data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt +1 -1
  9. data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +11 -6
  10. data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +9 -5
  11. data/lib/generators/rails_template18f/terraform/terraform_generator.rb +0 -10
  12. data/lib/rails_template18f/version.rb +1 -1
  13. data/template.rb +18 -1
  14. data/templates/Brewfile +3 -0
  15. data/templates/README.md.tt +1 -0
  16. data/templates/bin/ops/create_service_account.sh.tt +72 -0
  17. data/templates/bin/ops/destroy_service_account.sh.tt +53 -0
  18. data/{lib/generators/rails_template18f/terraform/templates/terraform → templates/bin/ops}/set_space_egress.sh.tt +1 -1
  19. data/templates/config/environments/ci.rb +1 -1
  20. data/templates/config/environments/staging.rb +1 -1
  21. data/templates/doc/compliance/TODO.md +37 -0
  22. metadata +7 -21
  23. data/lib/generators/rails_template18f/terraform/templates/terraform/create_space_deployer.sh +0 -33
  24. data/lib/generators/rails_template18f/terraform/templates/terraform/destroy_space_deployer.sh +0 -19
  25. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/main.tf.tt +0 -50
  26. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/providers.tf +0 -16
  27. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/variables.tf +0 -47
  28. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/main.tf.tt +0 -23
  29. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/providers.tf +0 -16
  30. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/database/variables.tf +0 -42
  31. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/main.tf.tt +0 -46
  32. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/providers.tf +0 -16
  33. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/variables.tf +0 -47
  34. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/main.tf.tt +0 -23
  35. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/providers.tf +0 -16
  36. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/variables.tf +0 -42
  37. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/main.tf +0 -27
  38. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/providers.tf +0 -16
  39. data/lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/variables.tf +0 -43
data/template.rb CHANGED
@@ -58,6 +58,15 @@ compliance_template_submodule = compliance_template && yes?("Clone #{compliance_
58
58
  if compliance_template_submodule
59
59
  compliance_template_repo = ask("What is the git clone address of your compliance-template fork?")
60
60
  end
61
+ if compliance_template_repo.blank?
62
+ register_announcement("OSCAL Documentation", <<~EOM)
63
+ Skipping OSCAL files as the compliance-template fork was left blank.
64
+
65
+ Re-run the oscal generator after creating your template fork to get started with OSCAL.
66
+ EOM
67
+ compliance_template = false
68
+ compliance_template_submodule = false
69
+ end
61
70
 
62
71
  terraform = yes?("Create terraform files for cloud.gov services? (y/n)")
63
72
  @cloud_gov_organization = ask("What is your cloud.gov organization name? (Leave blank to fill in later)")
@@ -141,6 +150,9 @@ end
141
150
 
142
151
  # setup pa11y and owasp scanning
143
152
  directory "bin", mode: :preserve
153
+ chmod "bin/ops/create_service_account.sh", 0o755
154
+ chmod "bin/ops/destroy_service_account.sh", 0o755
155
+ chmod "bin/ops/set_space_egress.sh", 0o755
144
156
  copy_file "pa11yci", ".pa11yci"
145
157
  copy_file "editorconfig", ".editorconfig"
146
158
  copy_file "zap.conf"
@@ -234,7 +246,7 @@ end
234
246
  # setup USWDS and asset pipeline
235
247
  copy_file "browserslistrc", ".browserslistrc" if webpack?
236
248
  after_bundle do
237
- run 'npm set-script build:css "postcss ./app/assets/stylesheets/application.postcss.scss -o ./app/assets/builds/application.css"'
249
+ run 'npm pkg set scripts.build:css="postcss ./app/assets/stylesheets/application.postcss.scss -o ./app/assets/builds/application.css"'
238
250
  # include verbose flag for dev postcss output
239
251
  gsub_file "Procfile.dev", "yarn build:css --watch", "yarn build:css --verbose --watch"
240
252
  # Replace postcss-nesting with sass since USWDS uses sass
@@ -430,6 +442,11 @@ if @circleci_pipeline
430
442
  ]
431
443
  generate "rails_template18f:circleci", *generator_arguments
432
444
  end
445
+ if cloud_gov_org_tktk?
446
+ register_announcement("CircleCI", <<~EOM)
447
+ * Fill in the cloud.gov organization information in .circleci/config.yml
448
+ EOM
449
+ end
433
450
  register_announcement("CircleCI", <<~EOM)
434
451
  * Create project environment variables for deploy users as defined in the Deployment section of the README
435
452
  EOM
data/templates/Brewfile CHANGED
@@ -7,6 +7,9 @@ brew "postgresql@12", link: true
7
7
  # used in bin/with-server script
8
8
  brew "dockerize"
9
9
 
10
+ # used in bin/ops/create_service_account.sh
11
+ brew "jq"
12
+
10
13
  # helper scripts for creating new ADRs
11
14
  brew "adr-tools"
12
15
 
@@ -15,6 +15,7 @@ guide for an introduction to the framework.
15
15
  * Install homebrew dependencies: `brew bundle`
16
16
  * [PostgreSQL](https://www.postgresql.org/)
17
17
  * [Dockerize](https://github.com/jwilder/dockerize)
18
+ * [jq](https://stedolan.github.io/jq/)
18
19
  * [ADR Tools](https://github.com/npryce/adr-tools)
19
20
  * [Chromedriver](https://sites.google.com/chromium.org/driver/)
20
21
  * Chromedriver must be allowed to run. You can either do that by:
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+
3
+ org="<%= @cloud_gov_organization %>"
4
+
5
+ usage="
6
+ $0: Create a Service User Account for a given space
7
+
8
+ Usage:
9
+ $0 -h
10
+ $0 -s <SPACE NAME> -u <USER NAME> [-r <ROLE NAME>] [-o <ORG NAME>]
11
+
12
+ Options:
13
+ -h: show help and exit
14
+ -s <SPACE NAME>: configure the space to act on. Required
15
+ -u <USER NAME>: set the service user name. Required
16
+ -r <ROLE NAME>: set the service user's role to either space-deployer or space-auditor. Default: space-deployer
17
+ -o <ORG NAME>: configure the organization to act on. Default: $org
18
+ "
19
+
20
+ set -e
21
+ set -o pipefail
22
+
23
+ space=""
24
+ service=""
25
+ role="space-deployer"
26
+
27
+ while getopts ":hs:u:r:o:" opt; do
28
+ case "$opt" in
29
+ s)
30
+ space=${OPTARG}
31
+ ;;
32
+ u)
33
+ service=${OPTARG}
34
+ ;;
35
+ r)
36
+ role=${OPTARG}
37
+ ;;
38
+ o)
39
+ org=${OPTARG}
40
+ ;;
41
+ h)
42
+ echo "$usage"
43
+ exit 0
44
+ ;;
45
+ esac
46
+ done
47
+
48
+ if [[ $space = "" || $service = "" ]]; then
49
+ echo "$usage"
50
+ exit 1
51
+ fi
52
+
53
+ cf target -o $org -s $space 1>&2
54
+
55
+ # create user account service
56
+ cf create-service cloud-gov-service-account $role $service 1>&2
57
+
58
+ # create service key
59
+ cf create-service-key $service service-account-key 1>&2
60
+
61
+ # output service key to stdout in secrets.auto.tfvars format
62
+ creds=`cf service-key $service service-account-key | tail -n 4`
63
+ username=`echo $creds | jq '.username'`
64
+ password=`echo $creds | jq '.password'`
65
+
66
+ cat << EOF
67
+ # generated with $0 -s $space -u $service -r $role -o $org
68
+ # revoke with $(dirname $0)/destroy_service_account.sh -s $space -u $service -o $org
69
+
70
+ cf_user = $username
71
+ cf_password = $password
72
+ EOF
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env bash
2
+
3
+ org="<%= @cloud_gov_organization %>"
4
+
5
+ usage="
6
+ $0: Destroy a Service User Account in a given space
7
+
8
+ Usage:
9
+ $0 -h
10
+ $0 -s <SPACE NAME> -u <USER NAME> [-o <ORG NAME>]
11
+
12
+ Options:
13
+ -h: show help and exit
14
+ -s <SPACE NAME>: configure the space to act on. Required
15
+ -u <USER NAME>: configure the service user name to destroy. Required
16
+ -o <ORG NAME>: configure the organization to act on. Default: $org
17
+ "
18
+
19
+ set -e
20
+
21
+ space=""
22
+ service=""
23
+
24
+ while getopts ":hs:u:o:" opt; do
25
+ case "$opt" in
26
+ s)
27
+ space=${OPTARG}
28
+ ;;
29
+ u)
30
+ service=${OPTARG}
31
+ ;;
32
+ o)
33
+ org=${OPTARG}
34
+ ;;
35
+ h)
36
+ echo "$usage"
37
+ exit 0
38
+ ;;
39
+ esac
40
+ done
41
+
42
+ if [[ $space = "" || $service = "" ]]; then
43
+ echo "$usage"
44
+ exit 1
45
+ fi
46
+
47
+ cf target -o $org -s $space
48
+
49
+ # destroy service key
50
+ cf delete-service-key $service service-account-key -f
51
+
52
+ # destroy service
53
+ cf delete-service $service -f
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
- org="<%= cloud_gov_organization %>"
3
+ org="<%= @cloud_gov_organization %>"
4
4
 
5
5
  usage="
6
6
  $0: Set egress rules for given space
@@ -1,4 +1,4 @@
1
- require_relative "./production"
1
+ require_relative "production"
2
2
 
3
3
  Rails.application.configure do
4
4
  config.public_file_server.enabled = true
@@ -1,4 +1,4 @@
1
- require_relative "./production"
1
+ require_relative "production"
2
2
 
3
3
  Rails.application.configure do
4
4
  # insert any staging overrides here
@@ -0,0 +1,37 @@
1
+ Compliance Tasks
2
+ ================
3
+
4
+ This file contains a list of some tasks that can make your compliance journey a bit easier.
5
+
6
+ These instructions assume that your application is being hosted on cloud.gov.
7
+
8
+ Egress Spaces
9
+ -------------
10
+
11
+ If your application requires outbound communication to services outside of cloud.gov:
12
+
13
+ 1. Set up `<env>-egress` spaces for each environment.
14
+ 1. Set that space to public egress with `bin/ops/set_space_egress.sh -s <env>-egress -p`
15
+ 1. Run [cg-egress-proxy](https://github.com/GSA/cg-egress-proxy#deploying-proxies-for-a-bunch-of-apps-automatically) in that space
16
+ 1. Send all outbound traffic from your app through the proxy
17
+ 1. Document this use under the SC-7 security control
18
+
19
+ Log Drains
20
+ ----------
21
+
22
+ Follow these directions to send your logs to an external consumer, such an S3 bucket for GSA SOC to ingest or New Relic
23
+
24
+ 1. Deploy the [logstash-shipper](https://github.com/GSA/datagov-logstack#setup) app in a management space. The management space could be its own space, or `<env>-egress`
25
+ 1. Deploy a [space-drain](https://github.com/GSA/datagov-logstack/blob/main/create-space-drain.sh) so that any app deployed to that space automatically has its logs shipped
26
+
27
+ Drift Detection
28
+ ---------------
29
+
30
+ 1. Deploy [Watchtower](https://github.com/18F/watchtower) for drift detection
31
+
32
+ Future Good Ideas
33
+ -----------------
34
+
35
+ Other things that would be useful, but without decent implementations yet:
36
+
37
+ * For RA-5, deploy a Monit sidecar buildpack to restart app if any anomalys are detected
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_template_18f
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Ahearn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-14 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -178,27 +178,9 @@ files:
178
178
  - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt
179
179
  - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/teardown_creds.sh.tt
180
180
  - lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/variables.tf
181
- - lib/generators/rails_template18f/terraform/templates/terraform/create_space_deployer.sh
182
- - lib/generators/rails_template18f/terraform/templates/terraform/destroy_space_deployer.sh
183
181
  - lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt
184
182
  - lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt
185
183
  - lib/generators/rails_template18f/terraform/templates/terraform/production/variables.tf
186
- - lib/generators/rails_template18f/terraform/templates/terraform/set_space_egress.sh.tt
187
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/main.tf.tt
188
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/providers.tf
189
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/clamav/variables.tf
190
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/database/main.tf.tt
191
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/database/providers.tf
192
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/database/variables.tf
193
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/main.tf.tt
194
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/providers.tf
195
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/domain/variables.tf
196
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/main.tf.tt
197
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/providers.tf
198
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/redis/variables.tf
199
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/main.tf
200
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/providers.tf
201
- - lib/generators/rails_template18f/terraform/templates/terraform/shared/s3/variables.tf
202
184
  - lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt
203
185
  - lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf.tt
204
186
  - lib/generators/rails_template18f/terraform/templates/terraform/staging/variables.tf
@@ -223,6 +205,9 @@ files:
223
205
  - templates/app/views/application/_demo_site_banner.html.erb
224
206
  - templates/app/views/application/_header.html.erb
225
207
  - templates/app/views/application/_usa_banner.html.erb
208
+ - templates/bin/ops/create_service_account.sh.tt
209
+ - templates/bin/ops/destroy_service_account.sh.tt
210
+ - templates/bin/ops/set_space_egress.sh.tt
226
211
  - templates/bin/owasp-scan
227
212
  - templates/bin/pa11y-scan
228
213
  - templates/bin/with-server
@@ -236,6 +221,7 @@ files:
236
221
  - templates/doc/adr/0003-security-scans.md.tt
237
222
  - templates/doc/adr/0004-rails-csp-compliant-script-tag-helpers.md.tt
238
223
  - templates/doc/compliance/README.md
224
+ - templates/doc/compliance/TODO.md
239
225
  - templates/doc/compliance/apps/application.boundary.md.tt
240
226
  - templates/doc/compliance/rendered/apps/.keep
241
227
  - templates/editorconfig
@@ -268,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
254
  - !ruby/object:Gem::Version
269
255
  version: '0'
270
256
  requirements: []
271
- rubygems_version: 3.3.7
257
+ rubygems_version: 3.5.9
272
258
  signing_key:
273
259
  specification_version: 4
274
260
  summary: Generators for creating an 18F-flavored Rails app
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
- set -o pipefail
5
-
6
- if [[ $# -lt 2 ]]; then
7
- echo "$0 <<SPACE_NAME>> <<ACCOUNT_NAME>>"
8
- exit 1;
9
- fi
10
-
11
- space=$1
12
- service=$2
13
-
14
- cf target -s $space 1>&2
15
-
16
- # create space deployer service
17
- cf create-service cloud-gov-service-account space-deployer $service 1>&2
18
-
19
- # create service key
20
- cf create-service-key $service space-deployer-key 1>&2
21
-
22
- # output service key to stdout in secrets.auto.tfvars format
23
- creds=`cf service-key $service space-deployer-key | tail -n 4`
24
- username=`echo $creds | jq '.username'`
25
- password=`echo $creds | jq '.password'`
26
-
27
- cat << EOF
28
- # generated with $0 $space $service
29
- # revoke with $(dirname $0)/destroy_space_deployer.sh $space $service
30
-
31
- cf_user = $username
32
- cf_password = $password
33
- EOF
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- if [[ $# -ne 2 ]]; then
6
- echo "$0 <<SPACE_NAME>> <<ACCOUNT_NAME>>"
7
- exit 1;
8
- fi
9
-
10
- space=$1
11
- service=$2
12
-
13
- cf target -s $space
14
-
15
- # destroy service key
16
- cf delete-service-key $service space-deployer-key -f
17
-
18
- # destroy service
19
- cf delete-service $service -f
@@ -1,50 +0,0 @@
1
- ###
2
- # Target space/org
3
- ###
4
-
5
- data "cloudfoundry_space" "space" {
6
- org_name = var.cf_org_name
7
- name = var.cf_space_name
8
- }
9
-
10
- data "cloudfoundry_domain" "internal" {
11
- name = "apps.internal"
12
- }
13
-
14
- data "cloudfoundry_app" "app" {
15
- name_or_id = "<%= app_name %>-${var.env}"
16
- space = data.cloudfoundry_space.space.id
17
- }
18
-
19
- ###
20
- # ClamAV API app
21
- ###
22
-
23
- resource "cloudfoundry_route" "clamav_route" {
24
- space = data.cloudfoundry_space.space.id
25
- domain = data.cloudfoundry_domain.internal.id
26
- hostname = "<%= app_name %>-clamapi-${var.env}"
27
- }
28
-
29
- resource "cloudfoundry_app" "clamav_api" {
30
- name = "<%= app_name %>-clamav-api-${var.env}"
31
- space = data.cloudfoundry_space.space.id
32
- memory = var.clamav_memory
33
- disk_quota = 2048
34
- timeout = 600
35
- docker_image = var.clamav_image
36
- routes {
37
- route = cloudfoundry_route.clamav_route.id
38
- }
39
- environment = {
40
- MAX_FILE_SIZE = var.max_file_size
41
- }
42
- }
43
-
44
- resource "cloudfoundry_network_policy" "clamav_routing" {
45
- policy {
46
- source_app = data.cloudfoundry_app.app.id
47
- destination_app = cloudfoundry_app.clamav_api.id
48
- port = "9443"
49
- }
50
- }
@@ -1,16 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.15.0"
7
- }
8
- }
9
- }
10
-
11
- provider "cloudfoundry" {
12
- api_url = var.cf_api_url
13
- user = var.cf_user
14
- password = var.cf_password
15
- app_logs_max = 30
16
- }
@@ -1,47 +0,0 @@
1
- variable "cf_api_url" {
2
- type = string
3
- description = "cloud.gov api url"
4
- default = "https://api.fr.cloud.gov"
5
- }
6
-
7
- variable "cf_user" {
8
- type = string
9
- description = "cloud.gov deployer account user"
10
- }
11
-
12
- variable "cf_password" {
13
- type = string
14
- description = "secret; cloud.gov deployer account password"
15
- sensitive = true
16
- }
17
-
18
- variable "cf_org_name" {
19
- type = string
20
- description = "cloud.gov organization name"
21
- }
22
-
23
- variable "cf_space_name" {
24
- type = string
25
- description = "cloud.gov space name (staging or prod)"
26
- }
27
-
28
- variable "env" {
29
- type = string
30
- description = "deployment environment (staging, production)"
31
- }
32
-
33
- variable "clamav_image" {
34
- type = string
35
- description = "Docker image to deploy the clamav api app"
36
- }
37
-
38
- variable "clamav_memory" {
39
- type = number
40
- description = "Memory in MB to allocate to clamav app"
41
- default = 3072
42
- }
43
-
44
- variable "max_file_size" {
45
- type = string
46
- description = "Maximum file size the API will accept for scanning"
47
- }
@@ -1,23 +0,0 @@
1
- ###
2
- # Target space/org
3
- ###
4
-
5
- data "cloudfoundry_space" "space" {
6
- org_name = var.cf_org_name
7
- name = var.cf_space_name
8
- }
9
-
10
- ###
11
- # RDS instance
12
- ###
13
-
14
- data "cloudfoundry_service" "rds" {
15
- name = "aws-rds"
16
- }
17
-
18
- resource "cloudfoundry_service_instance" "rds" {
19
- name = "<%= app_name %>-rds-${var.env}"
20
- space = data.cloudfoundry_space.space.id
21
- service_plan = data.cloudfoundry_service.rds.service_plans[var.rds_plan_name]
22
- recursive_delete = var.recursive_delete
23
- }
@@ -1,16 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.15.0"
7
- }
8
- }
9
- }
10
-
11
- provider "cloudfoundry" {
12
- api_url = var.cf_api_url
13
- user = var.cf_user
14
- password = var.cf_password
15
- app_logs_max = 30
16
- }
@@ -1,42 +0,0 @@
1
- variable "cf_api_url" {
2
- type = string
3
- description = "cloud.gov api url"
4
- default = "https://api.fr.cloud.gov"
5
- }
6
-
7
- variable "cf_user" {
8
- type = string
9
- description = "cloud.gov deployer account user"
10
- }
11
-
12
- variable "cf_password" {
13
- type = string
14
- description = "secret; cloud.gov deployer account password"
15
- sensitive = true
16
- }
17
-
18
- variable "cf_org_name" {
19
- type = string
20
- description = "cloud.gov organization name"
21
- }
22
-
23
- variable "cf_space_name" {
24
- type = string
25
- description = "cloud.gov space name (staging or prod)"
26
- }
27
-
28
- variable "env" {
29
- type = string
30
- description = "deployment environment (staging, production)"
31
- }
32
-
33
- variable "recursive_delete" {
34
- type = bool
35
- description = "when true, deletes service bindings attached to the resource (not recommended for production)"
36
- default = false
37
- }
38
-
39
- variable "rds_plan_name" {
40
- type = string
41
- description = "name of the service plan name to create"
42
- }
@@ -1,46 +0,0 @@
1
- ###
2
- # Target space/org
3
- ###
4
-
5
- data "cloudfoundry_space" "space" {
6
- org_name = var.cf_org_name
7
- name = var.cf_space_name
8
- }
9
-
10
- ###
11
- # Route mapping and CDN instance
12
- ###
13
-
14
- data "cloudfoundry_app" "app" {
15
- name_or_id = "<%= app_name %>-${var.env}"
16
- space = data.cloudfoundry_space.space.id
17
- }
18
-
19
- ###########################################################################
20
- # Route must be manually created by an OrgManager before terraform is run:
21
- #
22
- # cf create-domain <%= cloud_gov_organization %> TKTK-production-domain-name
23
- ###########################################################################
24
- data "cloudfoundry_domain" "origin_url" {
25
- name = var.domain_name
26
- }
27
-
28
- resource "cloudfoundry_route" "origin_route" {
29
- domain = data.cloudfoundry_domain.origin_url.id
30
- space = data.cloudfoundry_space.space.id
31
- target {
32
- app = data.cloudfoundry_app.app.id
33
- }
34
- }
35
-
36
- data "cloudfoundry_service" "external_domain" {
37
- name = "external-domain"
38
- }
39
-
40
- resource "cloudfoundry_service_instance" "external_domain_instance" {
41
- name = "<%= app_name %>-domain-${var.env}"
42
- space = data.cloudfoundry_space.space.id
43
- service_plan = data.cloudfoundry_service.external_domain.service_plans[var.cdn_plan_name]
44
- recursive_delete = var.recursive_delete
45
- json_params = "{\"domains\": \"${var.domain_name}\"}"
46
- }
@@ -1,16 +0,0 @@
1
- terraform {
2
- required_version = "~> 1.0"
3
- required_providers {
4
- cloudfoundry = {
5
- source = "cloudfoundry-community/cloudfoundry"
6
- version = "0.15.0"
7
- }
8
- }
9
- }
10
-
11
- provider "cloudfoundry" {
12
- api_url = var.cf_api_url
13
- user = var.cf_user
14
- password = var.cf_password
15
- app_logs_max = 30
16
- }