commit 4a1ed77c445d12711461a5e2343bfb7f78dda07e Author: John Kubach <johnkubach@gmail.com> Date: Thu, 23 Sep 2021 15:40:39 -0400 Add DigitalOcean Freebsd Droplet Diffstat:
A | freebsd-droplet/bsd-server01.tf | | | 27 | +++++++++++++++++++++++++++ |
A | freebsd-droplet/provider.tf | | | 19 | +++++++++++++++++++ |
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/freebsd-droplet/bsd-server01.tf b/freebsd-droplet/bsd-server01.tf @@ -0,0 +1,27 @@ +resource "digitalocean_droplet" "bsd-server01" { + image = "freebsd-12-x64-zfs" + name = "bsd-server01" + region = "nyc3" + size = "s-1vcpu-1gb" + private_networking = true + ssh_keys = [ + data.digitalocean_ssh_key.terraform.id + ] + + connection { + host = self.ipv4_address + user = "freebsd" + type = "ssh" + private_key = file(var.pvt_key) + timeout = "2m" + } + + provisioner "remote-exec" { + inline = [ + "export PATH=$PATH:/usr/bin", + # install nginx + "yes | sudo pkg update", + "yes | sudo pkg install nginx" + ] + } +} diff --git a/freebsd-droplet/provider.tf b/freebsd-droplet/provider.tf @@ -0,0 +1,19 @@ +terraform { + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + version = "~> 2.0" + } + } +} + +variable "do_token" {} +variable "pvt_key" {} + +provider "digitalocean" { + token = var.do_token +} + +data "digitalocean_ssh_key" "terraform" { + name = "Desktop Townhouse" +}