-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
48 lines (41 loc) · 870 Bytes
/
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
44
45
46
47
48
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
}
namecheap = {
source = "namecheap/namecheap"
version = ">= 2.0.0"
}
}
}
provider "digitalocean" {
token = var.do_token
}
provider "namecheap" {
user_name = var.nc_user
api_user = var.nc_user
api_key = var.nc_apikey
client_ip = var.nc_clientip
use_sandbox = false
}
resource "digitalocean_droplet" "web" {
image = var.droplet_image
name = "personal-nginx"
region = var.droplet_region
size = var.droplet_size
backups = false
monitoring = true
ssh_keys = [
var.ssh_fingerprint
]
}
resource "namecheap_domain_records" "domain" {
domain = var.nc_domain_underscore
mode = "MERGE"
record {
hostname = "@"
type = "A"
address = digitalocean_droplet.web.ipv4_address
}
}