DEV Community

Cover image for How to create AKS using Terraform - Part 2
MakendranG
MakendranG

Posted on • Edited on

How to create AKS using Terraform - Part 2

In this article, We will see how to create AKS cluster using Hashicorp Terraform

How to create AKS using Terraform

- How to create AKS using Terraform - Part 1
- How to create AKS using Terraform - Part 2

Terraform files

provider.tf

This file contains subscription details and backend details where we are going to store the tfstate file.

main.tf

This file will create the AKS cluster with log analytics workspace.

variables.tf

This file contains all the variable details.

outputs.tf

Once the cluster created, we need some details to access the Kubernetes, with outputs.tf files we can get those details.

Once all the files created, lets start the execution.

Terraform initialization

terraform init
Enter fullscreen mode Exit fullscreen mode

Execute the above command to initialize the Terraform deployment. This command downloads the Azure modules required to manage our Azure resources.

Terraform plan execution

terraform plan
Enter fullscreen mode Exit fullscreen mode

Execute the above command to create an execution plan. This command creates an execution plan, however doesn’t execute it. Instead, it determines what moves are critical to create the configuration targeted in our configuration files. This sample approves us to confirm whether the execution format suits our expectations before making any modifications to true resources.

Applying the Terraform Execution Plan

terraform apply
Enter fullscreen mode Exit fullscreen mode

Execute the above command to use the execution plan to our cloud infrastructure.

Gratitude for perusing my article till end.I hope you learned some thing specific today. If you loved this article then please share to your pals and if you have suggestions or thoughts to share with me then please write in the comment box.

Above blog is submitted as part of 'Devtron Blogathon 2022' - https://devtron.ai/
Check out Devtron's GitHub repo - https://github.com/devtron-labs/devtron/ and give a ⭐ to show your love & support.
Follow Devtron on LinkedIn - https://www.linkedin.com/company/devtron-labs/ and Twitter - https://twitter.com/DevtronL/, to keep yourself updated on this Open Source project.

Top comments (0)