You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add Terraform project to create ECR repositories in the operations account
* Add Terraform project to create the ECS service and other resources
* Update Travis-CI configuration to deploy using Terraform
* Update documentation
This project uses Terraform and the AWS CLI to deploy the service to the BNC ECS Cluster. To have the CI/CD pipeline deploy a service which has be deployed using a fork of this project you can follow the instructions below.
45
+
46
+
### Terraform ECS Workspaces
47
+
48
+
By default Terraform will not create the required workspaces. Before setting up the deployment in the CI environment, ensure you have created all of the appropriate workspaces.
49
+
50
+
The default workspaces for BNC are:
51
+
* development
52
+
* production
53
+
54
+
To create the workspaces run the following commands:
55
+
```
56
+
cd deployment/terraform/ecs-service
57
+
terraform workspace new production
58
+
terraform workspace new development
33
59
```
34
60
35
-
## For more tasks run
36
-
```bash
37
-
./gradlew tasks
61
+
### Setting up Travis-CI deployment
62
+
63
+
1. Encrypt the following global environment variables using the Travis-CI CLI.
64
+
```
65
+
AWS_ACCESS_KEY_ID=
66
+
AWS_SECRET_ACCESS_KEY=
67
+
AWS_DEFAULT_REGION=
68
+
KMS_KEY_ID=
69
+
ROLE_ARN=
70
+
STATE_S3_BUCKET=
71
+
STATE_DYNAMODB_TABLE=
72
+
KEY=<The project key for the ECR repository>, e.g bnc/<team>/ecr/<service-name>
73
+
SERVICE_KEY=<The project key for ECS service>, e.g bnc/<team>/<workspace>/ecs/<service-name>
74
+
OPERATIONS_ROLE_ARN=
75
+
DEVELOPMENT_ROLE_ARN=
76
+
PRODUCTION_ROLE_ARN=
77
+
SPLUNK_URL=
78
+
```
79
+
80
+
2. Encrypt the following environment variables for the development deployment:
81
+
```
82
+
TF_WORKSPACE=
83
+
SPLUNK_TOKEN=
84
+
```
85
+
86
+
### Deployment to development ECS cluster
87
+
88
+
#### Setup AWS Credentials
89
+
90
+
1. Setup the AWS profile using `aws configure --profile bnc-terraform`. The credentials can be retrieved using `terraform output` command in the terraform-techemy-master project if you have this setup.
91
+
92
+
#### Terraform ECR Project
93
+
94
+
1. cd deployment/terraform/ecr
95
+
96
+
2. Copy `backend.tfvars.example` to `backend.tfvars`.
97
+
98
+
3. Fill out the `backend.tfvars`
99
+
100
+
4. Run `terraform init "-backend-config=backend.tfvars"`.
101
+
102
+
5. Copy `master.tfvars.example` to `master.tfvars`.
103
+
104
+
6. Fill in the `master.tfvars` with the correct values.
105
+
106
+
7. Now the project is fully setup and you will have the ability to run [terraform commands](https://www.terraform.io/docs/commands/index.html).
107
+
```
108
+
terraform plan "-var-file=master.tfvars"
109
+
```
110
+
111
+
#### Terraform ECS Project
112
+
113
+
1. cd deployment/terraform/ecs-service
114
+
115
+
2. Copy `backend.tfvars.example` to `backend.tfvars`.
116
+
117
+
3. Fill out the `backend.tfvars`
118
+
119
+
4. Run `terraform init "-backend-config=backend.tfvars"`.
120
+
121
+
5. Copy `master.tfvars.example` to `master.tfvars`.
122
+
123
+
6. Fill in the `master.tfvars` with the correct values.
124
+
125
+
7. Select the development work space `terraform workspace select development`
126
+
127
+
8. Now the project is fully setup and you will have the ability to run [terraform commands](https://www.terraform.io/docs/commands/index.html).
0 commit comments