Starting the route53 transition

This commit is contained in:
Alexander Hosking 2017-01-31 02:51:16 -05:00
parent 30944f7f82
commit 88d33b4589
8 changed files with 1673 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,49 @@
#Terraform and its management of DNS in route53
#Setup the domain in route53
resource "aws_route53_zone" "ahoskingit" {
name = "ahoskingit.com"
}
resource "aws_route53_record" "ahoskingit" {
zone_id = "${aws_route53_zone.ahoskingit.zone_id}"
name = "ahoskingit.com"
type = "A"
ttl = "5"
records = ["104.37.195.87"]
}
resource "aws_route53_record" "home_ahoskingit" {
zone_id = "${aws_route53_zone.ahoskingit.zone_id}"
name = "home.ahoskingit.com"
type = "A"
ttl = "5"
records = ["${var.home_ip}"]
}
resource "aws_route53_record" "kfa_ahoskingit" {
zone_id = "${aws_route53_zone.ahoskingit.zone_id}"
name = "kfa.ahoskingit.com"
type = "A"
ttl = "5"
records = ["${var.kfa_ip}"]
}
resource "aws_route53_record" "lab_ahoskingit" {
zone_id = "${aws_route53_zone.ahoskingit.zone_id}"
name = "lab.ahoskingit.com"
type = "CNAME"
ttl = "5"
records = ["${aws_route53_record.kfa_ahoskingit.name}"]
}
#Route53 DNS entry
#resource "aws_route53_record" "www_ahoskingit" {
# zone_id = "${aws_route53_zone.ahoskingit.zone_id}"
# name = "www.ahoskingit.com"
# type = "A"
# ttl = "5"
# records = ["${var.home_ip}"]
#}

View File

@ -0,0 +1,15 @@
#Terraform and its management of DNS in route53
#Setup the domain in route53
resource "aws_route53_zone" "hivebytes" {
name = "hivebytes.com"
}
#Route53 DNS entry
resource "aws_route53_record" "www_hivebytes" {
zone_id = "${aws_route53_zone.hivebytes.zone_id}"
name = "www.hivebytes.com"
type = "A"
ttl = "5"
records = ["${var.home_ip}"]
}

View File

@ -37,13 +37,22 @@ resource "vsphere_virtual_machine" "plex" {
vcpu = 1 vcpu = 1
memory = 2048 memory = 2048
resource_pool = "192.168.1.31/" resource_pool = "192.168.1.31/"
cluster = "192.168.1.32"
datacenter = "Datacenter"
domain = "vsphere.local"
skip_customization = true
network_interface { network_interface {
label = "VM Network" label = "VM Network"
adapter_type = "VMXNET 3"
ipv4_address = "192.168.1.39"
ipv4_prefix_length = "24"
ipv4_gateway = "192.168.1.1"
} }
disk { disk {
datastore = "Nas" datastore = "960GB Enterprise"
type = "thin"
template = "ubuntu_14" template = "ubuntu_14"
} }
} }

View File

@ -0,0 +1,7 @@
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}

View File

