From b0f3f75444d590813ae2069af2ec3316548c1a7b Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Mon, 12 Feb 2018 05:58:22 -0500 Subject: [PATCH] Add monitors dns --- ahoskingit/terraform/.gitignore | 2 + ahoskingit/terraform/dns_ahoskingit.tf | 8 ++ ahoskingit/terraform/prodviders.tf | 10 +- ahoskingit/terraform/terraform.tfstate | 122 +++++++++++------- ahoskingit/terraform/terraform.tfstate.backup | 32 ++++- ahoskingit/terraform/terrarist.py | 2 +- ahoskingit/terraform/variables.tf | 10 +- 7 files changed, 126 insertions(+), 60 deletions(-) create mode 100644 ahoskingit/terraform/.gitignore diff --git a/ahoskingit/terraform/.gitignore b/ahoskingit/terraform/.gitignore new file mode 100644 index 0000000..8cc10f9 --- /dev/null +++ b/ahoskingit/terraform/.gitignore @@ -0,0 +1,2 @@ +vault.password +.terraform diff --git a/ahoskingit/terraform/dns_ahoskingit.tf b/ahoskingit/terraform/dns_ahoskingit.tf index e8d691f..0e1783b 100644 --- a/ahoskingit/terraform/dns_ahoskingit.tf +++ b/ahoskingit/terraform/dns_ahoskingit.tf @@ -132,6 +132,14 @@ resource "aws_route53_record" "gitlab_ahoskingit" { records = ["${aws_route53_record.home_ahoskingit.name}"] } +resource "aws_route53_record" "monitors_ahoskingit" { + zone_id = "${aws_route53_zone.ahoskingit.zone_id}" + name = "monitors.ahoskingit.com" + type = "CNAME" + ttl = "5" + records = ["${aws_route53_record.home_ahoskingit.name}"] +} + #Route53 DNS entry #resource "aws_route53_record" "www_ahoskingit" { # zone_id = "${aws_route53_zone.ahoskingit.zone_id}" diff --git a/ahoskingit/terraform/prodviders.tf b/ahoskingit/terraform/prodviders.tf index 3b7bdd5..130959f 100644 --- a/ahoskingit/terraform/prodviders.tf +++ b/ahoskingit/terraform/prodviders.tf @@ -4,8 +4,8 @@ provider "aws" { region = "${var.aws_region}" } -provider "google" { - credentials = "" -# project = "${var.gcp_project}" - region = "${var.gcp_region}" -} +#provider "google" { +# credentials = "" +## project = "${var.gcp_project}" +# region = "${var.gcp_region}" +#} diff --git a/ahoskingit/terraform/terraform.tfstate b/ahoskingit/terraform/terraform.tfstate index 89ced9f..ed0869d 100644 --- a/ahoskingit/terraform/terraform.tfstate +++ b/ahoskingit/terraform/terraform.tfstate @@ -1,7 +1,7 @@ { "version": 3, - "terraform_version": "0.10.7", - "serial": 22, + "terraform_version": "0.11.2", + "serial": 23, "lineage": "db7d87ff-3078-47ed-a0a9-91749a2dbba5", "modules": [ { @@ -35,7 +35,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahosking_mx": { "type": "aws_route53_record", @@ -66,7 +66,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahosking_wildcard": { "type": "aws_route53_record", @@ -93,7 +93,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahosking_www": { "type": "aws_route53_record", @@ -121,7 +121,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit": { "type": "aws_route53_record", @@ -148,7 +148,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_ca": { "type": "aws_route53_record", @@ -175,7 +175,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_ca_mx": { "type": "aws_route53_record", @@ -206,7 +206,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_ca_txt": { "type": "aws_route53_record", @@ -233,7 +233,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_ca_www": { "type": "aws_route53_record", @@ -261,7 +261,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_mx": { "type": "aws_route53_record", @@ -292,7 +292,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_txt": { "type": "aws_route53_record", @@ -319,7 +319,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ahoskingit_www": { "type": "aws_route53_record", @@ -347,7 +347,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.automatedbytes": { "type": "aws_route53_record", @@ -374,7 +374,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.baby_ahoskingit": { "type": "aws_route53_record", @@ -401,7 +401,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.cloud_ahoskingit": { "type": "aws_route53_record", @@ -429,7 +429,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.cloud_ahoskingit_ca": { "type": "aws_route53_record", @@ -457,7 +457,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.docs_ahoskingit": { "type": "aws_route53_record", @@ -485,7 +485,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.docs_ahoskingit_ca": { "type": "aws_route53_record", @@ -513,7 +513,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.git_ahoskingit": { "type": "aws_route53_record", @@ -541,7 +541,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.git_ahoskingit_ca": { "type": "aws_route53_record", @@ -569,7 +569,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.gitlab_ahoskingit": { "type": "aws_route53_record", @@ -597,7 +597,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.gitlab_ahoskingit_ca": { "type": "aws_route53_record", @@ -625,7 +625,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.home_ahoskingit": { "type": "aws_route53_record", @@ -652,7 +652,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.home_ahoskingit_ca": { "type": "aws_route53_record", @@ -679,7 +679,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.inventory_ahoskingit": { "type": "aws_route53_record", @@ -707,7 +707,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.inventory_ahoskingit_ca": { "type": "aws_route53_record", @@ -735,7 +735,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.kfa_ahoskingit": { "type": "aws_route53_record", @@ -762,7 +762,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.kfa_support_automatedbytes": { "type": "aws_route53_record", @@ -789,7 +789,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.lab_ahoskingit": { "type": "aws_route53_record", @@ -817,7 +817,35 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" + }, + "aws_route53_record.monitors_ahoskingit": { + "type": "aws_route53_record", + "depends_on": [ + "aws_route53_record.home_ahoskingit", + "aws_route53_zone.ahoskingit" + ], + "primary": { + "id": "Z2HTSYFXB5HXD9_monitors.ahoskingit.com_CNAME", + "attributes": { + "fqdn": "monitors.ahoskingit.com", + "health_check_id": "", + "id": "Z2HTSYFXB5HXD9_monitors.ahoskingit.com_CNAME", + "name": "monitors.ahoskingit.com", + "records.#": "1", + "records.1011144593": "home.ahoskingit.com", + "set_identifier": "", + "ttl": "5", + "type": "CNAME", + "zone_id": "Z2HTSYFXB5HXD9" + }, + "meta": { + "schema_version": "2" + }, + "tainted": false + }, + "deposed": [], + "provider": "provider.aws" }, "aws_route53_record.mx_automatedbytes": { "type": "aws_route53_record", @@ -848,7 +876,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ns1_ahoskingit": { "type": "aws_route53_record", @@ -876,7 +904,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.ns1_ahoskingit_ca": { "type": "aws_route53_record", @@ -904,7 +932,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.office_ahoskingit": { "type": "aws_route53_record", @@ -932,7 +960,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.plex_ahoskingit": { "type": "aws_route53_record", @@ -960,7 +988,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.plex_ahoskingit_ca": { "type": "aws_route53_record", @@ -988,7 +1016,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.requests_plex_ahoskingit": { "type": "aws_route53_record", @@ -1016,7 +1044,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.support_ahoskingit": { "type": "aws_route53_record", @@ -1044,7 +1072,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.support_ahoskingit_ca": { "type": "aws_route53_record", @@ -1072,7 +1100,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.support_automatedbytes": { "type": "aws_route53_record", @@ -1099,7 +1127,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.wildcard_automatedbytes": { "type": "aws_route53_record", @@ -1127,7 +1155,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_record.www_automatedbytes": { "type": "aws_route53_record", @@ -1155,7 +1183,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_zone.ahosking": { "type": "aws_route53_zone", @@ -1179,7 +1207,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_zone.ahoskingit": { "type": "aws_route53_zone", @@ -1203,7 +1231,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_zone.ahoskingit_ca": { "type": "aws_route53_zone", @@ -1227,7 +1255,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" }, "aws_route53_zone.automatedbytes": { "type": "aws_route53_zone", @@ -1251,7 +1279,7 @@ "tainted": false }, "deposed": [], - "provider": "" + "provider": "provider.aws" } }, "depends_on": [] diff --git a/ahoskingit/terraform/terraform.tfstate.backup b/ahoskingit/terraform/terraform.tfstate.backup index f4086e7..8ad07aa 100755 --- a/ahoskingit/terraform/terraform.tfstate.backup +++ b/ahoskingit/terraform/terraform.tfstate.backup @@ -1,7 +1,7 @@ { "version": 3, - "terraform_version": "0.10.5", - "serial": 22, + "terraform_version": "0.10.7", + "serial": 23, "lineage": "db7d87ff-3078-47ed-a0a9-91749a2dbba5", "modules": [ { @@ -990,6 +990,34 @@ "deposed": [], "provider": "" }, + "aws_route53_record.requests_plex_ahoskingit": { + "type": "aws_route53_record", + "depends_on": [ + "aws_route53_record.home_ahoskingit", + "aws_route53_zone.ahoskingit" + ], + "primary": { + "id": "Z2HTSYFXB5HXD9_requests.plex.ahoskingit.com_CNAME", + "attributes": { + "fqdn": "requests.plex.ahoskingit.com", + "health_check_id": "", + "id": "Z2HTSYFXB5HXD9_requests.plex.ahoskingit.com_CNAME", + "name": "requests.plex.ahoskingit.com", + "records.#": "1", + "records.1011144593": "home.ahoskingit.com", + "set_identifier": "", + "ttl": "5", + "type": "CNAME", + "zone_id": "Z2HTSYFXB5HXD9" + }, + "meta": { + "schema_version": "2" + }, + "tainted": false + }, + "deposed": [], + "provider": "" + }, "aws_route53_record.support_ahoskingit": { "type": "aws_route53_record", "depends_on": [ diff --git a/ahoskingit/terraform/terrarist.py b/ahoskingit/terraform/terrarist.py index dde44c4..49b584a 100755 --- a/ahoskingit/terraform/terrarist.py +++ b/ahoskingit/terraform/terrarist.py @@ -7,7 +7,7 @@ from ansible_vault import Vault if __name__ == "__main__": parser = argparse.ArgumentParser(description='Securely wrap terraform like a terrarist!') - parser.add_argument('action', choices=['plan', 'apply', 'import'], help='Terraform action to execute') + parser.add_argument('action', choices=['plan', 'apply', 'import', 'init'], help='Terraform action to execute') parser.add_argument('--vault', '--ansible-vault', dest='vault_file', required=True, help='Ansible Vault File') parser.add_argument('--vault-password-file', dest='vault_password', required=True, help='Ansible Vault Password File') parser.add_argument('--environment', dest='environment', required=True, help='Production, Staging, etc...') diff --git a/ahoskingit/terraform/variables.tf b/ahoskingit/terraform/variables.tf index 8587edc..834abb8 100644 --- a/ahoskingit/terraform/variables.tf +++ b/ahoskingit/terraform/variables.tf @@ -8,11 +8,11 @@ variable "aws_region" { } ## GCP Credentias requirements -variable "gcp_private_key_id" {} -variable "GOOGLE_CLOUD_KEYFILE_JSON" {} -variable "gcp_region" { - default = "us-east1" -} +#variable "gcp_private_key_id" {} +#variable "GOOGLE_CLOUD_KEYFILE_JSON" {} +#variable "gcp_region" { +# default = "us-east1" +#} variable "gcp_project" { default = "ahoskingit" }