mirror of
https://github.com/puppetmaster/typhoon.git
synced 2024-12-26 08:29:34 +01:00
d6d9e6c4b9
* Replace v0.11 bracket type hints with Terraform v0.12 list expressions * Use expression syntax instead of interpolated strings, where suggested * Update Google Cloud tutorial and worker pools documentation * Define Terraform and plugin version requirements in versions.tf * Require google ~> 2.5 to support Terraform v0.12 * Require ct ~> 0.3.2 to support Terraform v0.12
93 lines
2.4 KiB
HCL
93 lines
2.4 KiB
HCL
# Secure copy etcd TLS assets to controllers.
|
|
resource "null_resource" "copy-controller-secrets" {
|
|
count = var.controller_count
|
|
|
|
connection {
|
|
type = "ssh"
|
|
host = element(local.controllers_ipv4_public, count.index)
|
|
user = "core"
|
|
timeout = "15m"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_ca_cert
|
|
destination = "$HOME/etcd-client-ca.crt"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_client_cert
|
|
destination = "$HOME/etcd-client.crt"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_client_key
|
|
destination = "$HOME/etcd-client.key"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_server_cert
|
|
destination = "$HOME/etcd-server.crt"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_server_key
|
|
destination = "$HOME/etcd-server.key"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_peer_cert
|
|
destination = "$HOME/etcd-peer.crt"
|
|
}
|
|
|
|
provisioner "file" {
|
|
content = module.bootkube.etcd_peer_key
|
|
destination = "$HOME/etcd-peer.key"
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"sudo mkdir -p /etc/ssl/etcd/etcd",
|
|
"sudo mv etcd-client* /etc/ssl/etcd/",
|
|
"sudo cp /etc/ssl/etcd/etcd-client-ca.crt /etc/ssl/etcd/etcd/server-ca.crt",
|
|
"sudo mv etcd-server.crt /etc/ssl/etcd/etcd/server.crt",
|
|
"sudo mv etcd-server.key /etc/ssl/etcd/etcd/server.key",
|
|
"sudo cp /etc/ssl/etcd/etcd-client-ca.crt /etc/ssl/etcd/etcd/peer-ca.crt",
|
|
"sudo mv etcd-peer.crt /etc/ssl/etcd/etcd/peer.crt",
|
|
"sudo mv etcd-peer.key /etc/ssl/etcd/etcd/peer.key",
|
|
"sudo chown -R etcd:etcd /etc/ssl/etcd",
|
|
"sudo chmod -R 500 /etc/ssl/etcd",
|
|
]
|
|
}
|
|
}
|
|
|
|
# Secure copy bootkube assets to ONE controller and start bootkube to perform
|
|
# one-time self-hosted cluster bootstrapping.
|
|
resource "null_resource" "bootkube-start" {
|
|
depends_on = [
|
|
module.bootkube,
|
|
module.workers,
|
|
google_dns_record_set.apiserver,
|
|
null_resource.copy-controller-secrets,
|
|
]
|
|
|
|
connection {
|
|
type = "ssh"
|
|
host = element(local.controllers_ipv4_public, 0)
|
|
user = "core"
|
|
timeout = "15m"
|
|
}
|
|
|
|
provisioner "file" {
|
|
source = var.asset_dir
|
|
destination = "$HOME/assets"
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"sudo mv $HOME/assets /opt/bootkube",
|
|
"sudo systemctl start bootkube",
|
|
]
|
|
}
|
|
}
|
|
|