Adds digital ocean droplet

This commit is contained in:
Nemo 2018-02-03 13:06:19 +05:30
parent 76911c299b
commit db38793584
6 changed files with 66 additions and 0 deletions

16
digitalocean/droplets.tf Normal file
View File

@ -0,0 +1,16 @@
resource "digitalocean_droplet" "sydney" {
image = ""
name = "sydney.captnemo.in"
region = "blr1"
size = "1gb"
ipv6 = true
private_networking = true
resize_disk = true
tags = [
"bangalore",
"proxy",
"sydney",
"vpn",
]
}

37
digitalocean/firewall.tf Normal file
View File

@ -0,0 +1,37 @@
resource "digitalocean_firewall" "web" {
name = "web-inbound"
inbound_rule = [
{
protocol = "tcp"
port_range = "80"
source_addresses = ["0.0.0.0/0", "::/0"]
},
{
protocol = "tcp"
port_range = "443"
source_addresses = ["0.0.0.0/0", "::/0"]
},
]
}
resource "digitalocean_firewall" "ssh" {
name = "ssh-inbound"
inbound_rule = [
{
protocol = "tcp"
port_range = "22"
source_addresses = ["0.0.0.0/0", "::/0"]
},
{
protocol = "tcp"
port_range = "222"
source_addresses = ["0.0.0.0/0", "::/0"]
},
{
protocol = "tcp"
port_range = "24"
source_addresses = ["0.0.0.0/0", "::/0"]
},
]
}

View File

@ -0,0 +1,4 @@
resource "digitalocean_floating_ip" "sydney" {
droplet_id = "${digitalocean_droplet.sydney.id}"
region = "${digitalocean_droplet.sydney.region}"
}

View File

@ -49,3 +49,7 @@ module "monitoring" {
gf-security-admin-password = "${var.gf-security-admin-password}"
domain = "bb8.fun"
}
module "digitalocean" {
source = "digitalocean"
}

View File

@ -13,3 +13,7 @@ provider "mysql" {
username = "root"
password = "${var.mysql_root_password}"
}
provider digitalocean {
token = "${var.digitalocean-token}"
}

View File

@ -44,3 +44,4 @@ variable "gf-security-admin-password" {
variable "gitea-secret-key" {}
variable "gitea-internal-token" {}
variable "gitea-smtp-password" {}
variable "digitalocean-token" {}