Skip to content

Commit beb8c04

Browse files
committed
Rename to Muzo. Improve infra. Bump packaages.
1 parent aea1b3b commit beb8c04

File tree

13 files changed

+78
-87
lines changed

13 files changed

+78
-87
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Beatbot-fulfillment-handler
1+
# Muzo-fulfillment-handler
22

33
TODO
44

buildspec.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ env:
55
TF_VAR_remote_state_bucket: "603-terraform-remote-state"
66
TF_VAR_remote_state_region: "ap-southeast-2"
77
TF_VAR_region: "us-east-1"
8-
TF_VAR_name: "beatbot-fulfillment-handler"
8+
TF_VAR_name: "muzo-fulfillment-handler"
99
TF_VAR_build_docker_image: "jch254/docker-node-terraform-aws"
1010
TF_VAR_build_docker_tag: "6.10.0"
1111
TF_VAR_github_repository_owner: "jch254"
12-
TF_VAR_github_repository_name: "beatbot-fulfillment-handler"
12+
TF_VAR_github_repository_name: "muzo-fulfillment-handler"
1313
TF_VAR_github_branch_name: "master"
1414
TF_VAR_artifacts_dir: "../dist" # executed from /infrastruture directory
1515
TF_VAR_runtime: "nodejs6.10"
1616
TF_VAR_handler: "index.handler"
17-
TF_VAR_kms_key_arns: "[\"arn:aws:kms:us-east-1:982898479788:key/0b7b7ba8-721e-4b65-9ff0-21a9e091af76\", \"arn:aws:kms:us-east-1:982898479788:key/e83f1d78-5dc5-4aca-a00b-2fc2ac7bebe4\"]"
18-
TF_VAR_ssm_parameter_arns: "[\"arn:aws:ssm:us-east-1:982898479788:parameter/beatbot-fulfillment-handler/*\", \"arn:aws:ssm:us-east-1:982898479788:parameter/github-token\"]"
17+
TF_VAR_kms_key_arns: '["arn:aws:kms:us-east-1:982898479788:key/0b7b7ba8-721e-4b65-9ff0-21a9e091af76","arn:aws:kms:us-east-1:982898479788:key/e83f1d78-5dc5-4aca-a00b-2fc2ac7bebe4"]'
18+
TF_VAR_ssm_parameter_arns: '["arn:aws:ssm:us-east-1:982898479788:parameter/muzo-fulfillment-handler/*","arn:aws:ssm:us-east-1:982898479788:parameter/shared/*"]'
1919

2020
phases:
2121
install:
2222
commands:
2323
# Workaround until CodeBuild/CodePipeline retains file permissions
2424
- find ./scripts -name "*.bash" -exec chmod +x {} \;
25-
- ./scripts/install.bash
25+
- ./infrastructure/install.bash
2626

2727
pre_build:
2828
commands:
@@ -32,17 +32,14 @@ phases:
3232
- export AWS_SECRET_ACCESS_KEY=`curl --silent http://169.254.170.2:80$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI | jq -r '.SecretAccessKey'`
3333
- export AWS_SESSION_TOKEN=`curl --silent http://169.254.170.2:80$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI | jq -r '.Token'`
3434

35-
- SPOTIFY_CLIENT_ID=$(aws ssm get-parameters --region $TF_VAR_region --name "/beatbot-fulfillment-handler/spotify-client-id" --with-decryption --query Parameters[0].Value)
36-
- SPOTIFY_CLIENT_SECRET=$(aws ssm get-parameters --region $TF_VAR_region --name "/beatbot-fulfillment-handler/spotify-client-secret" --with-decryption --query Parameters[0].Value)
35+
- SPOTIFY_CLIENT_ID=$(aws ssm get-parameters --region $TF_VAR_region --name "/muzo-fulfillment-handler/spotify-client-id" --with-decryption --query Parameters[0].Value)
36+
- SPOTIFY_CLIENT_SECRET=$(aws ssm get-parameters --region $TF_VAR_region --name "/muzo-fulfillment-handler/spotify-client-secret" --with-decryption --query Parameters[0].Value)
3737
- export TF_VAR_environment_variables="{ SPOTIFY_CLIENT_ID = $SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET = $SPOTIFY_CLIENT_SECRET }"
3838

39-
- export TF_VAR_github_oauth_token=$(aws ssm get-parameters --region $TF_VAR_region --name "/github-token" --with-decryption --query Parameters[0].Value)
39+
- export TF_VAR_github_oauth_token=$(aws ssm get-parameters --region $TF_VAR_region --name "/shared/github-token" --with-decryption --query Parameters[0].Value --output text)
4040

