Multicloud using terraform

how to create/manage a multi-cloud environment using terraform?

Hi @cadentic,

This is a very broad question and so I expect you probably won’t get very specific answers to it.

Deploying something across multiple cloud vendors with different service offerings will require first deciding what services you intend to use that have “close enough” equivalents across all of the cloud platforms you intend to use, and then working to implement an equivalent baseline of infrastructure across all of them that you can then run something platform-agnostic on top of.

One example (though this is not a direct recommendation) is to observe that many cloud platforms now offer managed or partially-managed Kubernetes clusters, which can in principle (if configured appropriately) offer consistent functionality to jobs running on those clusters regardless of which vendor is hosting the cluster.

If you decided that Kubernetes clusters will be your common abstraction across multiple cloud platforms then your work would be to write one or more Terraform modules for each platform you which to use which sets up the platform-specific underlying infrastructure (networks, etc) and the cluster itself, and then apply those to create a set of Kubernetes clusters that are all equivalent as far as your application is concerned. You could then use the Kubernetes API to deploy the same services across multiple of these clusters, thereby achieving a “multi-cloud” architecture.

Kubernetes is not the only option here and so I’d encourage investigating other approaches too, but the general approach remains the same: implement some equivalent abstraction across multiple platforms using the services provided by that platform, and then build platform-agnostic components on top of that abstraction.

that won’t be multicloud it will be another hybrid cloud.

Hi @cadentic,

I think you have some specific meanings of these terms in your mind when you ask this question, but since you haven’t defined what you intend to do I cannot really answer in any real detail.

The usual meaning of “hybrid cloud” I’m accustomed to is the idea of mixing both cloud infrastructure and on-premises infrastructure in a single design. For Terraform’s purposes that is not materially different than “Multi-cloud” (using multiple different cloud platforms together as part of a single design), as long as both the cloud platforms you intend to use and the on-premises management platform you intend to use both have Terraform providers available with sufficient functionality to describe the infrastructure you need in each platform.

In both cases the answer is the same: use Terraform to declare the appropriate infrastructure in each target platform, and typically (but not necessarily) aim to create some sort of abstraction that allows higher layers to treat the infrastructure as the same regardless of which platform it is running on.

Or if you just mean using multiple clouds (rather than trying to treat them as a common platform) just write the Terraform code you need.

There is no problem with having AWS EC2 resources next to GCP managed Kubernetes resources, etc.