-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
43 lines (38 loc) · 1.09 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
41
42
43
data "vultr_dns_domain" "domain" {
domain = var.domain
}
locals {
nginx_config = templatefile("${path.root}/configs/registry.conf", {
server_name = "${var.subdomain}.${var.domain}"
})
cloud_init = templatefile("${path.root}/scripts/cloud-init.sh", {
nginx_config = local.nginx_config
domain = var.domain
subdomain = var.subdomain
linux_user = var.linux_user
linux_user_hashed_password = var.linux_user_hashed_password
registry_auth = var.registry_auth
})
}
module "vms" {
source = "nullc4t/ec2/vultr"
version = ">= 0.0.2"
region = var.region
ssh_key_name = var.ssh_key_name
os_id = var.os_id
snapshot_id = null
vpc_ids = []
vm_instances = {
registry = {
plan = var.plan
count = 1
startup_script = local.cloud_init
}
}
}
resource "vultr_dns_record" "dns" {
data = module.vms.instances["registry"]["registry-0"].public_ip
domain = data.vultr_dns_domain.domain.domain
name = var.subdomain
type = "A"
}