mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-27 21:29:33 +01:00
7b0ea23cdc
* Add support for `terraform-provider-azurerm` v2.0+. Require `terraform-provider-azurerm` v2.0+ and drop v1.x support since the Azure provider major release is not backwards compatible * Use Azure's new Linux VM and Linux VM Scale Set resources * Change controller's Azure disk caching to None * Associate subnets (in addition to NICs) with security groups (aesthetic) * If set, change `worker_priority` from `Low` to `Spot` (action required) Related: * https://www.terraform.io/docs/providers/azurerm/guides/2.0-upgrade-guide.html
60 lines
1.2 KiB
HCL
60 lines
1.2 KiB
HCL
locals {
|
|
# format assets for distribution
|
|
assets_bundle = [
|
|
# header with the unpack location
|
|
for key, value in module.bootstrap.assets_dist :
|
|
format("##### %s\n%s", key, value)
|
|
]
|
|
}
|
|
|
|
# Secure copy assets to controllers.
|
|
resource "null_resource" "copy-controller-secrets" {
|
|
count = var.controller_count
|
|
|
|
depends_on = [
|
|
module.bootstrap,
|
|
azurerm_linux_virtual_machine.controllers
|
|
]
|
|
|
|
connection {
|
|
type = "ssh"
|
|
host = azurerm_public_ip.controllers.*.ip_address[count.index]
|
|
user = "core"
|
|
timeout = "15m"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = join("\n", local.assets_bundle)
|
|
destination = "$HOME/assets"
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"sudo /opt/bootstrap/layout",
|
|
]
|
|
}
|
|
}
|
|
|
|
# Connect to a controller to perform one-time cluster bootstrap.
|
|
resource "null_resource" "bootstrap" {
|
|
depends_on = [
|
|
null_resource.copy-controller-secrets,
|
|
module.workers,
|
|
azurerm_dns_a_record.apiserver,
|
|
]
|
|
|
|
connection {
|
|
type = "ssh"
|
|
host = azurerm_public_ip.controllers.*.ip_address[0]
|
|
user = "core"
|
|
timeout = "15m"
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"sudo systemctl start bootstrap",
|
|
]
|
|
}
|
|
}
|
|
|