1
0
Fork 0
terraform-playground/single-host/server.tf

25 lines
776 B
Terraform
Raw Normal View History

2022-05-23 11:37:13 +00:00
resource "hcloud_server" "single-server1" {
name = "single-server1"
image = var.os_type
server_type = var.server_type
location = var.location
labels = {
type = "single"
}
ssh_keys = [hcloud_ssh_key.default.id]
2022-05-23 11:37:13 +00:00
# TODO: user_data seems to have no effect on VM yet
2022-05-23 11:37:13 +00:00
user_data = jsonencode({
"users": {
"name": "ansible",
"groups": ["users", "admin"],
"sudo": "ALL=(ALL) NOPASSWD:ALL",
"shell": "/bin/bash",
2022-05-23 11:37:13 +00:00
# TODO: have some sort of lookup for the pubkey (include from file?)
2022-05-23 11:37:13 +00:00
"ssh_authorized_keys": ["ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE32LygGZyJonoWVjRgQ0Hq8iy39aLs+oH5Flmn9RhAj terraform melpomene"]
},
"package_update": true,
"package_upgrade": true
})
firewall_ids = [hcloud_firewall.single-firewall.id]
}