-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
40 lines (33 loc) · 1.1 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
resource "digitalocean_ssh_key" "mhg" {
name = "mhg-ssh-key"
public_key = "${file(".secrets/id_rsa.pub")}"
}
data "template_file" "main_cloud_config" {
template = "${file("cloud-config/main.yml")}"
vars {
authorized_key = "${digitalocean_ssh_key.mhg.public_key}"
}
}
resource "digitalocean_droplet" "mhg_website" {
image = "ubuntu-16-10-x64"
name = "mhg-website"
region = "nyc1"
size = "512mb"
ssh_keys = ["${digitalocean_ssh_key.mhg.id}"]
user_data = "${data.template_file.main_cloud_config.rendered}"
}
resource "digitalocean_floating_ip" "mhg" {
droplet_id = "${digitalocean_droplet.mhg_website.id}"
region = "${digitalocean_droplet.mhg_website.region}"
}
resource "digitalocean_domain" "www_milehighgophers_com" {
name = "www.milehighgophers.com"
ip_address = "${digitalocean_floating_ip.mhg.ip_address}"
}
resource "digitalocean_domain" "milehighgophers_com" {
name = "milehighgophers.com"
ip_address = "${digitalocean_floating_ip.mhg.ip_address}"
}
output "ip" {
value = "${digitalocean_floating_ip.mhg.ip_address}"
}