4141
build:
4242
commands:
43-
- ./scripts/build-artifacts.bash
44-
45-
post_build:
46-
commands:
47-
- ./scripts/run-tests.bash
48-
- ./scripts/deploy-infrastructure.bash
43+
- ./infrastructure/build-artifacts.bash
44+
- ./infrastructure/run-tests.bash
45+
- ./infrastructure/deploy-infrastructure.bash

infrastructure/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Deployment/Infrastructure
22

3-
Beatbot-fulfillment-handler is a Lambda function built, tested and deployed to AWS by CodePipeline and Codebuild.
3+
Muzo-fulfillment-handler is a Lambda function built, tested and deployed to AWS by CodePipeline and Codebuild.
44

55
---
66

7-
**All commands below must be run in the /infrastructure directory.**
7+
**All commands below must be run in each /infrastructure subdirectory (e.g. /infrastructure/admin-api) then in the /infrastructure directory**
88

99
To deploy to AWS, you must:
1010

@@ -31,6 +31,7 @@ terraform init \
3131

3232
### Updating infrastructure
3333

34+
1. Export all environment variables beginnging with TF_VAR_ as per [buildspec.yml](../buildspec.yml)
3435
1. Make necessary infrastructure code changes.
3536
1. Initialise Terraform:
3637
```
@@ -45,6 +46,7 @@ terraform init \
4546

4647
### Destroying infrastructure (use with care)
4748

49+
1. Export all environment variables beginnging with TF_VAR_ as per [buildspec.yml](../buildspec.yml)
4850
1. Initialise Terraform:
4951
```
5052
terraform init \
File renamed without changes.
File renamed without changes.

infrastructure/modules/build-pipeline/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ resource "aws_iam_role" "codebuild_role" {
2222
EOF
2323
}
2424

25-
# TODO: Refine codebuild_policy perms
2625
data "template_file" "codebuild_policy" {
2726
template = "${file("${path.module}/codebuild-role-policy.tpl")}"
2827

@@ -90,6 +89,7 @@ resource "aws_iam_role_policy" "codepipeline_policy" {
9089
resource "aws_s3_bucket" "artifacts" {
9190
bucket = "${var.name}-codepipeline-artifacts"
9291
acl = "private"
92+
force_destroy = true
9393
}
9494

9595
resource "aws_codepipeline" "codepipeline" {

infrastructure/modules/build-pipeline/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ variable "log_retention" {
88
}
99

1010
variable "kms_key_arns" {
11-
description = "Array of escaped KMS Key ARNs used to decrypt secrets specified via ssm_parameter_arns variable"
11+
description = "Array of KMS Key ARNs used to decrypt secrets specified via ssm_parameter_arns variable"
1212
}
1313

1414
variable "ssm_parameter_arns" {
15-
description = "Array of escaped SSM Parameter ARNs used to set secret build environment variables via SSM Parameter Store"
15+
description = "Array of SSM Parameter ARNs used to set secret build environment variables via SSM Parameter Store"
1616
}
1717

1818
variable "build_compute_type" {

infrastructure/modules/lambda-function/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ data "archive_file" "artifacts" {
77
resource "aws_s3_bucket" "deployment" {
88
bucket = "${var.name}-deployment"
99
acl = "private"
10+
force_destroy = true
1011
}
1112

1213
resource "aws_s3_bucket_object" "artifacts" {
File renamed without changes.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "beatbot-fulfillment-handler",
2+
"name": "muzo-fulfillment-handler",
33
"version": "1.0.0",
4-
"description": "BeatBot fulfillment handler",
4+
"description": "Muzo fulfillment handler",
55
"license": "MIT",
66
"scripts": {
77
"dev": "nodemon -e ts -w src/ -x 'ts-node src/'",
@@ -10,22 +10,22 @@
1010
},
1111
"repository": {
1212
"type": "git",
13-
"url": "https://github.com/jch254/beatbot-fulfillment-handler"
13+
"url": "https://github.com/jch254/muzo-fulfillment-handler"
1414
},
1515
"author": "Jordan Hornblow",
1616
"dependencies": {
1717
"spotify-web-api-node": "^2.4.0"
1818
},
1919
"devDependencies": {
2020
"@types/aws-lambda": "^0.0.14",
21-
"@types/node": "^8.0.2",
21+
"@types/node": "^8.0.7",
2222
"@types/node-fetch": "^1.6.7",
2323
"nodemon": "^1.11.0",
2424
"rimraf": "^2.6.1",
25-
"ts-node": "^3.0.6",
25+
"ts-node": "^3.1.0",
2626
"tslint": "^5.4.3",
27-
"tslint-config-airbnb": "^5.2.0",
27+
"tslint-config-airbnb": "^5.2.1",
2828
"tsutils": "1.6.0",
29-
"typescript": "^2.3.4"
29+
"typescript": "^2.4.1"
3030
}
3131
}

scripts/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)