-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (40 loc) · 1.43 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.PHONY: remote update plan apply .terraform clean
DEPS= frontend/node_modules \
common/node_modules \
beacon/node_modules \
db/node_modules
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
bucket: ## Make me a bucket. S3 bucket as a way to manage the terraform state remotely
@test "${BUCKET}" || (echo '$$BUCKET name required' && exit 1)
aws s3 mb s3://$(BUCKET)
remote: ## Anyone who is making changes to terraform will then want to configure terraform to pull from the remote state.
@test "${BUCKET}" || (echo '$$BUCKET name required' && exit 1)
@terraform remote config \
-backend=s3 \
-backend-config="bucket=$(BUCKET)" \
-backend-config="key=/terraform"
.terraform:
terraform get -update=true
plan: ## See Terraform changes
terraform plan --out plan
apply: ## Apply Terraform changes
terraform apply plan
copy-key: ## Copy SSH key to Bastion host.
@test "${IP}" || (echo 'bastion $$IP required' && exit 1)
@scp -i keys/bastion-ssh \
keys/bastion-ssh \
ubuntu@${IP}:/home/ubuntu/.ssh/key.pem
keys: ##If you don't have ssh keys in AWS, you can create them.
mkdir -p keys
ssh-keygen \
-C 'Generated by Stack' \
-f 'keys/bastion-ssh'
docker: $(DEPS)
@docker build -t frontend .
@docker build -t beacon ./beacon
${DEPS}:
@cd `dirname $@` && npm i
clean:
@rm -rf plan .terraform terraform.tfstate.backup