Skip to content

Commit

Permalink
made host access ips automagic
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyBarros committed Apr 19, 2020
1 parent b0a6fea commit c8459ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module "primarycluster" {
instance_type_worker = var.instance_type_worker
zone_id = var.zone_id
run_nomad_jobs = var.run_nomad_jobs
host_access_ip = var.host_access_ip
host_access_ip = local.host_access_ip
primary_datacenter = var.primary_datacenter

# EMEA-SE-PLAYGROUND
Expand All @@ -70,7 +70,7 @@ module "primarycluster" {
nomad_gossip_key = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.nomad_gossip_key
}

/*

module "secondarycluster" {
source = "./modules"
owner = var.owner
Expand Down Expand Up @@ -99,7 +99,7 @@ module "secondarycluster" {
instance_type_worker = var.instance_type_worker
zone_id = var.zone_id
run_nomad_jobs = var.run_nomad_jobs
host_access_ip = var.host_access_ip
host_access_ip = local.host_access_ip
primary_datacenter = var.primary_datacenter
# EMEA-SE-PLAYGROUND
ca_key_algorithm = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.ca_key_algorithm
Expand All @@ -110,7 +110,7 @@ module "secondarycluster" {
consul_master_token = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.consul_master_token
nomad_gossip_key = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.nomad_gossip_key
}
*/


/*
module "tertiarycluster" {
Expand Down
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ output "Primary_nomad_tag_servers"{
}

// Secondary
/*

output "Secondary_Consul" {
value = module.secondarycluster.consul_ui
}
Expand Down Expand Up @@ -103,7 +103,7 @@ output "Secondary_nomad_tag_workers"{
output "Secondary_nomad_tag_servers"{
value = module.secondarycluster.nomad_tag_servers
}
*/


// Tertiary
/*
Expand Down
13 changes: 9 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
data "http" "myipaddr" {
url = "http://ipv4.icanhazip.com"
}

locals {
host_access_ip = ["${chomp(data.http.myipaddr.body)}/32"]
}


variable "region" {
description = "The region to create resources."
default = "eu-west-2"
Expand Down Expand Up @@ -196,10 +205,6 @@ variable "run_nomad_jobs" {
default = "0"
}

variable "host_access_ip" {
description = "CIDR blocks allowed to connect via SSH on port 22"
default = []
}

variable "primary_datacenter"{
description = "the primary datacenter for mesh gateways"
Expand Down

0 comments on commit c8459ca

Please sign in to comment.