forked from erankitcs/BookStoreAppOnEKS
/
bookstore_create_infra.sh
executable file
·49 lines (45 loc) · 1.83 KB
/
bookstore_create_infra.sh
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
#!/bin/sh
echo "Starting Bookstore Application Deployment."
curdir=$(pwd)
echo "*********** Step-1 - Creating DynamoDB Tables **************"
echo "----------Clients API DynamoDB"
cd $curdir/clients-api/infra/terraform
terraform init -input=false
#terraform plan -input=false
terraform apply -input=false -auto-approve
echo "----------Inventory API DynamoDB"
cd $curdir/inventory-api/infra/terraform
terraform init -input=false
#terraform plan -input=false
terraform apply -input=false -auto-approve
echo "----------Renting API DynamoDB"
cd $curdir/renting-api/infra/terraform
terraform init -input=false
#terraform plan -input=false
terraform apply -input=false -auto-approve
echo "----------Resource API DynamoDB"
cd $curdir/resource-api/infra/terraform
terraform init -input=false
#terraform plan -input=false
terraform apply -input=false -auto-approve
echo "***** Step-2 - VPC,EKS Cluster, IAMs, Certificates *********"
cd $curdir/infrastructure/eks/terraform
terraform init -input=false
#terraform plan -input=false
terraform apply -input=false -auto-approve
cluster_name=$(terraform output -raw cluster_name)
export FLUENTBIT_ROLE=$(terraform output -raw fluentbit_irsa_role)
aws eks update-kubeconfig --name $cluster_name --region ap-southeast-1
echo "***** Step-3 - Elastic Search in AWS *********"
cd $curdir/infrastructure/elasticsearch/terraform
terraform init -input=false
terraform apply -input=false -auto-approve
export ES_KIBANA_ENDPOINT=$(terraform output -raw es_kibana_endpoint)
export ES_ENDPOINT=$(terraform output -raw es_endpoint)
export ES_DOMAIN_USER=$(terraform output -raw es_user)
export ES_DOMAIN_PASSWORD=$(terraform output -raw es_password)
export AWS_REGION="ap-southeast-1"
echo "***** Step-4 - OpenVPN in AWS *********"
cd $curdir/infrastructure/openVPN/terraform
terraform init -input=false
terraform apply -input=false -auto-approve