3. Infra-as-code (Terraform)
To deploy the solution to the cloud there are several ways that we can choose. In this case, we will use terraform Infra-as-code.
Last updated
Was this helpful?
Was this helpful?
git clone https://github.com/egovernments/DIGIT-DevOps.git
cd DIGIT-DevOps
git checkout kubernetes-1.34
code .
cd infra-as-code/terraform/azure
### You'll see the following file structure
├── azure
│ ├── main.tf
│ ├── outputs.tf
│ ├── providers.tf
│ ├── remote-state
│ │ └── main.tf
│ └── variables.tf
└── modules
├── db
│ ├── aws
│ | ├── main.tf
│ │ ├── outputs.tf
│ | └── variables.tf
│ └── azure
│ ├── main.tf
│ └── variables.tf
│── kubernetes
│ └── azure
│ │
│ ├── main.tf
│ ├── outputs.tf
| └── variables.tf ##### Create the DIGIT Infra #####
az login
##### using above command you can get subscription id and tenant id
az ad sp create-for-rbac --name <sp_name> \
--role owner \
--scopes /subscriptions/<subscription_id>
##### Using above command you are creating client-id and client-secret
export ARM_SUBSCRIPTION_ID=<AZURE_SUBSCRIPTION_ID> ## update azure account subscription ID
#### DIGIT-DevOps/infra-as-code/terraform/azure (working directory)
cd DIGIT-DevOps/infra-as-code/terraform/azure
go run ../scripts/init.go
cd remote-state
terraform init
terraform plan
terraform apply
cd ..
terraform init
terraform plan
terraform applyaz aks get-credentials --resource-group <resource_group_name> --name <cluster_name>kubectl get nodes