Terraform as an Infra-Magic Tool

You guys may be thinking like what’s this Infra-Magic…🤔

Don’t worry, its simply an open-source infrastructure as code software tool…means we can setup the required infrastructure simply with a code, even without going to that ?

Now question is 🤔 where to setup the infrastructure …. ?

Mostly people use it with multiple clouds like AWS, AZure, GCP etc, But is it only restricted to that ? Does it only restricted to these public/private clouds ?

Answer is absolutely no…🤩

How???? Lets see today!!!

Do you remember why we have come up with the concepts of Containerization ? Absolutely it was regarding the speed and time for the environment setup…….Later we come up with the concept of Kubernetes that is a open-source system that is used for automating deployment, scaling, and management of containerized applications.

If you know about kubernetes(k8s), then you must remember that we work on a multi node cluster, whats that ?

A Kubernetes cluster is a set of node machines for running containerized applications. If you’re running Kubernetes, you’re running a cluster. At a minimum, a cluster contains a control plane and one or more compute machines, or nodes.

This is a small statement but provide deep insights about a kubernetes cluster. A kubernetes cluster is as equivalent to a cloud that can provide resources on-premises basis whenever required by the container, that would be launched and maintained within this container.

Now lets come to the interesting fact !!! 🤔

Is it possible to setup the required Infrastructure on a Kubernetes cluster using Terraform ??

The answer is absolutely Yesssss……..😎

Lets come to the documentaion of HashiCorp documentation!!!

Terraform have something for kubernetes, what’s that?

Since we already have kubectl to configure or setup container or any infrastructure over kubernetes cluster, also if we have requirement to write up a script then we can create a YAML script. But why to use Terraform ? 🤔

Orchestration with Terraform presents a few benefits.

  • Use the same configuration language to provision the Kubernetes infrastructure and to deploy applications into it.
  • drift detection — terraform plan will always present you the difference between reality at a given time and config you intend to apply.
  • full lifecycle management — Terraform doesn’t just initially create resources, but offers a single command for creation, update, and deletion of tracked resources without needing to inspect the API to identify those resources.
  • synchronous feedback — While asynchronous behaviour is often useful, sometimes it’s counter-productive as the job of identifying operation result (failures or details of created resource) is left to the user. e.g. you don’t have IP/hostname of load balancer until it has finished provisioning, hence you can’t create any DNS record pointing to it.
  • graph of relationship — Terraform understands relationships between resources which may help in scheduling — e.g. if a Persistent Volume Claim claims space from a particular Persistent Volume Terraform won’t even attempt to create the PVC if creation of the PV has failed.

What’s the plan to see how it actually works ?🤔

How to connect to kubernetes cluster using Terraform:-

Here our provider is kubernetes

Its just about connecting, but what about the plan if we setup everything with Terraform with Kubernetes !! 😎

So I am gonna try every setup on kubernetes using terraform !! Stay tuned for the further articles ….

I hope you got my point that why I describe Terraform as Infra-Magic 😉 Lets use this magic to create interesting and useful Integrations……🤟🏻

Till the time, stay tuned…..Keep Learning, Keep Sharing⭐

Thank you😇

I am a tech enthusiast, researcher and work for integrations. I love to explore and learn about the new technologies and their right concepts from its core.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store