Example Terraform Deployment to multiple cloud providers.
This lab demonstrates deploying static websites across two cloud providers using Terraform Cloud. It includes modules and resources for AWS and AzureRM providers, and deploys networking and compute instances that meet each cloud provider's requirements to maintain 99.99% uptime SLA.
This lab uses flat folder structure and DRY Terraform code, with AWS and Azure resources contained to separate files (aws.tf
and azure.tf
, respectively). Some folders are included as placeholders for future development.
The websites deployed use VM Images, built with Packer (not included in this code) as well as custom user-data deployments (for EC2).
To use this lab, you will need to perform the following steps:
-
Fork this repo and add to your Terraform Cloud as a VCS provider.
-
Provide the list of variables as HCL variables.
NOTE: Add your own custom VM images, as the ones listed in this code are not publically available.
-
Add the following case-sensitive environmental variables for your cloud credentials into Terraform Cloud from your cloud providers.
-
Begin your plan and apply runs to confirm functionality.
-
Cleanup resources with
terraform destroy
tasks.
Name | Version |
---|---|
terraform | >= 1.1.0 |
aws | >= 4.54.0 |
azurerm | ~> 3.43.0 |
Name | Version |
---|---|
aws | >= 4.54.0 |
azurerm | ~> 3.43.0 |
Name | Source | Version |
---|---|---|
AWS VPC | terraform-aws-modules/vpc/aws | >= 3.19.0 |
AWS Instance | terraform-aws-modules/ec2-instance/aws | >= 4.3.0 |
AWS ALB | terraform-aws-modules/alb/aws | >=6.4.0 |
Azure Linux Servers | Azure/compute/azurerm | >= 5.1.0 |
Name | Type |
---|---|
aws_security_group.sg | resource |
aws_security_group_rule.public | resource |
aws_security_group_rule.private | resource |
azurerm_resource_group.rg01 | resource |
azurerm_virtual_network.vnet | resource |
azurerm_subnet.subnets | resource |
azurerm_network_security_group.public | resource |
azurerm_network_security_group.private | resource |
azurerm_network_security_rule.public | resource |
azurerm_network_security_rule.private | resource |
azurerm_public_ip.pip | resource |
azurerm_lb.public_lb | resource |
azurerm_lb_probe.public_lb | resource |
azurerm_lb_rule.public_lb | resource |
azurerm_lb_backend_address_pool.public_lb | resource |
random_password.azure | resource |
Name | Description | Type | Default |
---|---|---|---|
env | Global environment tier for naming conventions | string | none |
tags | Global tagging details | map | none |
aws_load_balancer | AWS Load Balancer details | map | none |
aws_private_rules | AWS Private Subnet rules | map | none |
aws_public_rules | AWS Public Subnet rules | map | none |
aws_region | AWS region | string | none |
aws_security_groups | AWS Security Groups (Public and Private) details | map | none |
instance | AWS EC2 details | map | none |
vpc | AWS Virtual Private Cloud (Network) details | map | none |
azure_load_balancer | Azure Load Balancer details | map | none |
azure_linux_vms | Azure VM details | map | none |
nsg | Azure Network Security Groups (Public and Private) | map | none |
nsg_rules_private | Azure Private Subnet rules | map | none |
nsg_rules_public | Azure Public Subnet rules | map | none |
rg | Azure Resource Group details | map | none |
subnets | Azure Subnet details | map | none |
vnet | Azure Virtual Network details | map | none |
Name | Description |
---|---|
aws_lb_url | AWS Load Balancer URL |
azure_lb_url | Azure Load Balancer URL |