Skip to content

Commit c8459ca

Browse files
committed
made host access ips automagic
1 parent b0a6fea commit c8459ca

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module "primarycluster" {
5757
instance_type_worker = var.instance_type_worker
5858
zone_id = var.zone_id
5959
run_nomad_jobs = var.run_nomad_jobs
60-
host_access_ip = var.host_access_ip
60+
host_access_ip = local.host_access_ip
6161
primary_datacenter = var.primary_datacenter
6262

6363
# EMEA-SE-PLAYGROUND
@@ -70,7 +70,7 @@ module "primarycluster" {
7070
nomad_gossip_key = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.nomad_gossip_key
7171
}
7272

73-
/*
73+
7474
module "secondarycluster" {
7575
source = "./modules"
7676
owner = var.owner
@@ -99,7 +99,7 @@ module "secondarycluster" {
9999
instance_type_worker = var.instance_type_worker
100100
zone_id = var.zone_id
101101
run_nomad_jobs = var.run_nomad_jobs
102-
host_access_ip = var.host_access_ip
102+
host_access_ip = local.host_access_ip
103103
primary_datacenter = var.primary_datacenter
104104
# EMEA-SE-PLAYGROUND
105105
ca_key_algorithm = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.ca_key_algorithm
@@ -110,7 +110,7 @@ module "secondarycluster" {
110110
consul_master_token = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.consul_master_token
111111
nomad_gossip_key = data.terraform_remote_state.emea_se_playground_tls_root_certificate.outputs.nomad_gossip_key
112112
}
113-
*/
113+
114114

115115
/*
116116
module "tertiarycluster" {

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ output "Primary_nomad_tag_servers"{
7373
}
7474

7575
// Secondary
76-
/*
76+
7777
output "Secondary_Consul" {
7878
value = module.secondarycluster.consul_ui
7979
}
@@ -103,7 +103,7 @@ output "Secondary_nomad_tag_workers"{
103103
output "Secondary_nomad_tag_servers"{
104104
value = module.secondarycluster.nomad_tag_servers
105105
}
106-
*/
106+
107107

108108
// Tertiary
109109
/*

variables.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
data "http" "myipaddr" {
2+
url = "http://ipv4.icanhazip.com"
3+
}
4+
5+
locals {
6+
host_access_ip = ["${chomp(data.http.myipaddr.body)}/32"]
7+
}
8+
9+
110
variable "region" {
211
description = "The region to create resources."
312
default = "eu-west-2"
@@ -196,10 +205,6 @@ variable "run_nomad_jobs" {
196205
default = "0"
197206
}
198207

199-
variable "host_access_ip" {
200-
description = "CIDR blocks allowed to connect via SSH on port 22"
201-
default = []
202-
}
203208

204209
variable "primary_datacenter"{
205210
description = "the primary datacenter for mesh gateways"

0 commit comments

Comments
 (0)