rails_template_18f 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/generators/rails_template18f/circleci/templates/circleci/config.yml.tt +1 -1
- data/lib/generators/rails_template18f/github_actions/github_actions_generator.rb +2 -2
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-production.yml.tt +2 -4
- data/lib/generators/rails_template18f/github_actions/templates/github/workflows/deploy-staging.yml.tt +2 -4
- data/lib/generators/rails_template18f/terraform/templates/terraform/README.md.tt +36 -51
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/import.sh +1 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/main.tf.tt +7 -10
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/providers.tf +3 -3
- data/lib/generators/rails_template18f/terraform/templates/terraform/bootstrap/run.sh.tt +27 -0
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/main.tf.tt +29 -46
- data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt +8 -1
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/main.tf.tt +22 -36
- data/lib/generators/rails_template18f/terraform/templates/terraform/staging/providers.tf.tt +8 -1
- data/lib/rails_template18f/version.rb +1 -1
- data/templates/bin/ops/create_service_account.sh.tt +11 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71f972115a1f66ddfefa4341186434fe24a4e78b201ad192786a4c5d34bebb8c
|
4
|
+
data.tar.gz: dcbf65cd0f011f12aa918975b426e23002d07c54c14d4251d5e8102bc59e74a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09de09463925281bdb7731686bebfe8eb4441a208e488597abfc910510dead294a0380629ed43af55956fb798fa2aeffeaddc25c0b6e2dd6e584db6791b211b0'
|
7
|
+
data.tar.gz: d12d2667e1aa2bf8e49097ccc9b3f76656a5a71b5ca829b1e02361d33df62af298c27dfe6de8da268f6ead509a54725c1df5852813196bd113f1daedf9f70de4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.8.2] - 2024-06-06
|
4
|
+
|
5
|
+
- Replace deprecated github action for cloud.gov deploys with cg-supported one
|
6
|
+
- Update terraform modules use for the actual module api - and specify the module version in use
|
7
|
+
|
3
8
|
## [0.8.1] - 2024-06-04
|
4
9
|
|
5
10
|
- fix error when compliance-template fork question is left blank
|
data/Gemfile.lock
CHANGED
@@ -47,7 +47,7 @@ commands:
|
|
47
47
|
- run:
|
48
48
|
name: Install Cloud Foundry CLI
|
49
49
|
command: |
|
50
|
-
curl -v -L -o cf-cli_amd64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=
|
50
|
+
curl -v -L -o cf-cli_amd64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=v8&source=github'
|
51
51
|
sudo dpkg -i cf-cli_amd64.deb
|
52
52
|
- run:
|
53
53
|
name: Login with service account
|
@@ -62,8 +62,8 @@ EOB
|
|
62
62
|
def update_terraform_readme
|
63
63
|
return unless terraform?
|
64
64
|
readme_filename = "terraform/README.md"
|
65
|
-
insert_into_file readme_filename, " |- .force-action-apply\n", after: "
|
66
|
-
insert_into_file readme_filename, <<~EOM, after:
|
65
|
+
insert_into_file readme_filename, " |- .force-action-apply\n", after: "- <env>/\n"
|
66
|
+
insert_into_file readme_filename, <<~EOM, after: /.*environment-specific modules:$/
|
67
67
|
\n- `.force-action-apply` is a file that can be updated to force GitHub Actions to run `terraform apply` during the deploy phase
|
68
68
|
EOM
|
69
69
|
end
|
@@ -42,7 +42,7 @@ jobs:
|
|
42
42
|
run: terraform apply -auto-approve -input=false
|
43
43
|
<% end %>
|
44
44
|
- name: Deploy app
|
45
|
-
uses:
|
45
|
+
uses: cloud-gov/cg-cli-tools@main
|
46
46
|
env:
|
47
47
|
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
48
48
|
with:
|
@@ -50,6 +50,4 @@ jobs:
|
|
50
50
|
cf_password: ${{ secrets.CF_PASSWORD }}
|
51
51
|
cf_org: <%= cloud_gov_organization %>
|
52
52
|
cf_space: <%= cloud_gov_production_space %>
|
53
|
-
|
54
|
-
--vars-file config/deployment/production.yml
|
55
|
-
--var rails_master_key=$RAILS_MASTER_KEY
|
53
|
+
cf_command: push -vars-file config/deployment/production.yml --var rails_master_key=${{ env.RAILS_MASTER_KEY }} --strategy rolling
|
@@ -42,7 +42,7 @@ jobs:
|
|
42
42
|
run: terraform apply -auto-approve -input=false
|
43
43
|
<% end %>
|
44
44
|
- name: Deploy app
|
45
|
-
uses:
|
45
|
+
uses: cloud-gov/cg-cli-tools@main
|
46
46
|
env:
|
47
47
|
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
|
48
48
|
with:
|
@@ -50,6 +50,4 @@ jobs:
|
|
50
50
|
cf_password: ${{ secrets.CF_PASSWORD }}
|
51
51
|
cf_org: <%= cloud_gov_organization %>
|
52
52
|
cf_space: <%= cloud_gov_staging_space %>
|
53
|
-
|
54
|
-
--vars-file config/deployment/staging.yml
|
55
|
-
--var rails_master_key=$RAILS_MASTER_KEY
|
53
|
+
cf_command: push -vars-file config/deployment/staging.yml --var rails_master_key=${{ env.RAILS_MASTER_KEY }} --strategy rolling
|
@@ -4,26 +4,39 @@ This directory holds the terraform modules for maintaining your complete persist
|
|
4
4
|
|
5
5
|
Prerequisite: install the `jq` JSON processor: `brew bundle` or `brew install jq`
|
6
6
|
|
7
|
-
## Initial setup
|
7
|
+
## Initial project setup
|
8
8
|
|
9
|
-
|
9
|
+
These steps only need to be run once per project.
|
10
|
+
|
11
|
+
1. Manually [bootstrap the state storage bucket](#bootstrapping-the-state-storage-s3-buckets-for-the-first-time) within the `bootstrap` directory
|
10
12
|
1. Setup CI/CD Pipeline to run Terraform
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
1. Copy bootstrap credentials to your CI/CD secrets using the instructions in the base README
|
14
|
+
1. Create a cloud.gov SpaceDeployer by following the instructions under `SpaceDeployers`
|
15
|
+
1. Copy SpaceDeployer credentials to your CI/CD secrets using the instructions in the base README
|
14
16
|
1. Manually Running Terraform
|
15
|
-
|
17
|
+
1. Follow instructions under `Set up a new environment` to create your infrastructure
|
18
|
+
|
19
|
+
## Initial developer setup
|
20
|
+
|
21
|
+
These steps should be run for any developer that needs to start running terraform or who just moved to a new machine.
|
22
|
+
|
23
|
+
They are not necessary for the developer who runs the [initial project setup](#initial-project-setup)
|
24
|
+
|
25
|
+
1. Import the existing bootstrap resources to your local state with `./import.sh`
|
26
|
+
1. Follow instructions under [Use bootstrap credentials](#use-bootstrap-credentials)
|
27
|
+
|
16
28
|
|
17
29
|
## Terraform State Credentials
|
18
30
|
|
19
|
-
The bootstrap module is used to create an s3 bucket for later terraform runs to store their state in.
|
31
|
+
The `bootstrap` module is used to create an s3 bucket for later terraform runs to store their state in.
|
20
32
|
|
21
33
|
### Bootstrapping the state storage s3 buckets for the first time
|
22
34
|
|
23
|
-
|
24
|
-
|
35
|
+
These steps are run once per project.
|
36
|
+
|
37
|
+
1. Run `./run.sh init`
|
25
38
|
1. Run `./run.sh apply` to set up the bucket and retrieve credentials
|
26
|
-
1. Follow instructions under
|
39
|
+
1. Follow instructions under [Use bootstrap credentials](#use-bootstrap-credentials)
|
27
40
|
1. Ensure that `import.sh` includes a line and correct IDs for any resources created
|
28
41
|
1. Run `./teardown_creds.sh` to remove the space deployer account used to create the s3 bucket
|
29
42
|
|
@@ -31,28 +44,20 @@ The bootstrap module is used to create an s3 bucket for later terraform runs to
|
|
31
44
|
|
32
45
|
*This should not be necessary in most cases*
|
33
46
|
|
34
|
-
1. Run `terraform init`
|
35
|
-
1. If you don't have terraform state locally:
|
36
|
-
1. run `./import.sh`
|
37
|
-
1. optionally run `./run.sh apply` to include the existing outputs in the state file
|
38
47
|
1. Make your changes
|
39
|
-
1.
|
40
|
-
|
41
|
-
### Retrieving existing bucket credentials
|
48
|
+
1. Run `./run.sh plan` to verify the changes are what you expect
|
49
|
+
1. Continue from step 2 of the [boostrapping instructions](#bootstrapping-the-state-storage-s3-buckets-for-the-first-time)
|
42
50
|
|
43
|
-
|
44
|
-
1. Follow instructions under `Use bootstrap credentials`
|
45
|
-
|
46
|
-
#### Use bootstrap credentials
|
51
|
+
### Use bootstrap credentials
|
47
52
|
|
48
53
|
1. Add the following to `~/.aws/credentials`
|
49
54
|
```
|
50
55
|
[<%= app_name %>-terraform-backend]
|
51
|
-
aws_access_key_id = <
|
52
|
-
aws_secret_access_key = <
|
56
|
+
aws_access_key_id = <AWS_ACCESS_KEY_ID from run.sh output>
|
57
|
+
aws_secret_access_key = <AWS_SECRET_ACCESS_KEY from run.sh output>
|
53
58
|
```
|
54
59
|
|
55
|
-
1. Copy `
|
60
|
+
1. Copy `BUCKET` from `run.sh` output to the backend block of `staging/providers.tf` and `production/providers.tf`
|
56
61
|
|
57
62
|
## SpaceDeployers
|
58
63
|
|
@@ -63,11 +68,11 @@ deploy the application from the CI/CD pipeline. Create a new account by running:
|
|
63
68
|
|
64
69
|
## Set up a new environment manually
|
65
70
|
|
66
|
-
The below steps rely on you first configuring access to the Terraform state in s3 as described in [
|
71
|
+
The below steps rely on you first configuring access to the Terraform state in s3 as described in [initial project setup](#initial-project-setup) or [initial developer setup](#initial-developer-setup).
|
67
72
|
|
68
73
|
1. `cd` to the environment you are working in
|
69
74
|
|
70
|
-
1. Set up a SpaceDeployer
|
75
|
+
1. Set up a SpaceDeployer and save the credentials in a file named `secrets.auto.tfvars`
|
71
76
|
```bash
|
72
77
|
# create a space deployer service instance that can log in with just a username and password
|
73
78
|
# the value of < SPACE_NAME > should be `staging` or `prod` depending on where you are working
|
@@ -80,7 +85,7 @@ The below steps rely on you first configuring access to the Terraform state in s
|
|
80
85
|
|
81
86
|
The script will output the `username` (as `cf_user`) and `password` (as `cf_password`) for your `<ACCOUNT_NAME>`. Read more in the [cloud.gov service account documentation](https://cloud.gov/docs/services/cloud-gov-service-account/).
|
82
87
|
|
83
|
-
The easiest way to use this script is to redirect the output directly to the `secrets.auto.tfvars` file it needs to be used in
|
88
|
+
The easiest way to use this script locally is to redirect the output directly to the `secrets.auto.tfvars` file it needs to be used in
|
84
89
|
|
85
90
|
1. Run terraform from your new environment directory with
|
86
91
|
```bash
|
@@ -90,7 +95,7 @@ The below steps rely on you first configuring access to the Terraform state in s
|
|
90
95
|
|
91
96
|
1. Apply changes with `terraform apply`.
|
92
97
|
|
93
|
-
1. Remove the space deployer service instance if it doesn't need to be used again, such as when manually running terraform
|
98
|
+
1. Remove the space deployer service instance if it doesn't need to be used again, such as when manually running terraform plan before letting CI/CD apply the changes.
|
94
99
|
```bash
|
95
100
|
# <SPACE_NAME> and <ACCOUNT_NAME> have the same values as used above.
|
96
101
|
../../bin/ops/destroy_service_account.sh -s <SPACE_NAME> -u <ACCOUNT_NAME>
|
@@ -98,7 +103,7 @@ The below steps rely on you first configuring access to the Terraform state in s
|
|
98
103
|
|
99
104
|
## Structure
|
100
105
|
|
101
|
-
Each environment has its own module
|
106
|
+
Each environment has its own module.
|
102
107
|
|
103
108
|
```
|
104
109
|
- bootstrap/
|
@@ -111,38 +116,18 @@ Each environment has its own module, which relies on a shared module for everyth
|
|
111
116
|
- <env>/
|
112
117
|
|- main.tf
|
113
118
|
|- providers.tf
|
114
|
-
|- secrets.auto.tfvars
|
115
119
|
|- variables.tf
|
116
|
-
- shared/
|
117
|
-
|- s3/
|
118
|
-
|- main.tf
|
119
|
-
|- providers.tf
|
120
|
-
|- variables.tf
|
121
|
-
|- database/
|
122
|
-
|- main.tf
|
123
|
-
|- providers.tf
|
124
|
-
|- variables.tf
|
125
|
-
|- domain/
|
126
|
-
|- main.tf
|
127
|
-
|- providers.tf
|
128
|
-
|- variables.tf
|
129
120
|
```
|
130
121
|
|
131
|
-
In the shared modules:
|
132
|
-
- `providers.tf` contains set up instructions for Terraform about Cloud Foundry and AWS
|
133
|
-
- `main.tf` sets up the data and resources the application relies on
|
134
|
-
- `variables.tf` lists the required variables and applicable default values
|
135
|
-
|
136
122
|
In the environment-specific modules:
|
137
123
|
- `providers.tf` lists the required providers
|
138
124
|
- `main.tf` calls the shared Terraform code, but this is also a place where you can add any other services, resources, etc, which you would like to set up for that environment
|
139
125
|
- `variables.tf` lists the variables that will be needed, either to pass through to the child module or for use in this module
|
140
|
-
- `secrets.auto.tfvars` is a file which contains the information about the service-key and other secrets that should not be shared
|
141
126
|
|
142
127
|
In the bootstrap module:
|
143
128
|
- `providers.tf` lists the required providers
|
144
129
|
- `main.tf` sets up s3 bucket to be shared across all environments. It lives in `prod` to communicate that it should not be deleted
|
145
130
|
- `variables.tf` lists the variables that will be needed. Most values are hard-coded in this module
|
146
|
-
- `run.sh` Helper script to set up a space deployer and run terraform. The terraform action (`show`/`plan`/`apply`/`destroy`) is passed as an argument
|
131
|
+
- `run.sh` Helper script to set up a space deployer and run terraform. The terraform action (`init`/`show`/`plan`/`apply`/`destroy`) is passed as an argument
|
147
132
|
- `teardown_creds.sh` Helper script to remove the space deployer setup as part of `run.sh`
|
148
|
-
- `import.sh` Helper script to create a new local state file
|
133
|
+
- `import.sh` Helper script to create a new local state file when new developers need to access the state file
|
@@ -4,6 +4,7 @@ read -p "Are you sure you want to import terraform state (y/n)? " verify
|
|
4
4
|
|
5
5
|
if [[ $verify == "y" ]]; then
|
6
6
|
echo "Importing bootstrap state"
|
7
|
+
./run.sh init
|
7
8
|
./run.sh import module.s3.cloudfoundry_service_instance.bucket TKTK
|
8
9
|
./run.sh import cloudfoundry_service_key.bucket_creds TKTK
|
9
10
|
./run.sh plan
|
@@ -1,18 +1,14 @@
|
|
1
1
|
locals {
|
2
|
-
cf_api_url = "https://api.fr.cloud.gov"
|
3
2
|
s3_service_name = "<%= app_name %>-terraform-state"
|
4
3
|
}
|
5
4
|
|
6
5
|
module "s3" {
|
7
|
-
source = "github.com/
|
6
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
cf_space_name = "<%= cloud_gov_production_space %>"
|
14
|
-
s3_service_name = local.s3_service_name<% if cloud_gov_organization == "sandbox-gsa" %>
|
15
|
-
s3_plan_name = "basic-sandbox"<% end %>
|
8
|
+
cf_org_name = "<%= cloud_gov_organization %>"
|
9
|
+
cf_space_name = "<%= cloud_gov_production_space %>"
|
10
|
+
name = local.s3_service_name<% if cloud_gov_organization == "sandbox-gsa" %>
|
11
|
+
s3_plan_name = "basic-sandbox"<% end %>
|
16
12
|
}
|
17
13
|
|
18
14
|
resource "cloudfoundry_service_key" "bucket_creds" {
|
@@ -21,5 +17,6 @@ resource "cloudfoundry_service_key" "bucket_creds" {
|
|
21
17
|
}
|
22
18
|
|
23
19
|
output "bucket_credentials" {
|
24
|
-
value
|
20
|
+
value = cloudfoundry_service_key.bucket_creds.credentials
|
21
|
+
sensitive = true
|
25
22
|
}
|
@@ -3,14 +3,14 @@ terraform {
|
|
3
3
|
required_providers {
|
4
4
|
cloudfoundry = {
|
5
5
|
source = "cloudfoundry-community/cloudfoundry"
|
6
|
-
version = "0.
|
6
|
+
version = "0.53.1"
|
7
7
|
}
|
8
8
|
}
|
9
9
|
}
|
10
10
|
|
11
11
|
provider "cloudfoundry" {
|
12
|
-
api_url =
|
12
|
+
api_url = "https://api.fr.cloud.gov"
|
13
13
|
user = var.cf_user
|
14
14
|
password = var.cf_password
|
15
15
|
app_logs_max = 30
|
16
|
-
}
|
16
|
+
}
|
@@ -1,5 +1,20 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
if ! command -v jq &> /dev/null
|
4
|
+
then
|
5
|
+
echo "jq must be installed. Run 'brew bundle' to install everything in the Brewfile"
|
6
|
+
exit 1
|
7
|
+
fi
|
8
|
+
if ! command -v terraform &> /dev/null
|
9
|
+
then
|
10
|
+
echo "terraform must be installed before running this script"
|
11
|
+
exit 1
|
12
|
+
fi
|
13
|
+
|
14
|
+
dig_output () {
|
15
|
+
dig_result=`cat terraform.tfstate | jq -r ".outputs.bucket_credentials.value.$1"`
|
16
|
+
}
|
17
|
+
|
3
18
|
if [[ ! -f "secrets.auto.tfvars" ]]; then
|
4
19
|
../../bin/ops/create_service_account.sh -s <%= cloud_gov_production_space %> -u config-bootstrap-deployer > secrets.auto.tfvars
|
5
20
|
fi
|
@@ -7,6 +22,18 @@ fi
|
|
7
22
|
if [[ $# -gt 0 ]]; then
|
8
23
|
echo "Running terraform $@"
|
9
24
|
terraform $@
|
25
|
+
if [[ -f terraform.tfstate ]]; then
|
26
|
+
echo
|
27
|
+
echo "Credentials for terraform state bucket:"
|
28
|
+
dig_output "bucket"
|
29
|
+
echo "BUCKET=$dig_result"
|
30
|
+
dig_output "access_key_id"
|
31
|
+
echo "AWS_ACCESS_KEY_ID=$dig_result"
|
32
|
+
dig_output "secret_access_key"
|
33
|
+
echo "AWS_SECRET_ACCESS_KEY=$dig_result"
|
34
|
+
dig_output "region"
|
35
|
+
echo "AWS_REGION=$dig_result"
|
36
|
+
fi
|
10
37
|
else
|
11
38
|
echo "Not running terraform"
|
12
39
|
fi
|
@@ -3,46 +3,34 @@ locals {
|
|
3
3
|
cf_space_name = "<%= cloud_gov_production_space %>"
|
4
4
|
env = "production"
|
5
5
|
app_name = "<%= app_name %>"
|
6
|
-
recursive_delete = false
|
7
6
|
}
|
8
7
|
|
9
8
|
module "database" {
|
10
|
-
source = "github.com/
|
9
|
+
source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.0.0"
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
env = local.env
|
17
|
-
app_name = local.app_name
|
18
|
-
recursive_delete = local.recursive_delete
|
19
|
-
rds_plan_name = "TKTK-production-rds-plan"
|
11
|
+
cf_org_name = local.cf_org_name
|
12
|
+
cf_space_name = local.cf_space_name
|
13
|
+
name = "${local.app_name}-rds-${local.env}"
|
14
|
+
rds_plan_name = "TKTK-production-rds-plan"
|
20
15
|
}
|
21
16
|
<% if has_active_job? %>
|
22
17
|
module "redis" {
|
23
|
-
source = "github.com/
|
18
|
+
source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.0.0"
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
env = local.env
|
30
|
-
app_name = local.app_name
|
31
|
-
recursive_delete = local.recursive_delete
|
32
|
-
redis_plan_name = "TKTK-production-redis-plan"
|
20
|
+
cf_org_name = local.cf_org_name
|
21
|
+
cf_space_name = local.cf_space_name
|
22
|
+
name = "${local.app_name}-redis-${local.env}"
|
23
|
+
redis_plan_name = "TKTK-production-redis-plan"
|
33
24
|
}
|
34
25
|
<% end %>
|
35
26
|
<% if has_active_storage? %>
|
36
27
|
module "s3" {
|
37
|
-
source = "github.com/
|
28
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
recursive_delete = local.recursive_delete
|
44
|
-
s3_service_name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
|
45
|
-
s3_plan_name = "basic-sandbox"<% end %>
|
30
|
+
cf_org_name = local.cf_org_name
|
31
|
+
cf_space_name = local.cf_space_name
|
32
|
+
name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
|
33
|
+
s3_plan_name = "basic-sandbox"<% end %>
|
46
34
|
}
|
47
35
|
|
48
36
|
###########################################################################
|
@@ -52,16 +40,14 @@ module "s3" {
|
|
52
40
|
# 2) Your organization has sufficient memory. Each clamav app requires 3GB
|
53
41
|
###########################################################################
|
54
42
|
# module "clamav" {
|
55
|
-
# source = "github.com/
|
43
|
+
# source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.0.0"
|
56
44
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# clamav_image = "ajilaag/clamav-rest:20211229"
|
64
|
-
# max_file_size = "30M"
|
45
|
+
# cf_org_name = local.cf_org_name
|
46
|
+
# cf_space_name = local.cf_space_name
|
47
|
+
# app_name_or_id = "${local.app_name}-${local.env}"
|
48
|
+
# name = "${local.app_name}-clamapi-${local.env}"
|
49
|
+
# clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
|
50
|
+
# max_file_size = "30M"
|
65
51
|
# }
|
66
52
|
<% end %>
|
67
53
|
|
@@ -73,15 +59,12 @@ module "s3" {
|
|
73
59
|
# `cf create-domain <%= cloud_gov_organization %> TKTK-production-domain-name`
|
74
60
|
###########################################################################
|
75
61
|
# module "domain" {
|
76
|
-
# source = "github.com/
|
62
|
+
# source = "github.com/gsa-tts/terraform-cloudgov//domain?ref=v1.0.0"
|
77
63
|
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
# recursive_delete = local.recursive_delete
|
85
|
-
# cdn_plan_name = "domain"
|
86
|
-
# domain_name = "TKTK-production-domain-name"
|
64
|
+
# cf_org_name = local.cf_org_name
|
65
|
+
# cf_space_name = local.cf_space_name
|
66
|
+
# app_name_or_id = "${local.app_name}-${local.env}"
|
67
|
+
# cdn_plan_name = "domain"
|
68
|
+
# domain_name = "TKTK-production-domain-name"
|
69
|
+
# host_name = "TKTK-production-hostname (optional)"
|
87
70
|
# }
|
data/lib/generators/rails_template18f/terraform/templates/terraform/production/providers.tf.tt
CHANGED
@@ -3,7 +3,7 @@ terraform {
|
|
3
3
|
required_providers {
|
4
4
|
cloudfoundry = {
|
5
5
|
source = "cloudfoundry-community/cloudfoundry"
|
6
|
-
version = "0.
|
6
|
+
version = "0.53.1"
|
7
7
|
}
|
8
8
|
}
|
9
9
|
|
@@ -15,3 +15,10 @@ terraform {
|
|
15
15
|
profile = "<%= app_name %>-terraform-backend"
|
16
16
|
}
|
17
17
|
}
|
18
|
+
|
19
|
+
provider "cloudfoundry" {
|
20
|
+
api_url = "https://api.fr.cloud.gov"
|
21
|
+
user = var.cf_user
|
22
|
+
password = var.cf_password
|
23
|
+
app_logs_max = 30
|
24
|
+
}
|
@@ -3,46 +3,34 @@ locals {
|
|
3
3
|
cf_space_name = "<%= cloud_gov_staging_space %>"
|
4
4
|
env = "staging"
|
5
5
|
app_name = "<%= app_name %>"
|
6
|
-
recursive_delete = true
|
7
6
|
}
|
8
7
|
|
9
8
|
module "database" {
|
10
|
-
source = "github.com/
|
9
|
+
source = "github.com/gsa-tts/terraform-cloudgov//database?ref=v1.0.0"
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
env = local.env
|
17
|
-
app_name = local.app_name
|
18
|
-
recursive_delete = local.recursive_delete
|
19
|
-
rds_plan_name = "micro-psql"
|
11
|
+
cf_org_name = local.cf_org_name
|
12
|
+
cf_space_name = local.cf_space_name
|
13
|
+
name = "${local.app_name}-rds-${local.env}"
|
14
|
+
rds_plan_name = "micro-psql"
|
20
15
|
}
|
21
16
|
<% if has_active_job? %>
|
22
17
|
module "redis" {
|
23
|
-
source = "github.com/
|
18
|
+
source = "github.com/gsa-tts/terraform-cloudgov//redis?ref=v1.0.0"
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
env = local.env
|
30
|
-
app_name = local.app_name
|
31
|
-
recursive_delete = local.recursive_delete
|
32
|
-
redis_plan_name = "redis-dev"
|
20
|
+
cf_org_name = local.cf_org_name
|
21
|
+
cf_space_name = local.cf_space_name
|
22
|
+
name = "${local.app_name}-redis-${local.env}"
|
23
|
+
redis_plan_name = "redis-dev"
|
33
24
|
}
|
34
25
|
<% end %>
|
35
26
|
<% if has_active_storage? %>
|
36
27
|
module "s3" {
|
37
|
-
source = "github.com/
|
28
|
+
source = "github.com/gsa-tts/terraform-cloudgov//s3?ref=v1.0.0"
|
38
29
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
recursive_delete = local.recursive_delete
|
44
|
-
s3_service_name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
|
45
|
-
s3_plan_name = "basic-sandbox"<% end %>
|
30
|
+
cf_org_name = local.cf_org_name
|
31
|
+
cf_space_name = local.cf_space_name
|
32
|
+
name = "${local.app_name}-s3-${local.env}"<% if cloud_gov_organization == "sandbox-gsa" %>
|
33
|
+
s3_plan_name = "basic-sandbox"<% end %>
|
46
34
|
}
|
47
35
|
|
48
36
|
###########################################################################
|
@@ -52,15 +40,13 @@ module "s3" {
|
|
52
40
|
# 2) Your organization has sufficient memory. Each clamav app requires 3GB
|
53
41
|
###########################################################################
|
54
42
|
# module "clamav" {
|
55
|
-
# source = "github.com/
|
43
|
+
# source = "github.com/gsa-tts/terraform-cloudgov//clamav?ref=v1.0.0"
|
56
44
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# clamav_image = "ajilaag/clamav-rest:20211229"
|
64
|
-
# max_file_size = "30M"
|
45
|
+
# cf_org_name = local.cf_org_name
|
46
|
+
# cf_space_name = local.cf_space_name
|
47
|
+
# app_name_or_id = "${local.app_name}-${local.env}"
|
48
|
+
# name = "${local.app_name}-clamapi-${local.env}"
|
49
|
+
# clamav_image = "ghcr.io/gsa-tts/clamav-rest/clamav:20240602"
|
50
|
+
# max_file_size = "30M"
|
65
51
|
# }
|
66
52
|
<% end %>
|
@@ -3,7 +3,7 @@ terraform {
|
|
3
3
|
required_providers {
|
4
4
|
cloudfoundry = {
|
5
5
|
source = "cloudfoundry-community/cloudfoundry"
|
6
|
-
version = "0.
|
6
|
+
version = "0.53.1"
|
7
7
|
}
|
8
8
|
}
|
9
9
|
|
@@ -15,3 +15,10 @@ terraform {
|
|
15
15
|
profile = "<%= app_name %>-terraform-backend"
|
16
16
|
}
|
17
17
|
}
|
18
|
+
|
19
|
+
provider "cloudfoundry" {
|
20
|
+
api_url = "https://api.fr.cloud.gov"
|
21
|
+
user = var.cf_user
|
22
|
+
password = var.cf_password
|
23
|
+
app_logs_max = 30
|
24
|
+
}
|
@@ -45,6 +45,12 @@ while getopts ":hs:u:r:o:" opt; do
|
|
45
45
|
esac
|
46
46
|
done
|
47
47
|
|
48
|
+
if ! command -v jq &> /dev/null
|
49
|
+
then
|
50
|
+
echo "jq must be installed. Run 'brew bundle' to install everything in the Brewfile"
|
51
|
+
exit 1
|
52
|
+
fi
|
53
|
+
|
48
54
|
if [[ $space = "" || $service = "" ]]; then
|
49
55
|
echo "$usage"
|
50
56
|
exit 1
|
@@ -59,14 +65,14 @@ cf create-service cloud-gov-service-account $role $service 1>&2
|
|
59
65
|
cf create-service-key $service service-account-key 1>&2
|
60
66
|
|
61
67
|
# output service key to stdout in secrets.auto.tfvars format
|
62
|
-
creds=`cf service-key $service service-account-key | tail -n
|
63
|
-
username=`echo $creds | jq '.username'`
|
64
|
-
password=`echo $creds | jq '.password'`
|
68
|
+
creds=`cf service-key $service service-account-key | tail -n +2 | jq '.credentials'`
|
69
|
+
username=`echo $creds | jq -r '.username'`
|
70
|
+
password=`echo $creds | jq -r '.password'`
|
65
71
|
|
66
72
|
cat << EOF
|
67
73
|
# generated with $0 -s $space -u $service -r $role -o $org
|
68
74
|
# revoke with $(dirname $0)/destroy_service_account.sh -s $space -u $service -o $org
|
69
75
|
|
70
|
-
cf_user = $username
|
71
|
-
cf_password = $password
|
76
|
+
cf_user = "$username"
|
77
|
+
cf_password = "$password"
|
72
78
|
EOF
|
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.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Ahearn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-06-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|