44cluster_id = 1
55cloud = azure
66# Functions
7- azure_jumpbox :
7+
8+ .PHONY : help
9+ help : Makefile
10+ @sed -n ' s/^##//p' $<
11+
12+ # # init terraform init
13+ .PHONY : init
14+ init :
815 terraform init
16+
17+ # # azure_jumpbox deploys jumpbox, pushes tsb repo to acr
18+ .PHONY : azure_jumpbox
19+ azure_jumpbox :
20+ terraform apply -auto-approve -target=module.azure_base -target=module.azure_jumpbox
21+
22+ # # aws_jumpbox deploys jumpbox, pushes tsb repo to acr
23+ .PHONY : aws_jumpbox
24+ aws_jumpbox :
25+ terraform apply -auto-approve -target=module.aws_base -target=module.aws_jumpbox
26+
27+ # # k8s
28+ .PHONY : k8s
29+ k8s :
930 terraform apply -auto-approve -target=module.azure_base
10- terraform apply -auto-approve -target=module.azure_jumpbox
31+ terraform apply -auto-approve -target=module.azure_jumpbox
32+ terraform apply -auto-approve -target=module.azure_k8s
33+ terraform apply -auto-approve -target=module.aws_base
34+ terraform apply -auto-approve -target=module.aws_jumpbox
35+ terraform apply -auto-approve -target=module.aws_k8s
36+
37+ # # azure_k8s deploys azure k8s cluster for MP and N-number of CPs(*) leveraging AKS
38+ .PHONY : azure_k8s
1139azure_k8s :
12- terraform init
1340 terraform apply -auto-approve -target=module.azure_base
14- terraform apply -auto-approve -target=module.azure_jumpbox
41+ terraform apply -auto-approve -target=module.azure_jumpbox
1542 terraform apply -auto-approve -target=module.azure_k8s
16- tsb_deps :
17- terraform init
18- terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=0
19- terraform apply -auto-approve -target=module.es
43+
44+ # # aws_k8s deploys EKS K8s cluster (CPs only)
45+ .PHONY : aws_k8s
46+ aws_k8s :
47+ terraform apply -auto-approve -target=module.aws_base
48+ terraform apply -auto-approve -target=module.aws_jumpbox
49+ terraform apply -auto-approve -target=module.aws_k8s
50+
51+ .PHONY : tsb_deps
52+ tsb_deps :
53+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
54+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
55+ terraform apply -auto-approve -target=module.cert-manager -target=module.es -var=cluster_id=0 -var=cloud=azure
56+
57+ # # tsb_mp deploys MP
58+ .PHONY : tsb_mp
2059tsb_mp :
21- terraform init
60+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
61+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
2262 terraform apply -auto-approve -target=module.tsb_mp.kubectl_manifest.manifests_certs
2363 terraform apply -auto-approve -target=module.tsb_mp
24- terraform apply -auto-approve -target=module.aws_dns
64+ terraform apply -auto-approve -target=module.aws_dns -var=cluster_id=0 -var=cloud=azure
65+
66+ # # tsb_fqdn creates TSB MP FQDN
67+ .PHONY : tsb_fqdn
2568tsb_fqdn :
26- terraform apply -auto-approve -target=module.aws_dns
69+ terraform apply -auto-approve -target=module.aws_dns -var=cluster_id=0 -var=cloud=azure
70+
71+ # # tsb_cp cluster_id=1 cloud=azure onboards CP on AKS cluster with ID=1
72+ .PHONY : tsb_cp
2773tsb_cp :
2874 @echo cluster_id is ${cluster_id}
2975 @echo cloud is ${cloud}
30- terraform init
31- terraform state list | grep " ^module.cert-manager" | grep -v data | tr -d ' :' | xargs -I ' {}' terraform taint {}
32- terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=${cluster_id}
76+ # terraform state list | grep "^module.cert-manager" | grep -v data | grep -v manifest | grep -v helm | grep -v wait| tr -d ':' | xargs -I '{}' terraform taint {}
77+ terraform taint -allow-missing " module.cert-manager.time_sleep.wait_90_seconds"
3378 terraform taint -allow-missing " module.tsb_cp.null_resource.jumpbox_tctl"
79+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
80+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
81+ terraform apply -auto-approve -target=module.cert-manager -var=cluster_id=${cluster_id} -var=cloud=${cloud}
3482 terraform apply -auto-approve -target=module.tsb_cp -var=cluster_id=${cluster_id} -var=cloud=${cloud}
83+
84+ # # argocd cluster_id=1 cloud=azure onboards ArgoCD on AKS cluster with ID=1
85+ .PHONY : argocd
3586argocd :
3687 @echo cluster_id is ${cluster_id}
3788 @echo cloud is ${cloud}
89+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
90+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
3891 terraform apply -auto-approve -target=module.argocd -var=cluster_id=${cluster_id} -var=cloud=${cloud}
92+
93+ .PHONY : keycloak
3994keycloak :
95+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
96+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
4097 terraform apply -auto-approve -target=module.keycloak-helm -var=cluster_id=0
98+
99+ .PHONY : app_bookinfo
41100app_bookinfo :
42101 @echo cluster_id is ${cluster_id}
43102 @echo cloud is ${cloud}
44- terraform init
45103 terraform state list | grep " ^module.app_bookinfo" | grep -v data | tr -d ' :' | xargs -I ' {}' terraform taint {}
104+ # # working around the issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/2602
105+ terraform apply -auto-approve -target=module.azure_k8s -target=module.aws_base -target=module.aws_jumpbox
46106 terraform apply -auto-approve -target=module.app_bookinfo -var=cluster_id=${cluster_id} -var=cloud=${cloud}
107+
108+ .PHONY : azure_oidc
47109azure_oidc :
48- terraform init
49110 terraform apply -auto-approve -target=module.azure_oidc
111+
112+ # # destroy destroy the environment
113+ .PHONY : destroy
50114destroy :
51115 terraform destroy -refresh=false -target=module.aws_dns
52- terraform destroy -refresh=false -target=module.azure_k8s
53- terraform destroy -refresh=false -target=module.azure_base
54- terraform destroy -refresh=false -target=module.azure_jumpbox
116+ terraform state list | grep " ^module.tsb" | xargs -I ' {}' terraform state rm {}
117+ terraform state list | grep " ^module.cert" | xargs -I ' {}' terraform state rm {}
118+ terraform state list | grep " ^module.argo" | xargs -I ' {}' terraform state rm {}
119+ terraform state list | grep " ^module.es" | xargs -I ' {}' terraform state rm {}
120+ terraform state list | grep " ^module.keycloak" | xargs -I ' {}' terraform state rm {}
121+ terraform state list | grep " ^module.app" | xargs -I ' {}' terraform state rm {}
122+ terraform destroy -refresh=false -target=module.aws_k8s -target=module.aws_jumpbox -target=module.aws_base
123+ terraform destroy -refresh=false -target=module.azure_k8s -target=module.azure_jumpbox -target=module.azure_base
55124 terraform destroy -refresh=false
56125 terraform destroy
0 commit comments