@ -1,8 +1,8 @@
{ {
"version": 3, "version": 3,
"terraform_version": "0.7.13", "terraform_version": "0.8.2",
"serial": 4, "serial": 3,
"lineage": "55e8cea6-ab83-4a86-9270-0d029e8cac97", "lineage": "db7d87ff-3078-47ed-a0a9-91749a2dbba5",
"modules": [ "modules": [
{ {
"path": [ "path": [
@ -10,16 +10,183 @@
], ],
"outputs": {}, "outputs": {},
"resources": { "resources": {
"vsphere_folder.plex": { "aws_route53_record.ahoskingit": {
"type": "vsphere_folder", "type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z2HTSYFXB5HXD9_ahoskingit.com_A",
"attributes": {
"fqdn": "ahoskingit.com",
"health_check_id": "",
"id": "Z2HTSYFXB5HXD9_ahoskingit.com_A",
"name": "ahoskingit.com",
"records.#": "1",
"records.917561105": "104.37.195.87",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z2HTSYFXB5HXD9"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.home_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z2HTSYFXB5HXD9_home.ahoskingit.com_A",
"attributes": {
"fqdn": "home.ahoskingit.com",
"health_check_id": "",
"id": "Z2HTSYFXB5HXD9_home.ahoskingit.com_A",
"name": "home.ahoskingit.com",
"records.#": "1",
"records.2764920476": "174.114.190.249",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z2HTSYFXB5HXD9"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.kfa_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z2HTSYFXB5HXD9_kfa.ahoskingit.com_A",
"attributes": {
"fqdn": "kfa.ahoskingit.com",
"health_check_id": "",
"id": "Z2HTSYFXB5HXD9_kfa.ahoskingit.com_A",
"name": "kfa.ahoskingit.com",
"records.#": "1",
"records.2089743534": "76.9.203.226",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z2HTSYFXB5HXD9"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.lab_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_record.kfa_ahoskingit",
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z2HTSYFXB5HXD9_lab.ahoskingit.com_CNAME",
"attributes": {
"fqdn": "lab.ahoskingit.com",
"health_check_id": "",
"id": "Z2HTSYFXB5HXD9_lab.ahoskingit.com_CNAME",
"name": "lab.ahoskingit.com",
"records.#": "1",
"records.2305415569": "kfa.ahoskingit.com",
"set_identifier": "",
"ttl": "5",
"type": "CNAME",
"zone_id": "Z2HTSYFXB5HXD9"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.www_hivebytes": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.hivebytes"
],
"primary": {
"id": "Z6N8BZD6AJJ8P_www.hivebytes.com_A",
"attributes": {
"fqdn": "www.hivebytes.com",
"health_check_id": "",
"id": "Z6N8BZD6AJJ8P_www.hivebytes.com_A",
"name": "www.hivebytes.com",
"records.#": "1",
"records.2764920476": "174.114.190.249",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z6N8BZD6AJJ8P"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_zone.ahoskingit": {
"type": "aws_route53_zone",
"depends_on": [], "depends_on": [],
"primary": { "primary": {
"id": "Datacenter/terraform/plex", "id": "Z2HTSYFXB5HXD9",
"attributes": { "attributes": {
"datacenter": "Datacenter", "comment": "Managed by Terraform",
"existing_path": "", "force_destroy": "false",
"id": "Datacenter/terraform/plex", "id": "Z2HTSYFXB5HXD9",
"path": "terraform/plex" "name": "ahoskingit.com",
"name_servers.#": "4",
"name_servers.0": "ns-103.awsdns-12.com",
"name_servers.1": "ns-1078.awsdns-06.org",
"name_servers.2": "ns-1771.awsdns-29.co.uk",
"name_servers.3": "ns-669.awsdns-19.net",
"tags.%": "0",
"zone_id": "Z2HTSYFXB5HXD9"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_zone.hivebytes": {
"type": "aws_route53_zone",
"depends_on": [],
"primary": {
"id": "Z6N8BZD6AJJ8P",
"attributes": {
"comment": "Managed by Terraform",
"force_destroy": "false",
"id": "Z6N8BZD6AJJ8P",
"name": "hivebytes.com",
"name_servers.#": "4",
"name_servers.0": "ns-1219.awsdns-24.org",
"name_servers.1": "ns-2020.awsdns-60.co.uk",
"name_servers.2": "ns-210.awsdns-26.com",
"name_servers.3": "ns-668.awsdns-19.net",
"tags.%": "0",
"zone_id": "Z6N8BZD6AJJ8P"
}, },
"meta": {}, "meta": {},
"tainted": false "tainted": false

View File

@ -1,8 +1,8 @@
{ {
"version": 3, "version": 3,
"terraform_version": "0.7.13", "terraform_version": "0.8.2",
"serial": 4, "serial": 2,
"lineage": "55e8cea6-ab83-4a86-9270-0d029e8cac97", "lineage": "db7d87ff-3078-47ed-a0a9-91749a2dbba5",
"modules": [ "modules": [
{ {
"path": [ "path": [
@ -10,16 +10,183 @@
], ],
"outputs": {}, "outputs": {},
"resources": { "resources": {
"vsphere_folder.plex": { "aws_route53_record.ahoskingit": {
"type": "vsphere_folder", "type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z31BFYWP4MZAJA_ahoskingit.com_A",
"attributes": {
"fqdn": "ahoskingit.com.ahosking.com",
"health_check_id": "",
"id": "Z31BFYWP4MZAJA_ahoskingit.com_A",
"name": "ahoskingit.com",
"records.#": "1",
"records.917561105": "104.37.195.87",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z31BFYWP4MZAJA"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.home_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z31BFYWP4MZAJA_home.ahoskingit.com_A",
"attributes": {
"fqdn": "home.ahoskingit.com.ahosking.com",
"health_check_id": "",
"id": "Z31BFYWP4MZAJA_home.ahoskingit.com_A",
"name": "home.ahoskingit.com",
"records.#": "1",
"records.2764920476": "174.114.190.249",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z31BFYWP4MZAJA"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.kfa_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z31BFYWP4MZAJA_kfa.ahoskingit.com_A",
"attributes": {
"fqdn": "kfa.ahoskingit.com.ahosking.com",
"health_check_id": "",
"id": "Z31BFYWP4MZAJA_kfa.ahoskingit.com_A",
"name": "kfa.ahoskingit.com",
"records.#": "1",
"records.2089743534": "76.9.203.226",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z31BFYWP4MZAJA"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.lab_ahoskingit": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_record.kfa_ahoskingit",
"aws_route53_zone.ahoskingit"
],
"primary": {
"id": "Z31BFYWP4MZAJA_lab.ahoskingit.com_CNAME",
"attributes": {
"fqdn": "lab.ahoskingit.com.ahosking.com",
"health_check_id": "",
"id": "Z31BFYWP4MZAJA_lab.ahoskingit.com_CNAME",
"name": "lab.ahoskingit.com",
"records.#": "1",
"records.2305415569": "kfa.ahoskingit.com",
"set_identifier": "",
"ttl": "5",
"type": "CNAME",
"zone_id": "Z31BFYWP4MZAJA"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_record.www_hivebytes": {
"type": "aws_route53_record",
"depends_on": [
"aws_route53_zone.hivebytes"
],
"primary": {
"id": "Z6N8BZD6AJJ8P_www.hivebytes.com_A",
"attributes": {
"fqdn": "www.hivebytes.com",
"health_check_id": "",
"id": "Z6N8BZD6AJJ8P_www.hivebytes.com_A",
"name": "www.hivebytes.com",
"records.#": "1",
"records.2764920476": "174.114.190.249",
"set_identifier": "",
"ttl": "5",
"type": "A",
"zone_id": "Z6N8BZD6AJJ8P"
},
"meta": {
"schema_version": "2"
},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_zone.ahoskingit": {
"type": "aws_route53_zone",
"depends_on": [], "depends_on": [],
"primary": { "primary": {
"id": "Datacenter/terraform/plex", "id": "Z31BFYWP4MZAJA",
"attributes": { "attributes": {
"datacenter": "Datacenter", "comment": "Managed by Terraform",
"existing_path": "", "force_destroy": "false",
"id": "Datacenter/terraform/plex", "id": "Z31BFYWP4MZAJA",
"path": "terraform/plex" "name": "ahosking.com",
"name_servers.#": "4",
"name_servers.0": "ns-1128.awsdns-13.org",
"name_servers.1": "ns-1957.awsdns-52.co.uk",
"name_servers.2": "ns-319.awsdns-39.com",
"name_servers.3": "ns-587.awsdns-09.net",
"tags.%": "0",
"zone_id": "Z31BFYWP4MZAJA"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": ""
},
"aws_route53_zone.hivebytes": {
"type": "aws_route53_zone",
"depends_on": [],
"primary": {
"id": "Z6N8BZD6AJJ8P",
"attributes": {
"comment": "Managed by Terraform",
"force_destroy": "false",
"id": "Z6N8BZD6AJJ8P",
"name": "hivebytes.com",
"name_servers.#": "4",
"name_servers.0": "ns-1219.awsdns-24.org",
"name_servers.1": "ns-2020.awsdns-60.co.uk",
"name_servers.2": "ns-210.awsdns-26.com",
"name_servers.3": "ns-668.awsdns-19.net",
"tags.%": "0",
"zone_id": "Z6N8BZD6AJJ8P"
}, },
"meta": {}, "meta": {},
"tainted": false "tainted": false

View File

@ -1,4 +1,21 @@
# set these puppies on the command line with -var "variable=val" # set these puppies on the command line with -var "variable=val"
variable "vsphere_user" {}
variable "vsphere_password" {} ## AWS credentials requirement
variable "vsphere_server" {} variable "aws_access_key" {}
variable "aws_secret_key" {}
variable "aws_region" {
default = "us-east-1"
}
variable "home_ip" {
default = "174.114.190.249"
}
## KFA IP
variable "kfa_ip" {
default = "76.9.203.226"
}
## Vsphere creds - this did not work anywhere near as well as I'd hoped
#variable "vsphere_user" {}
#variable "vsphere_password" {}
#variable "vsphere_server" {}