Multy
Multy - Easily deploy multi cloud infrastructure. Write cloud-agnostic config deployed across multiple clouds
Install / Use
/learn @multycloud/MultyREADME
What is Multy?
Multy is an open-source tool that makes your infrastructure portable using a cloud-agnostic API. You write your cloud-agnostic configuration once and Multy deploys it to the clouds you choose.
With Multy, you don't need to worry about how resources behave differently in the different clouds providers.
We abstract the nuances of each cloud so that moving your infrastructure between clouds is done by simply changing
the cloud parameter.
Example
Let's try to deploy a simple virtual machine into AWS and Azure using the Multy Terraform Provider
variable "clouds" {
type = set(string)
default = ["aws", "azure"]
}
resource "multy_virtual_network" "vn" {
for_each = var.clouds
cloud = each.key
name = "multy_vn"
cidr_block = "10.0.0.0/16"
location = "eu_west_1"
}
resource "multy_subnet" "subnet" {
for_each = var.clouds
name = "multy_subnet"
cidr_block = "10.0.10.0/24"
virtual_network_id = multy_virtual_network.vn[each.key].id
}
resource "multy_virtual_machine" "vm" {
for_each = var.clouds
name = "test_vm"
size = "general_micro"
image_reference = {
os = "ubuntu"
version = "20.04"
}
subnet_id = multy_subnet.subnet[each.key].id
cloud = each.key
location = "eu_west_1"
}
By using the Multy cloud-agnostic API, we can simply change the cloud parameter to move a resource from one cloud to
another.
If we were to deploy this using the respective cloud terraform providers, we would first need to understand how
resources such as aws_vpc and azurerm_virtual_network behave and how they differ. Then we would need to define the
same infrastructure configuration twice, one for AWS and another for Azure.
// terraform: 190 lines
resource "aws_iam_instance_profile" "multy_vm_ube3b_r10" {
name = "multy_vm_ube3b_r10-vm-role"
role = aws_iam_role.multy_vm_ube3b_r10.name
provider = "aws.eu-west-1"
}
resource "aws_iam_role" "multy_vm_ube3b_r10" {
tags = { "Name" = "test_vm" }
name = "multy_vm_ube3b_r10-vm-role"
assume_role_policy = "{\"Statement\":[{\"Action\":[\"sts:AssumeRole\"],\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"ec2.amazonaws.com\"}}],\"Version\":\"2012-10-17\"}"
provider = "aws.eu-west-1"
}
data "aws_ami" "multy_vm_ube3b_r10" {
owners = ["099720109477"]
most_recent = true
filter {
name = "name"
values = ["ubuntu*-20.04-amd64-server-*"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
provider = "aws.eu-west-1"
}
resource "aws_instance" "multy_vm_ube3b_r10" {
tags = { "Name" = "test_vm" }
ami = data.aws_ami.multy_vm_ube3b_r10.id
instance_type = "t2.micro"
subnet_id = aws_subnet.multy_vn_ube3b_r8-1.id
iam_instance_profile = aws_iam_instance_profile.multy_vm_ube3b_r10.id
provider = "aws.eu-west-1"
}
resource "azurerm_network_interface" "multy_vm_ube3b_r9" {
resource_group_name = azurerm_resource_group.vm-nkum-rg.name
name = "test_vm"
location = "northeurope"
ip_configuration {
name = "internal"
private_ip_address_allocation = "Dynamic"
subnet_id = azurerm_subnet.multy_vn_ube3b_r7.id
primary = true
}
}
resource "random_password" "multy_vm_ube3b_r9" {
length = 16
special = true
upper = true
lower = true
number = true
}
resource "azurerm_linux_virtual_machine" "multy_vm_ube3b_r9" {
resource_group_name = azurerm_resource_group.vm-nkum-rg.name
name = "test_vm"
location = "northeurope"
size = "Standard_B1s"
network_interface_ids = [azurerm_network_interface.multy_vm_ube3b_r9.id]
os_disk {
caching = "None"
storage_account_type = "Standard_LRS"
}
admin_username = "adminuser"
admin_password = random_password.multy_vm_ube3b_r9.result
source_image_reference {
publisher = "Canonical"
offer = "0001-com-ubuntu-server-focal"
sku = "20_04-lts"
version = "latest"
}
disable_password_authentication = false
identity {
type = "SystemAssigned"
}
computer_name = "testvm"
zone = "1"
}
resource "aws_vpc" "multy_vn_ube3b_r4" {
tags = { "Name" = "multy_vn" }
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
provider = "aws.eu-west-1"
}
resource "aws_internet_gateway" "multy_vn_ube3b_r4" {
tags = { "Name" = "multy_vn" }
vpc_id = aws_vpc.multy_vn_ube3b_r4.id
provider = "aws.eu-west-1"
}
resource "aws_default_security_group" "multy_vn_ube3b_r4" {
tags = { "Name" = "multy_vn" }
vpc_id = aws_vpc.multy_vn_ube3b_r4.id
ingress {
protocol = "-1"
from_port = 0
to_port = 0
self = true
}
egress {
protocol = "-1"
from_port = 0
to_port = 0
self = true
}
provider = "aws.eu-west-1"
}
resource "aws_vpc" "multy_vn_ube3b_r5" {
tags = { "Name" = "multy_vn" }
cidr_block = "10.0.0.0/16"
enable_dns_hostnames = true
provider = "aws.eu-west-1"
}
resource "aws_internet_gateway" "multy_vn_ube3b_r5" {
tags = { "Name" = "multy_vn" }
vpc_id = aws_vpc.multy_vn_ube3b_r5.id
provider = "aws.eu-west-1"
}
resource "aws_default_security_group" "multy_vn_ube3b_r5" {
tags = { "Name" = "multy_vn" }
vpc_id = aws_vpc.multy_vn_ube3b_r5.id
ingress {
protocol = "-1"
from_port = 0
to_port = 0
self = true
}
egress {
protocol = "-1"
from_port = 0
to_port = 0
self = true
}
provider = "aws.eu-west-1"
}
resource "azurerm_virtual_network" "multy_vn_ube3b_r6" {
resource_group_name = azurerm_resource_group.vn-nkum-rg.name
name = "multy_vn"
location = "northeurope"
address_space = ["10.0.0.0/16"]
}
resource "azurerm_route_table" "multy_vn_ube3b_r6" {
resource_group_name = azurerm_resource_group.vn-nkum-rg.name
name = "multy_vn"
location = "northeurope"
route {
name = "local"
address_prefix = "0.0.0.0/0"
next_hop_type = "VnetLocal"
}
}
resource "azurerm_subnet" "multy_vn_ube3b_r7" {
resource_group_name = azurerm_resource_group.vn-nkum-rg.name
name = "multy_subnet"
address_prefixes = ["10.0.10.0/24"]
virtual_network_name = azurerm_virtual_network.multy_vn_ube3b_r6.name
}
resource "azurerm_subnet_route_table_association" "multy_vn_ube3b_r7" {
subnet_id = azurerm_subnet.multy_vn_ube3b_r7.id
route_table_id = azurerm_route_table.multy_vn_ube3b_r6.id
}
resource "aws_subnet" "multy_vn_ube3b_r8-1" {
tags = { "Name" = "multy_subnet-1" }
cidr_block = "10.0.10.0/25"
vpc_id = aws_vpc.multy_vn_ube3b_r5.id
availability_zone = "eu-west-1a"
provider = "aws.eu-west-1"
}
resource "aws_subnet" "multy_vn_ube3b_r8-2" {
tags = { "Name" = "multy_subnet-2" }
cidr_block = "10.0.10.128/26"
vpc_id = aws_vpc.multy_vn_ube3b_r5.id
availability_zone = "eu-west-1b"
provider = "aws.eu-west-1"
}
resource "aws_subnet" "multy_vn_ube3b_r8-3" {
tags = { "Name" = "multy_subnet-3" }
cidr_block = "10.0.10.192/26"
vpc_id = aws_vpc.multy_vn_ube3b_r5.id
availability_zone = "eu-west-1c"
provider = "aws.eu-west-1"
}
resource "azurerm_resource_group" "vm-nkum-rg" {
name = "vm-nkum-rg"
location = "northeurope"
}
resource "azurerm_resource_group" "vn-nkum-rg" {
name = "vn-nkum-rg"
location = "northeurope"
}
</p>
</details>
With Multy, you write once, and deploy anywhere.
Getting started
- Install Terraform - see guide, e.g.:
- Brew (Homebrew/Mac OS):
brew tap hashicorp/tap && brew install hashicorp/tap/terraform - Choco (Chocolatey/Windows):
choco install terraform - Debian (Ubuntu/Linux):
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" sudo apt-get update && sudo apt-get install terraform
-
Create an account with AWS or Azure and expose its authentication credentials via environment variables
-
Write your configuration file, for example a file named
main.tfwith the following content:terraform { required_providers { multy = { source = "multycloud/multy" } } } provider
