rails_template_18f 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +6 -6
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +12 -2
- data/lib/generators/rails_template18f/cloud_gov_config/templates/app/models/cloud_gov_config.rb +9 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml +3 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml +3 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-production.yml +3 -1
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml +3 -1
- data/lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb +147 -0
- data/lib/generators/rails_template18f/gitlab_ci/templates/gitlab/node.yml.tt +11 -0
- data/lib/generators/rails_template18f/gitlab_ci/templates/gitlab/rails.yml +75 -0
- data/lib/generators/rails_template18f/gitlab_ci/templates/gitlab/ruby.yml +7 -0
- data/lib/generators/rails_template18f/gitlab_ci/templates/gitlab/terraform.yml +28 -0
- data/lib/generators/rails_template18f/gitlab_ci/templates/gitlab-ci.yml.tt +212 -0
- data/lib/generators/rails_template18f/public_egress/public_egress_generator.rb +15 -31
- data/lib/generators/rails_template18f/terraform/templates/full_bootstrap/main.tf.tt +2 -2
- data/lib/generators/rails_template18f/terraform/templates/sandbox_bootstrap/main.tf.tt +1 -1
- data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +3 -13
- data/lib/generators/rails_template18f/terraform/templates/terraform/app.tf.tt +0 -6
- data/lib/generators/rails_template18f/terraform/templates/terraform/main.tf.tt +27 -16
- data/lib/generators/rails_template18f/terraform/templates/terraform/production.tfvars.tt +3 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/providers.tf.tt +7 -21
- data/lib/generators/rails_template18f/terraform/templates/terraform/terraform.sh.tt +1 -41
- data/lib/generators/rails_template18f/terraform/templates/terraform/variables.tf.tt +8 -9
- data/lib/generators/rails_template18f/terraform/terraform_generator.rb +0 -1
- data/lib/rails_template18f/version.rb +1 -1
- data/template.rb +20 -12
- data/templates/{pa11yci.js → pa11yci.js.tt} +5 -0
- metadata +10 -10
- data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/main.tf +0 -74
- data/lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/run.sh +0 -17
@@ -41,24 +41,6 @@ EOT
|
|
41
41
|
EOT
|
42
42
|
end
|
43
43
|
|
44
|
-
def setup_terraform_provider
|
45
|
-
insert_into_file file_path("terraform/providers.tf"), after: "required_providers {\n" do
|
46
|
-
<<-EOT
|
47
|
-
cloudfoundry-community = {
|
48
|
-
source = "cloudfoundry-community/cloudfoundry"
|
49
|
-
version = "0.53.1"
|
50
|
-
}
|
51
|
-
EOT
|
52
|
-
end
|
53
|
-
append_to_file file_path("terraform/providers.tf"), <<~EOT
|
54
|
-
provider "cloudfoundry-community" {
|
55
|
-
api_url = "https://api.fr.cloud.gov"
|
56
|
-
user = var.cf_user
|
57
|
-
password = var.cf_password
|
58
|
-
}
|
59
|
-
EOT
|
60
|
-
end
|
61
|
-
|
62
44
|
def setup_proxy_vars
|
63
45
|
create_file ".profile", <<~EOP unless file_exists?(".profile")
|
64
46
|
##
|
@@ -117,18 +99,19 @@ EOB
|
|
117
99
|
<<~EOT
|
118
100
|
|
119
101
|
module "egress_space" {
|
120
|
-
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.
|
102
|
+
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.3.0"
|
121
103
|
|
122
104
|
cf_org_name = local.cf_org_name
|
123
105
|
cf_space_name = "${var.cf_space_name}-egress"
|
124
106
|
allow_ssh = var.allow_space_ssh
|
125
107
|
deployers = local.space_deployers
|
126
108
|
developers = var.space_developers
|
109
|
+
auditors = var.space_auditors
|
127
110
|
security_group_names = ["public_networks_egress"]
|
128
111
|
}
|
129
112
|
|
130
113
|
module "egress_proxy" {
|
131
|
-
source = "github.com/gsa-tts/terraform-cloudgov//egress_proxy?ref=v2.
|
114
|
+
source = "github.com/gsa-tts/terraform-cloudgov//egress_proxy?ref=v2.3.0"
|
132
115
|
|
133
116
|
cf_org_name = local.cf_org_name
|
134
117
|
cf_egress_space = module.egress_space.space
|
@@ -139,17 +122,18 @@ EOB
|
|
139
122
|
}
|
140
123
|
|
141
124
|
resource "cloudfoundry_network_policy" "egress_routing" {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
125
|
+
policies = [
|
126
|
+
{
|
127
|
+
source_app = cloudfoundry_app.app.id
|
128
|
+
destination_app = module.egress_proxy.app_id
|
129
|
+
port = module.egress_proxy.https_port
|
130
|
+
},
|
131
|
+
{
|
132
|
+
source_app = cloudfoundry_app.app.id
|
133
|
+
destination_app = module.egress_proxy.app_id
|
134
|
+
port = module.egress_proxy.http_port
|
135
|
+
}
|
136
|
+
]
|
153
137
|
}
|
154
138
|
|
155
139
|
resource "cloudfoundry_service_instance" "egress_proxy_credentials" {
|
@@ -36,7 +36,7 @@ locals {
|
|
36
36
|
s3_plan_name = "basic"
|
37
37
|
}
|
38
38
|
module "mgmt_space" {
|
39
|
-
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.
|
39
|
+
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.3.0"
|
40
40
|
|
41
41
|
cf_org_name = local.org_name
|
42
42
|
cf_space_name = var.mgmt_space_name
|
@@ -44,7 +44,7 @@ module "mgmt_space" {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
module "s3" {
|
47
|
-
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.
|
47
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.3.0"
|
48
48
|
|
49
49
|
cf_space_id = module.mgmt_space.space_id
|
50
50
|
name = "<%= app_name %>-terraform-state"
|
@@ -30,7 +30,7 @@ data "cloudfoundry_space" "space" {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
module "s3" {
|
33
|
-
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.
|
33
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.3.0"
|
34
34
|
|
35
35
|
cf_space_id = data.cloudfoundry_space.space.id
|
36
36
|
name = "<%= app_name %>-terraform-state"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# Terraform
|
2
2
|
|
3
3
|
This directory holds the terraform module for maintaining the system infrastructure and deploying the application.
|
4
|
-
|
5
4
|
<% unless terraform_manage_spaces? %>
|
6
5
|
## READ ME FIRST
|
7
6
|
|
@@ -16,7 +15,6 @@ bin/rails generate rails_template18f:terraform --cg-org=<ORG_NAME> --cg-staging=
|
|
16
15
|
|
17
16
|
…to take full advantage of the generator, and then re-run your CI generator of choice to add production terraform plan and apply steps to your workflow.
|
18
17
|
<% end %>
|
19
|
-
|
20
18
|
## Terraform State Credentials
|
21
19
|
|
22
20
|
The `bootstrap` module is used to create an s3 bucket for later terraform runs to store their state in as well as
|
@@ -52,7 +50,8 @@ These steps only need to be run once per project.
|
|
52
50
|
|
53
51
|
### Steps:
|
54
52
|
|
55
|
-
<% if terraform_manage_spaces? %>1. Create a new `sandbox-<NAME>.tfvars` file to hold variable values for your environment. A good starting point is copying `staging.tfvars` and editing it with your values
|
53
|
+
<% if terraform_manage_spaces? %>1. Create a new `sandbox-<NAME>.tfvars` file to hold variable values for your environment. A good starting point is copying `staging.tfvars` and editing it with your values
|
54
|
+
1. Add a `cf_user = "your.email@agency.gov"` line to the `sandbox-<NAME>.tfvars` file<% end %>
|
56
55
|
|
57
56
|
1. Run terraform plan with:
|
58
57
|
```bash
|
@@ -81,12 +80,7 @@ These steps only need to be run once per project.
|
|
81
80
|
| |- templates/
|
82
81
|
| |- backend_config.tftpl
|
83
82
|
| |- bot_secrets.tftpl
|
84
|
-
| |- imports.tf.tftpl
|
85
|
-
|- sandbox_bot/
|
86
|
-
| |- main.tf
|
87
|
-
| |- run.sh
|
88
|
-
| |- <sandbox_name>/ (automatically generated)
|
89
|
-
| |- terraform.tfstate(.backup) (automatically generated)<% end %>
|
83
|
+
| |- imports.tf.tftpl
|
90
84
|
|- dist/
|
91
85
|
| |- src.zip (automatically generated)
|
92
86
|
|- README.md
|
@@ -111,7 +105,3 @@ In the bootstrap module:
|
|
111
105
|
- `apply.sh` Helper script to either recreate the state locally or call `terraform apply` Any arguments are passed through to the `apply` call
|
112
106
|
- `imports.tf` import blocks to create a new local state file when new developers need to access the state file. This file is automatically generated by calling `./apply.sh` and should be checked into git on any changes
|
113
107
|
- `users.auto.tfvars` this file defines the list of cloud.gov accounts that should have access to the terraform state bucket
|
114
|
-
|
115
|
-
In the sandbox_bot module:
|
116
|
-
- `main.tf` sets up a cloud.gov SpaceDeployer to manage the sandbox environment and outputs its credentials into the main module `secrets.auto.tfvars`
|
117
|
-
- `run.sh` Helper script to set up a separate local state file for each sandbox name. In normal use this will only ever be called by `./terraform.sh`
|
@@ -14,11 +14,6 @@ data "archive_file" "src" {
|
|
14
14
|
]
|
15
15
|
}
|
16
16
|
|
17
|
-
locals {
|
18
|
-
host_name = coalesce(var.host_name, "${local.app_name}-${var.env}")
|
19
|
-
domain = coalesce(var.custom_domain_name, "app.cloud.gov")
|
20
|
-
}
|
21
|
-
|
22
17
|
resource "cloudfoundry_app" "app" {
|
23
18
|
name = "${local.app_name}-${var.env}"
|
24
19
|
space_name = var.cf_space_name
|
@@ -28,7 +23,6 @@ resource "cloudfoundry_app" "app" {
|
|
28
23
|
source_code_hash = data.archive_file.src.output_base64sha256
|
29
24
|
buildpacks = ["ruby_buildpack"]
|
30
25
|
strategy = "rolling"
|
31
|
-
routes = [{ route = "${local.host_name}.${local.domain}" }]
|
32
26
|
|
33
27
|
environment = {
|
34
28
|
RAILS_ENV = var.env
|
@@ -3,16 +3,16 @@ locals {
|
|
3
3
|
app_name = "<%= app_name %>"
|
4
4
|
space_deployers = setunion([var.cf_user], var.space_deployers)
|
5
5
|
}
|
6
|
-
|
7
6
|
<% if terraform_manage_spaces? %>
|
8
7
|
module "app_space" {
|
9
|
-
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.
|
8
|
+
source = "github.com/gsa-tts/terraform-cloudgov//cg_space?ref=v2.3.0"
|
10
9
|
|
11
10
|
cf_org_name = local.cf_org_name
|
12
11
|
cf_space_name = var.cf_space_name
|
13
12
|
allow_ssh = var.allow_space_ssh
|
14
13
|
deployers = local.space_deployers
|
15
14
|
developers = var.space_developers
|
15
|
+
auditors = var.space_auditors
|
16
16
|
security_group_names = ["trusted_local_networks_egress"]
|
17
17
|
}
|
18
18
|
<% else %>
|
@@ -31,9 +31,8 @@ resource "cloudfoundry_security_group_space_bindings" "trusted_egress_binding" {
|
|
31
31
|
running_spaces = [data.cloudfoundry_space.app_space.id]
|
32
32
|
}
|
33
33
|
<% end %>
|
34
|
-
|
35
34
|
module "database" {
|
36
|
-
source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v2.
|
35
|
+
source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v2.3.0"
|
37
36
|
|
38
37
|
cf_space_id = <% if terraform_manage_spaces? %>module.app_space.space_id<% else %>data.cloudfoundry_space.app_space.id<% end %>
|
39
38
|
name = "${local.app_name}-rds-${var.env}"
|
@@ -43,7 +42,7 @@ module "database" {
|
|
43
42
|
}
|
44
43
|
<% if has_active_job? %>
|
45
44
|
module "redis" {
|
46
|
-
source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v2.
|
45
|
+
source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v2.3.0"
|
47
46
|
|
48
47
|
cf_space_id = <% if terraform_manage_spaces? %>module.app_space.space_id<% else %>data.cloudfoundry_space.app_space.id<% end %>
|
49
48
|
name = "${local.app_name}-redis-${var.env}"
|
@@ -51,10 +50,9 @@ module "redis" {
|
|
51
50
|
# depends_on line is required only for initial creation and destruction. It can be commented out for updates if you see unwanted cascading effects
|
52
51
|
depends_on = [module.app_space]<% end %>
|
53
52
|
}
|
54
|
-
<% end %>
|
55
|
-
<% if has_active_storage? %>
|
53
|
+
<% end %><% if has_active_storage? %>
|
56
54
|
module "s3" {
|
57
|
-
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.
|
55
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v2.3.0"
|
58
56
|
|
59
57
|
cf_space_id = <% if terraform_manage_spaces? %>module.app_space.space_id<% else %>data.cloudfoundry_space.app_space.id<% end %>
|
60
58
|
name = "${local.app_name}-s3-${var.env}"
|
@@ -64,7 +62,7 @@ module "s3" {
|
|
64
62
|
}
|
65
63
|
|
66
64
|
module "clamav" {
|
67
|
-
source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v2.
|
65
|
+
source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v2.3.0"
|
68
66
|
|
69
67
|
cf_org_name = local.cf_org_name
|
70
68
|
cf_space_name = var.cf_space_name
|
@@ -76,31 +74,44 @@ module "clamav" {
|
|
76
74
|
}
|
77
75
|
|
78
76
|
resource "cloudfoundry_network_policy" "clamav_routing" {
|
79
|
-
|
80
|
-
policy {
|
77
|
+
policies = [{
|
81
78
|
source_app = cloudfoundry_app.app.id
|
82
79
|
destination_app = module.clamav.app_id
|
83
80
|
port = "61443"
|
84
|
-
}
|
81
|
+
}]
|
85
82
|
}
|
86
83
|
<% end %>
|
87
|
-
|
88
|
-
|
84
|
+
###########################################################################<% if terraform_manage_spaces? %>
|
85
|
+
# Before setting var.custom_domain_name, ensure the ACME challenge record has been created:
|
86
|
+
# See https://cloud.gov/docs/services/external-domain-service/#how-to-create-an-instance-of-this-service<% else %>
|
89
87
|
# Before setting var.custom_domain_name, perform the following steps:
|
90
88
|
# 1) Domain must be manually created by an OrgManager:
|
91
89
|
# cf create-domain var.cf_org_name var.domain_name
|
92
90
|
# 2) ACME challenge record must be created.
|
93
|
-
# See https://cloud.gov/docs/services/external-domain-service/#how-to-create-an-instance-of-this-service
|
91
|
+
# See https://cloud.gov/docs/services/external-domain-service/#how-to-create-an-instance-of-this-service<% end %>
|
94
92
|
###########################################################################
|
95
93
|
module "domain" {
|
96
94
|
count = (var.custom_domain_name == null ? 0 : 1)
|
97
|
-
source = "github.com/gsa-tts/terraform-cloudgov//domain?ref=v2.
|
95
|
+
source = "github.com/gsa-tts/terraform-cloudgov//domain?ref=v2.3.0"
|
98
96
|
|
99
97
|
cf_org_name = local.cf_org_name
|
100
98
|
cf_space = <% if terraform_manage_spaces? %>module.app_space.space<% else %>data.cloudfoundry_space.app_space<% end %>
|
101
99
|
cdn_plan_name = "domain"
|
102
100
|
domain_name = var.custom_domain_name
|
101
|
+
create_domain = <%= terraform_manage_spaces? ? "true" : "false" %>
|
102
|
+
app_ids = [cloudfoundry_app.app.id]
|
103
103
|
host_name = var.host_name<% if terraform_manage_spaces? %>
|
104
104
|
# depends_on line is required only for initial creation and destruction. It can be commented out for updates if you see unwanted cascading effects
|
105
105
|
depends_on = [module.app_space]<% end %>
|
106
106
|
}
|
107
|
+
module "app_route" {
|
108
|
+
count = (var.custom_domain_name == null ? 1 : 0)
|
109
|
+
source = "github.com/gsa-tts/terraform-cloudgov//app_route?ref=v2.3.0"
|
110
|
+
|
111
|
+
cf_org_name = local.cf_org_name
|
112
|
+
cf_space_name = var.cf_space_name
|
113
|
+
app_ids = [cloudfoundry_app.app.id]
|
114
|
+
hostname = coalesce(var.host_name, "${local.app_name}-${var.env}")<% if terraform_manage_spaces? %>
|
115
|
+
# depends_on line is required only for initial creation and destruction. It can be commented out for updates if you see unwanted cascading effects
|
116
|
+
depends_on = [module.app_space]<% end %>
|
117
|
+
}
|
@@ -8,3 +8,6 @@ web_memory = "512M"
|
|
8
8
|
<% if has_active_storage? %>s3_plan_name = "basic"<% end %>
|
9
9
|
<% if has_active_job? %>redis_plan_name = "TKTK-production-redis-plan"<% end %>
|
10
10
|
<% if has_active_job? %>worker_memory = "512M"<% end %>
|
11
|
+
space_auditors = [
|
12
|
+
# enter cloud.gov usernames that should have access to audit logs
|
13
|
+
]
|
@@ -1,32 +1,18 @@
|
|
1
1
|
terraform {
|
2
2
|
required_version = "~> 1.10"
|
3
|
-
required_providers {
|
4
|
-
cloudfoundry-community = {
|
5
|
-
source = "cloudfoundry-community/cloudfoundry"
|
6
|
-
version = "0.53.1"
|
7
|
-
}<% end %>
|
3
|
+
required_providers {
|
8
4
|
cloudfoundry = {
|
9
5
|
source = "cloudfoundry/cloudfoundry"
|
10
|
-
version = "1.
|
6
|
+
version = "1.5.0"
|
11
7
|
}
|
12
8
|
}
|
13
9
|
|
14
10
|
backend "s3" {
|
15
|
-
encrypt
|
16
|
-
use_lockfile
|
17
|
-
|
11
|
+
encrypt = true
|
12
|
+
use_lockfile = true
|
13
|
+
use_fips_endpoint = true
|
14
|
+
region = "us-gov-west-1"
|
18
15
|
}
|
19
16
|
}
|
20
17
|
|
21
|
-
provider "cloudfoundry" {
|
22
|
-
api_url = "https://api.fr.cloud.gov"
|
23
|
-
user = var.cf_user
|
24
|
-
password = var.cf_password
|
25
|
-
}
|
26
|
-
<% if has_active_storage? %>
|
27
|
-
provider "cloudfoundry-community" {
|
28
|
-
api_url = "https://api.fr.cloud.gov"
|
29
|
-
user = var.cf_user
|
30
|
-
password = var.cf_password
|
31
|
-
}
|
32
|
-
<% end %>
|
18
|
+
provider "cloudfoundry" {}
|
@@ -83,27 +83,9 @@ if [[ $tfm_needs_init = true ]]; then
|
|
83
83
|
echo "=============================================================================================================="
|
84
84
|
echo "= Recreating backend config file. It is fine if this step wants to delete any local_sensitive_file resources"
|
85
85
|
echo "=============================================================================================================="
|
86
|
-
(cd bootstrap && ./apply.sh
|
86
|
+
(cd bootstrap && ./apply.sh -auto-approve)
|
87
87
|
fi
|
88
88
|
terraform init -backend-config=secrets.backend.tfvars -backend-config="key=terraform.tfstate.$env" -reconfigure
|
89
|
-
fi
|
90
|
-
|
91
|
-
echo "=============================================================================================================="
|
92
|
-
echo "= Creating a bot deployer for $env"
|
93
|
-
echo "=============================================================================================================="
|
94
|
-
<% if terraform_manage_spaces? %>
|
95
|
-
if [[ "$env" = "staging" ]] || [[ "$env" = "production" ]]; then
|
96
|
-
(cd bootstrap && ./apply.sh -var create_bot_secrets_file=true $force)
|
97
|
-
else
|
98
|
-
(cd sandbox_bot && ./run.sh "$env" apply $force)
|
99
|
-
fi
|
100
|
-
<% else %>
|
101
|
-
if [[ ! -f secrets.auto.tfvars ]]; then
|
102
|
-
../bin/ops/create_service_account.sh -s <%= cloud_gov_staging_space %> -u terraform-deployer -n > secrets.auto.tfvars
|
103
|
-
fi
|
104
|
-
<% end %>
|
105
|
-
|
106
|
-
if [[ -f secrets.backend.tfvars ]]; then
|
107
89
|
rm secrets.backend.tfvars
|
108
90
|
fi
|
109
91
|
|
@@ -111,25 +93,3 @@ echo "==========================================================================
|
|
111
93
|
echo "= Calling $cmd $force on the application infrastructure"
|
112
94
|
echo "=============================================================================================================="
|
113
95
|
terraform "$cmd" -var-file="$env.tfvars" -var rails_master_key="$rmk" $force "$@"
|
114
|
-
|
115
|
-
<% if terraform_manage_spaces? %>
|
116
|
-
if [[ "$cmd" = "destroy" ]] && [[ "$env" != "staging" ]] && [[ "$env" != "production" ]]; then
|
117
|
-
<% else %>
|
118
|
-
if [[ "$cmd" = "destroy" ]]; then
|
119
|
-
<% end %>
|
120
|
-
if [[ -z "$force" ]]; then
|
121
|
-
read -p "Destroy the sandbox_bot user? (y/n) " confirm
|
122
|
-
if [[ "$confirm" != "y" ]]; then
|
123
|
-
exit 0
|
124
|
-
fi
|
125
|
-
fi
|
126
|
-
echo "=============================================================================================================="
|
127
|
-
echo "= Destroying the sandbox_bot user"
|
128
|
-
echo "=============================================================================================================="
|
129
|
-
<% if terraform_manage_spaces? %>
|
130
|
-
(cd sandbox_bot && ./run.sh "$env" destroy -auto-approve)
|
131
|
-
<% else %>
|
132
|
-
../bin/ops/destroy_service_account.sh -s <%= cloud_gov_staging_space %> -u terraform-deployer
|
133
|
-
rm secrets.auto.tfvars
|
134
|
-
<% end %>
|
135
|
-
fi
|
@@ -1,19 +1,14 @@
|
|
1
1
|
# Deploy user settings
|
2
2
|
variable "cf_user" {
|
3
3
|
type = string
|
4
|
-
description = "The service account running the terraform"
|
5
|
-
}
|
6
|
-
variable "cf_password" {
|
7
|
-
type = string
|
8
|
-
sensitive = true
|
9
|
-
description = "The service account password"
|
4
|
+
description = "The user email or service account running the terraform"
|
10
5
|
}
|
11
6
|
|
12
7
|
# app_space settings
|
13
8
|
variable "cf_space_name" {
|
14
9
|
type = string
|
15
10
|
description = "The space name to deploy the app into"
|
16
|
-
}
|
11
|
+
}<% if terraform_manage_spaces? %>
|
17
12
|
variable "space_deployers" {
|
18
13
|
type = set(string)
|
19
14
|
default = []
|
@@ -24,11 +19,16 @@ variable "space_developers" {
|
|
24
19
|
default = []
|
25
20
|
description = "A list of users to be granted SpaceDeveloper on cf_space_name"
|
26
21
|
}
|
22
|
+
variable "space_auditors" {
|
23
|
+
type = set(string)
|
24
|
+
default = []
|
25
|
+
description = "A list of users to be granted SpaceAuditor on cf_space_name"
|
26
|
+
}
|
27
27
|
variable "allow_space_ssh" {
|
28
28
|
type = bool
|
29
29
|
default = false
|
30
30
|
description = "Whether to allow ssh to cf_space_name"
|
31
|
-
}
|
31
|
+
}<% end %>
|
32
32
|
|
33
33
|
# supporting services settings
|
34
34
|
variable "rds_plan_name" {
|
@@ -50,7 +50,6 @@ variable "s3_plan_name" {
|
|
50
50
|
description = "The name of the s3 plan to use"
|
51
51
|
}
|
52
52
|
<% end %>
|
53
|
-
|
54
53
|
# routing settings
|
55
54
|
variable "custom_domain_name" {
|
56
55
|
type = string
|
@@ -23,7 +23,6 @@ module RailsTemplate18f
|
|
23
23
|
template "sandbox_bootstrap/main.tf", "terraform/bootstrap/main.tf"
|
24
24
|
copy_file "sandbox_bootstrap/imports.tf.tftpl", "terraform/bootstrap/templates/imports.tf.tftpl"
|
25
25
|
remove_file "terraform/bootstrap/users.auto.tfvars"
|
26
|
-
remove_dir "terraform/sandbox_bot"
|
27
26
|
remove_file "terraform/production.tfvars"
|
28
27
|
end
|
29
28
|
end
|
data/template.rb
CHANGED
@@ -99,6 +99,7 @@ end
|
|
99
99
|
cloud_gov_staging_space = default_staging_space if cloud_gov_staging_space.blank?
|
100
100
|
cloud_gov_production_space = default_prod_space if cloud_gov_production_space.blank?
|
101
101
|
|
102
|
+
@gitlab_ci = yes?("Create GitLab CI config? (y/n)")
|
102
103
|
@github_actions = yes?("Create GitHub Actions? (y/n)")
|
103
104
|
@circleci_pipeline = yes?("Create CircleCI config? (y/n)")
|
104
105
|
newrelic = yes?("Create FEDRAMP New Relic config files? (y/n)")
|
@@ -132,6 +133,8 @@ if compliance_trestle
|
|
132
133
|
generator_arguments = []
|
133
134
|
generator_arguments << "--oscal_repo=#{compliance_trestle_repo}" if compliance_trestle_submodule
|
134
135
|
generator_arguments << "--ci=github" if @github_actions
|
136
|
+
generator_arguments << "--ci=gitlab" if @gitlab_ci
|
137
|
+
generator_arguments << "--ci=circleci" if @circleci_pipeline
|
135
138
|
generate "rails_template18f:oscal", *generator_arguments
|
136
139
|
end
|
137
140
|
register_announcement("OSCAL Documentation", <<~EOM)
|
@@ -193,7 +196,7 @@ chmod "bin/ops/create_service_account.sh", 0o755
|
|
193
196
|
chmod "bin/ops/destroy_service_account.sh", 0o755
|
194
197
|
chmod "bin/ops/set_space_egress.sh", 0o755
|
195
198
|
copy_file "pa11y.js"
|
196
|
-
|
199
|
+
template "pa11yci.js"
|
197
200
|
copy_file "editorconfig", ".editorconfig"
|
198
201
|
copy_file "zap.conf"
|
199
202
|
after_bundle do
|
@@ -402,9 +405,10 @@ after_bundle do
|
|
402
405
|
end
|
403
406
|
if cloud_gov_org_tktk?
|
404
407
|
register_announcement("Terraform", <<~EOM)
|
405
|
-
Fill in the cloud.gov organization information in:
|
408
|
+
Fill in the cloud.gov organization and space information in:
|
406
409
|
* terraform/bootstrap/main.tf
|
407
410
|
* terraform/main.tf
|
411
|
+
* terraform/*.tfvars
|
408
412
|
EOM
|
409
413
|
end
|
410
414
|
register_announcement("Terraform", "Run the bootstrap script and update the appropriate CI/CD environment variables defined in the Deployment section of the README")
|
@@ -430,11 +434,6 @@ if @github_actions
|
|
430
434
|
]
|
431
435
|
generate "rails_template18f:github_actions", *generator_arguments
|
432
436
|
end
|
433
|
-
if cloud_gov_org_tktk?
|
434
|
-
register_announcement("GitHub Actions", <<~EOM)
|
435
|
-
* Fill in the cloud.gov organization information in .github/workflows/deploy-staging.yml
|
436
|
-
EOM
|
437
|
-
end
|
438
437
|
register_announcement("GitHub Actions", <<~EOM)
|
439
438
|
* Create environment variable secrets for deploy users as defined in the Deployment section of the README
|
440
439
|
EOM
|
@@ -449,16 +448,25 @@ if @circleci_pipeline
|
|
449
448
|
]
|
450
449
|
generate "rails_template18f:circleci", *generator_arguments
|
451
450
|
end
|
452
|
-
if cloud_gov_org_tktk?
|
453
|
-
register_announcement("CircleCI", <<~EOM)
|
454
|
-
* Fill in the cloud.gov organization information in .circleci/config.yml
|
455
|
-
EOM
|
456
|
-
end
|
457
451
|
register_announcement("CircleCI", <<~EOM)
|
458
452
|
* Create project environment variables for deploy users as defined in the Deployment section of the README
|
459
453
|
EOM
|
460
454
|
end
|
461
455
|
|
456
|
+
if @gitlab_ci
|
457
|
+
after_bundle do
|
458
|
+
generator_arguments = [
|
459
|
+
"--cg-org=#{@cloud_gov_organization}",
|
460
|
+
"--cg-staging=#{cloud_gov_staging_space}",
|
461
|
+
"--cg-prod=#{cloud_gov_production_space}"
|
462
|
+
]
|
463
|
+
generate "rails_template18f:gitlab_ci", *generator_arguments
|
464
|
+
end
|
465
|
+
register_announcement("GitLab CI", <<~EOM)
|
466
|
+
* Create project environment variables for deploy users as defined in the Deployment section of the README
|
467
|
+
EOM
|
468
|
+
end
|
469
|
+
|
462
470
|
if auditree
|
463
471
|
after_bundle do
|
464
472
|
generate "rails_template18f:auditree", "--evidence_locker=#{auditree_evidence_repo}"
|
@@ -2,7 +2,12 @@ let defaults = require("./pa11y.js");
|
|
2
2
|
|
3
3
|
// set chrome path for github actions
|
4
4
|
defaults.defaults.chromeLaunchConfig = {
|
5
|
+
<% if @gitlab_ci %>
|
6
|
+
"executablePath": "/usr/bin/chromium",
|
7
|
+
"args": ["--no-sandbox"]
|
8
|
+
<% else %>
|
5
9
|
"executablePath": "/usr/bin/google-chrome"
|
10
|
+
<% end %>
|
6
11
|
};
|
7
12
|
|
8
13
|
module.exports = defaults;
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_template_18f
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-04-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: railties
|
@@ -108,7 +107,6 @@ dependencies:
|
|
108
107
|
- - "~>"
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '1.43'
|
111
|
-
description:
|
112
110
|
email:
|
113
111
|
- ryan.ahearn@gsa.gov
|
114
112
|
executables:
|
@@ -169,6 +167,12 @@ files:
|
|
169
167
|
- lib/generators/rails_template18f/github_actions/templates/github/workflows/terraform-staging.yml
|
170
168
|
- lib/generators/rails_template18f/github_actions/templates/github/workflows/validate-ssp.yml
|
171
169
|
- lib/generators/rails_template18f/github_actions/templates/oscal/component-definitions/github_actions/component-definition.json.tt
|
170
|
+
- lib/generators/rails_template18f/gitlab_ci/gitlab_ci_generator.rb
|
171
|
+
- lib/generators/rails_template18f/gitlab_ci/templates/gitlab-ci.yml.tt
|
172
|
+
- lib/generators/rails_template18f/gitlab_ci/templates/gitlab/node.yml.tt
|
173
|
+
- lib/generators/rails_template18f/gitlab_ci/templates/gitlab/rails.yml
|
174
|
+
- lib/generators/rails_template18f/gitlab_ci/templates/gitlab/ruby.yml
|
175
|
+
- lib/generators/rails_template18f/gitlab_ci/templates/gitlab/terraform.yml
|
172
176
|
- lib/generators/rails_template18f/i18n/i18n_generator.rb
|
173
177
|
- lib/generators/rails_template18f/i18n/templates/config/locales/en.yml.tt
|
174
178
|
- lib/generators/rails_template18f/i18n/templates/config/locales/es.yml
|
@@ -204,8 +208,6 @@ files:
|
|
204
208
|
- lib/generators/rails_template18f/terraform/templates/terraform/main.tf.tt
|
205
209
|
- lib/generators/rails_template18f/terraform/templates/terraform/production.tfvars.tt
|
206
210
|
- lib/generators/rails_template18f/terraform/templates/terraform/providers.tf.tt
|
207
|
-
- lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/main.tf
|
208
|
-
- lib/generators/rails_template18f/terraform/templates/terraform/sandbox_bot/run.sh
|
209
211
|
- lib/generators/rails_template18f/terraform/templates/terraform/staging.tfvars.tt
|
210
212
|
- lib/generators/rails_template18f/terraform/templates/terraform/terraform.sh.tt
|
211
213
|
- lib/generators/rails_template18f/terraform/templates/terraform/variables.tf.tt
|
@@ -255,7 +257,7 @@ files:
|
|
255
257
|
- templates/lib/tasks/cf.rake
|
256
258
|
- templates/lib/tasks/scanning.rake
|
257
259
|
- templates/pa11y.js
|
258
|
-
- templates/pa11yci.js
|
260
|
+
- templates/pa11yci.js.tt
|
259
261
|
- templates/zap.conf
|
260
262
|
homepage: https://github.com/18f/rails-template
|
261
263
|
licenses: []
|
@@ -264,7 +266,6 @@ metadata:
|
|
264
266
|
homepage_uri: https://github.com/18f/rails-template
|
265
267
|
source_code_uri: https://github.com/18f/rails-template
|
266
268
|
changelog_uri: https://github.com/18f/rails-template/blob/main/CHANGELOG.md
|
267
|
-
post_install_message:
|
268
269
|
rdoc_options: []
|
269
270
|
require_paths:
|
270
271
|
- lib
|
@@ -279,8 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
280
|
- !ruby/object:Gem::Version
|
280
281
|
version: '0'
|
281
282
|
requirements: []
|
282
|
-
rubygems_version: 3.
|
283
|
-
signing_key:
|
283
|
+
rubygems_version: 3.6.2
|
284
284
|
specification_version: 4
|
285
285
|
summary: Generators for creating an 18F-flavored Rails app
|
286
286
|
test_files: []
|