|
| 1 | +## |
| 2 | +# Terraform AWS reference architecture |
| 3 | +# |
| 4 | + |
| 5 | +.PHONY: init |
| 6 | +init: |
| 7 | + @terraform init |
| 8 | + |
| 9 | +touch-kubeconfig: |
| 10 | + @touch kubeconfig |
| 11 | + |
| 12 | +cleanup-kubeconfig: |
| 13 | + @rm kubeconfig |
| 14 | + |
| 15 | +.PHONY: plan |
| 16 | +plan: touch-kubeconfig plan-cluster plan-cm-edns cleanup-kubeconfig |
| 17 | + |
| 18 | +.PHONY: apply |
| 19 | +apply: apply-cluster apply-tools |
| 20 | + |
| 21 | +.PHONY: destroy |
| 22 | +destroy: destroy-tools destroy-cluster |
| 23 | + |
| 24 | +.PHONY: plan-cluster |
| 25 | +plan-cluster: |
| 26 | + @terraform plan -target=module.aks |
| 27 | + |
| 28 | +.PHONY: plan-tools |
| 29 | +plan-tools: plan-cm-edns plan-cluster-issuer |
| 30 | + |
| 31 | +.PHONY: plan-cm-edns |
| 32 | +plan-cm-edns: |
| 33 | + @terraform plan -target=module.certmanager -target=module.externaldns |
| 34 | + |
| 35 | +.PHONY: plan-cluster-issuer |
| 36 | +plan-cluster-issuer: |
| 37 | + @terraform plan -target=module.cluster-issuer |
| 38 | + |
| 39 | +.PHONY: apply-cluster |
| 40 | +apply-cluster: |
| 41 | + @terraform apply -target=module.aks --auto-approve |
| 42 | + |
| 43 | +.PHONY: apply-tools |
| 44 | +apply-tools: install-cm-edns install-cluster-issuer |
| 45 | + |
| 46 | +.PHONY: install-cm-edns |
| 47 | +install-cm-edns: |
| 48 | + @terraform apply -target=module.certmanager -target=module.externaldns --auto-approve |
| 49 | + |
| 50 | +PHONY: install-cluster-issuer |
| 51 | +install-cluster-issuer: |
| 52 | + @terraform apply -target=module.cluster-issuer --auto-approve |
| 53 | + |
| 54 | +.PHONY: destroy-cluster |
| 55 | +destroy-cluster: |
| 56 | + @terraform destroy -target=module.aks --auto-approve |
| 57 | + |
| 58 | +.PHONY: destroy-tools |
| 59 | +destroy-tools: destroy-cluster-issuer destroy-cm-edns |
| 60 | + |
| 61 | +.PHONY: destroy-cm-edns |
| 62 | +destroy-cm-edns: |
| 63 | + @terraform destroy -target=module.certmanager -target=module.externaldns --auto-approve |
| 64 | + |
| 65 | +.PHONY: destroy-cluster-issuer |
| 66 | +destroy-cluster-issuer: |
| 67 | + @terraform destroy -target=module.cluster-issuer --auto-approve || echo "Could not remove cluster-issuer" |
| 68 | + |
| 69 | +## Output targets |
| 70 | + |
| 71 | +.PHONY: refresh |
| 72 | +refresh: |
| 73 | + @echo "Refreshing terraform state" |
| 74 | + @terraform refresh |
| 75 | + @echo "" |
| 76 | + @echo "Done!" |
| 77 | + |
| 78 | +.PHONY: output |
| 79 | +output: refresh output-done-msg output-url output-nameservers output-registry output-database output-storage output-issuer |
| 80 | + |
| 81 | +output-done-msg: |
| 82 | + @echo "" |
| 83 | + @echo "" |
| 84 | + @echo "==========================" |
| 85 | + @echo "🎉🥳🔥🧡🚀" |
| 86 | + @echo "Your AWS cloud infrastructure is ready to install Gitpod. Please visit" |
| 87 | + @echo "https://www.gitpod.io/docs/self-hosted/latest/getting-started#step-4-install-gitpod" |
| 88 | + @echo "for your next steps." |
| 89 | + @echo "=================" |
| 90 | + @echo "Config Parameters" |
| 91 | + @echo "=================" |
| 92 | + |
| 93 | +output-url: |
| 94 | + @echo "" |
| 95 | + @echo "Gitpod domain name:" |
| 96 | + @echo "=================" |
| 97 | + @terraform output -json url | jq |
| 98 | + |
| 99 | +output-nameservers: |
| 100 | + @echo "" |
| 101 | + @echo "Nameservers for the domain(to be added as NS records in your domain provider):" |
| 102 | + @echo "=================" |
| 103 | + @terraform output -json nameservers | jq |
| 104 | + |
| 105 | +output-storage: |
| 106 | + @echo "" |
| 107 | + @echo "Azure Object storage:" |
| 108 | + @echo "==============" |
| 109 | + @terraform output -json storage | jq |
| 110 | + |
| 111 | +output-registry: |
| 112 | + @echo "" |
| 113 | + @echo "Container registry:" |
| 114 | + @echo "==================" |
| 115 | + @terraform output -json registry | jq |
| 116 | + |
| 117 | +output-database: |
| 118 | + @echo "" |
| 119 | + @echo "Database:" |
| 120 | + @echo "========" |
| 121 | + @terraform output -json database | jq |
| 122 | + |
| 123 | +output-issuer: |
| 124 | + @echo "" |
| 125 | + @echo "ClusterIssuer name:" |
| 126 | + @echo "=================" |
| 127 | + @terraform output -json cluster_issuer | jq |
| 128 | + |
| 129 | +# end |
0 commit comments