aztack/terraform/main.tf

155 строки
4.5 KiB
HCL

# Configure the Microsoft Azure Provider
provider "azurerm" {
subscription_id = "${var.azure["subscription_id"]}"
client_id = "${var.azure["client_id"]}"
client_secret = "${var.azure["client_secret"]}"
tenant_id = "${var.azure["tenant_id"]}"
}
resource "azurerm_resource_group" "main" {
name = "${ var.name }"
location = "${ var.location }"
}
module "vnet" {
source = "./modules/vnet"
depends-id = ""
# variables
name = "${ var.name }"
location = "${ var.location }"
cidr = "${ var.cidr["vnet"] }"
# modules
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "dns" {
source = "./modules/dns"
depends-id = "${ module.vnet.depends-id }"
# variables
etcd-ips = "${ var.etcd-ips }"
internal-tld = "${ var.internal-tld }"
name = "${ var.name }"
# modules
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "storage_account" {
source = "./modules/storage_account"
depends-id = "${ module.vnet.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
# modules
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "image" {
source = "./modules/image"
depends-id = "${ module.vnet.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
azure_vhd_uri = "${ var.azure_vhd_uri }"
# modules
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "load_balancer" {
source = "./modules/load_balancer"
depends-id = "${ module.vnet.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
kube-api-internal-ip = "${ var.kube-api-internal-ip }"
# modules
private-subnet-id = "${ module.vnet.private-subnet-id }"
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "bastion" {
source = "./modules/bastion"
depends-id = "${ module.dns.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
# modules
private-subnet-id = "${ module.vnet.private-subnet-id }"
storage_endpoint = "${ module.storage_account.primary_blob_endpoint }"
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "etcd" {
source = "./modules/etcd"
depends-id = "${ module.bastion.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
etcd-ips = "${ var.etcd-ips }"
internal-tld = "${ var.internal-tld }"
# modules
private-subnet-id = "${ module.vnet.private-subnet-id }"
storage_endpoint = "${ module.storage_account.primary_blob_endpoint }"
image_id = "${ module.image.image_id }"
bastion-ip = "${ module.bastion.public-ip }"
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "controller" {
source = "./modules/controller"
depends-id = "${ module.bastion.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
master_count = "${ var.master_count }"
etcd-ips = "${ var.etcd-ips }"
dns-service-ip = "${ var.dns-service-ip }"
pod-cidr = "${ var.cidr["pods"] }"
service-cidr = "${ var.cidr["service-cluster"] }"
azure = "${ var.azure }"
internal-tld = "${ var.internal-tld }"
# modules
private-subnet-id = "${ module.vnet.private-subnet-id }"
storage_endpoint = "${ module.storage_account.primary_blob_endpoint }"
image_id = "${ module.image.image_id }"
bastion-ip = "${ module.bastion.public-ip }"
backend_pool_ids = ["${ module.load_balancer.public_backend_pool_id }", "${ module.load_balancer.private_backend_pool_id }"]
resource_group_name = "${ azurerm_resource_group.main.name }"
}
module "node" {
source = "./modules/node"
depends-id = "${ module.bastion.depends-id }"
# variables
name = "${ var.name }"
location = "${ var.location }"
node_count = "${ var.node_count }"
dns-service-ip = "${ var.dns-service-ip }"
pod-cidr = "${ var.cidr["pods"] }"
internal-tld = "${ var.internal-tld }"
kube-api-internal-ip = "${ var.kube-api-internal-ip }"
# modules
private-subnet-id = "${ module.vnet.private-subnet-id }"
storage_endpoint = "${ module.storage_account.primary_blob_endpoint }"
image_id = "${ module.image.image_id }"
bastion-ip = "${ module.bastion.public-ip }"
resource_group_name = "${ azurerm_resource_group.main.name }"
}