-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
91 lines (76 loc) · 3.3 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#Tags
TERRAFORM_VERSION=0.15.4
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
terraform-init: ## Run terraform init to download all necessary plugins
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform init -upgrade=true
terraform-plan: ## Run terraform plan, to prepare the infraestructure
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform plan -out="terraform_plan"
terraform-new-workspace-canary: ## Create workspace CANARY for tests
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform workspace new canary
terraform-new-workspace-stable: ## Create workspace STABLE for final release
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform workspace new stable
terraform-select-workspace-stable: ## Select workspace stable
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform workspace select stable
terraform-select-workspace-canary: ## Select workspace canary
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform workspace select canary
terraform-apply: ## Run terraform apply, apply the PLAN
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform apply "terraform_plan"
terraform-destroy: ## Run terraform destroy, destroy applied PLAN
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
-chdir=Terraform destroy -auto-approve
terraform-cli: ## Run terraform container to manage CLI commands
docker container run --rm \
--mount type=bind,src=$$PWD,target=/app \
--mount type=bind,src=$$HOME/.ssh,target=/root/.ssh \
-w /app/ \
-e GOOGLE_APPLICATION_CREDENTIALS=/app/Terraform/credentials.json \
hashicorp/terraform:$(TERRAFORM_VERSION) \
sh