@scottalanmiller said in My 0.08$ experince with DigitalOcean:
Now there is value to using automation tools to make some of this easier. But you can use those with dedicated DNS hosts, too.
Here's an example with Terraform for anyone who's curious. It creates a Jenkins server from an image I created with Packer. Then it adds the new A record to Cloudflare. While this looks more complicated, after you write the module all you need is the first block below to create more.
module "jenkins" {
source = "./modules/jenkins"
server_name = "jenkins"
cluster_name = "jenkins"
openstack_keypair = "xps15"
}
resource "cloudflare_record" "jenkins" {
domain = "jhbcomputers.com"
name = "jenkins.pa"
value = "${module.jenkins.jenkins_ip}"
type = "A"
}
Here's the module where all of the good stuff happens:
main.tf:
resource "openstack_compute_instance_v2" "jenkins" {
count = 1
name = "${var.server_name}"
image_name = "jenkins"
flavor_id = "7ebe8c2d-99bb-480f-be71-40dcb3033240"
key_pair = "${var.openstack_keypair}"
security_groups = ["${openstack_compute_secgroup_v2.instance.id}"]
network {
name = "external"
}
}
resource "openstack_compute_secgroup_v2" "instance" {
name = "${var.cluster_name}"
description = "webserver secgroup"
rule {
from_port = 8080
to_port = 8080
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
rule {
from_port = 22
to_port = 22
ip_protocol = "tcp"
cidr = "0.0.0.0/0"
}
rule {
from_port = -1
to_port = -1
ip_protocol = "icmp"
cidr = "0.0.0.0/0"
}
}
outputs.tf:
output "jenkins_ip" {
value = "${openstack_compute_instance_v2.jenkins.network.0.fixed_ip_v4}"
}
vars.tf:
variable cluster_name { }
variable openstack_keypair { }
variable server_name { }
variable number {
default = 1
}