Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/update fx #282

Merged
merged 222 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
695916e
Merge pull request #191 from mojaloop/IPROD-491
vijayg10 Mar 20, 2024
5c91f9a
fix: unreasonably high delays for probes
kalinkrustev Mar 21, 2024
5949baa
Adding refresh remplates for bootstrap
sijo5722-2021 Mar 21, 2024
6e01e90
Renaming GITLAB TOKEN
sijo5722-2021 Mar 21, 2024
22315f6
Adding comments
sijo5722-2021 Mar 21, 2024
4292599
Change in permission
sijo5722-2021 Mar 21, 2024
adb02c3
Merge pull request #193 from mojaloop/probes
dfry Mar 21, 2024
5366b24
including setcivars script
sijo5722-2021 Mar 21, 2024
1c2be56
Integrate minio with Loki
muzammil360 Mar 22, 2024
7504308
refactor
muzammil360 Mar 22, 2024
7d76407
Merge pull request #195 from mojaloop/feature/cc-refresh-templates
dfry Mar 22, 2024
684a249
ensure only 1 nat gw
dfry Mar 19, 2024
a6c3f44
fix subnet ordering
dfry Mar 22, 2024
c156aa6
Merge pull request #192 from mojaloop/fix/manage-eips-manually
dfry Mar 22, 2024
bd5d810
Adding generation of custom config for pm4ml
sijo5722-2021 Mar 22, 2024
4eadd68
Adding default config tag changes
sijo5722-2021 Mar 22, 2024
3f6325a
Merge pull request #196 from mojaloop/muz/iprod-502/integrate-minio-w…
dfry Mar 22, 2024
44b2635
Revert "Merge pull request #196 from mojaloop/muz/iprod-502/integrate…
sijo5722-2021 Mar 22, 2024
053f293
Merge pull request #198 from mojaloop/revert-last-PR
dfry Mar 22, 2024
c1ac557
Merge pull request #197 from mojaloop/feature/create-pm4ml-customconfig
dfry Mar 22, 2024
a7718c4
placeholders for vnext add
dfry Mar 13, 2024
eaad864
missed appdeploy placeholder
dfry Mar 13, 2024
6e7fef6
2nd draft
dfry Mar 18, 2024
995a944
feat: enhance mysql logging
aaronreynoza Mar 25, 2024
7511b86
fix stateful resource env vars, new values file
dfry Mar 25, 2024
b929bd2
add missing vars
dfry Mar 25, 2024
c1be9a9
adding sts.json in list
sijo5722-2021 Mar 25, 2024
b964231
correction
sijo5722-2021 Mar 25, 2024
fbb6db0
fix configs for stateful resources
dfry Mar 26, 2024
8edc636
fix mongodb secret naming, add vnext app
dfry Mar 26, 2024
91f90bc
clean up missing vars
dfry Mar 26, 2024
0c2dafa
another missing var
dfry Mar 26, 2024
b85bd3d
fix chart repo
dfry Mar 26, 2024
4ca3735
fix anchors
dfry Mar 26, 2024
86ae686
fix: use local storage by default
kalinkrustev Mar 26, 2024
de01b27
Merge pull request #201 from mojaloop/data-locality
dfry Mar 26, 2024
77ecfa5
disable ingresses
dfry Mar 26, 2024
3843fee
add es and reconfigure mongo url secret
dfry Mar 26, 2024
3a2ab96
bump release
dfry Mar 26, 2024
d784cad
fix secret name
dfry Mar 27, 2024
dbc9e32
bump version
dfry Mar 27, 2024
81c63d9
fix path
dfry Mar 27, 2024
febee89
fix name again
dfry Mar 27, 2024
8cbee6d
add service confs to value
dfry Mar 27, 2024
7ed3875
bump version
dfry Mar 27, 2024
00e671f
try root pw on mongodb no db
dfry Mar 27, 2024
2250b9d
fix: added custom dumper for pm4ml merge function
vijayg10 Mar 27, 2024
11d0a41
Merge pull request #202 from mojaloop/fix/yaml-dumper
vijayg10 Mar 27, 2024
2c4a3f5
blanket apply env vars
dfry Mar 27, 2024
4841eb7
updaate topics for kafka
dfry Mar 27, 2024
3894174
fix hostnames in nginx.conf
dfry Mar 27, 2024
3fb2bc2
try adding ttk
dfry Mar 27, 2024
37e66f9
fix ttk config
dfry Mar 27, 2024
2280f07
turn off ingress
dfry Mar 27, 2024
816fc6c
add api base url
dfry Mar 27, 2024
660edc4
add admin ui vs
dfry Mar 28, 2024
1d5e91b
Adding minio provider, minio tf code for loki and loghorn data storage
sijo5722-2021 Mar 25, 2024
5066537
Bringing the docker volume size to env.yaml
sijo5722-2021 Mar 25, 2024
e3aa6cb
Fixing the typo
sijo5722-2021 Mar 25, 2024
cce7d3e
provider config
sijo5722-2021 Mar 25, 2024
9345f47
Adding output deps
sijo5722-2021 Mar 25, 2024
1c512f4
Adding stored params
sijo5722-2021 Mar 25, 2024
faac811
correcting longhorn typo
sijo5722-2021 Mar 25, 2024
c18f57a
Changing the attrbut name
sijo5722-2021 Mar 25, 2024
c6a39dc
Changes for accessing minio loki creds
sijo5722-2021 Mar 25, 2024
e895c9c
Adding to kustmz
sijo5722-2021 Mar 25, 2024
4c25254
passing external_secret_sync_wave
sijo5722-2021 Mar 26, 2024
e961258
correcting the secret name
sijo5722-2021 Mar 26, 2024
3def5e3
Adding converstion and decoding strategy
sijo5722-2021 Mar 26, 2024
b1c724c
Adding minio config in loki values
sijo5722-2021 Mar 26, 2024
a457295
debug
sijo5722-2021 Mar 26, 2024
ee94634
fixing the retrval
sijo5722-2021 Mar 26, 2024
b8ed2b9
Correcting the minio api port
sijo5722-2021 Mar 26, 2024
cf1af85
adding policy attachemnt
sijo5722-2021 Mar 26, 2024
df67e87
removing taint
sijo5722-2021 Mar 27, 2024
2d1f612
adding changes for longhorn backup
sijo5722-2021 Mar 27, 2024
bb5ca57
adding data resource for longhorn bucket
sijo5722-2021 Mar 27, 2024
2537e11
correcting longhorn config
sijo5722-2021 Mar 27, 2024
ae34c42
commenting out longhorn s3 backups
sijo5722-2021 Mar 27, 2024
40eac46
adding lifecycle rule
sijo5722-2021 Mar 27, 2024
cb86a96
correcting the variable reference
sijo5722-2021 Mar 27, 2024
fba04d2
Removing longhorn old refs
sijo5722-2021 Mar 27, 2024
d34be4d
removing commented lines
sijo5722-2021 Mar 27, 2024
2615bf1
fix typo on internal/external
dfry Mar 28, 2024
38b7fff
change in policy
sijo5722-2021 Mar 28, 2024
1488f24
change in policy
sijo5722-2021 Mar 28, 2024
b849813
adding changes in permission
sijo5722-2021 Mar 28, 2024
68747ad
add more values pt-1
aaronreynoza Mar 28, 2024
c26911b
bump to latest chart version
dfry Apr 2, 2024
3a72cd3
Merge pull request #175 from mojaloop/feature/vnext-add
dfry Apr 2, 2024
564b7aa
revert output change to use old secret for migration
dfry Apr 4, 2024
4c88ebd
add http for non ssl url
dfry Apr 4, 2024
880c103
Merge pull request #203 from mojaloop/feature/enhance-minio-storage
dfry Apr 4, 2024
9a80be9
Merge pull request #200 from mojaloop/mysql
dfry Apr 4, 2024
009dbfa
Add multi-line config in promtail configuration (#206)
muzammil360 Apr 4, 2024
1e63f25
add more dynamic variables for mysql
aaronreynoza Apr 4, 2024
f4ec746
IPROD-525: Display offending processes (cpu+memory) on performance-tr…
muzammil360 Apr 4, 2024
87b8e1d
add more dynamic variables for mysql (#207)
aaronreynoza Apr 4, 2024
0070500
feat: standardise poc demos changes (#205)
vijayg10 Apr 4, 2024
e37e095
https://github.com/argoproj/argo-cd/issues/11074 (#208)
dfry Apr 5, 2024
d322d62
set version tags in default cluster config (#209)
dfry Apr 8, 2024
b918ac2
[IPROD-563] Make loki run on monitoring nodes (#210)
muzammil360 Apr 9, 2024
5046d89
IPROD-563: Run Prometheus, Grafana and Tempo on monitoring nodes only…
muzammil360 Apr 9, 2024
d4a48a5
Polling freq and backup job freq (#213)
sijo5722-2021 Apr 10, 2024
f328460
disable default logs for mysql
aaronreynoza Apr 10, 2024
7b20032
IPROD-525: Display offending processes (cpu+memory) on performance-tr…
muzammil360 Apr 4, 2024
609923c
feat: standardise poc demos changes (#205)
vijayg10 Apr 4, 2024
231c583
https://github.com/argoproj/argo-cd/issues/11074 (#208)
dfry Apr 5, 2024
ab8c816
set version tags in default cluster config (#209)
dfry Apr 8, 2024
d790e93
[IPROD-563] Make loki run on monitoring nodes (#210)
muzammil360 Apr 9, 2024
18891bf
IPROD-563: Run Prometheus, Grafana and Tempo on monitoring nodes only…
muzammil360 Apr 9, 2024
e7a34bf
Polling freq and backup job freq (#213)
sijo5722-2021 Apr 10, 2024
ff07ca7
Merge branch 'main' of github.com:mojaloop/iac-modules into mysql-var…
aaronreynoza Apr 10, 2024
6a59a22
set min and max block duration to 30m
dfry Apr 11, 2024
07ca719
Merge pull request #215 from mojaloop/fix/prom-operator-additional-args
aaronreynoza Apr 11, 2024
c2ff155
Merge pull request #214 from mojaloop/mysql-variables
aaronreynoza Apr 11, 2024
fecff9b
fix typo
dfry Apr 11, 2024
129f73c
Merge pull request #217 from mojaloop/fix/prom-operator-additional-args
aaronreynoza Apr 11, 2024
4bbc2a0
clean up and making aws objects' name unique (#211)
dfry Apr 15, 2024
ed398b1
Enabled s3 read for loki-querier (#218)
muzammil360 Apr 16, 2024
d716b90
addon module support (#216)
dfry Apr 16, 2024
e9b9d87
Enable log deletion using compactor (#220)
muzammil360 Apr 18, 2024
b52ad09
Feature/refactor istio gw for using 2 separate domains (#219)
sijo5722-2021 Apr 18, 2024
9ef8980
fix for 1.6.1 chart, add flag for backup job (#223)
dfry Apr 18, 2024
803503a
cleanup (#222)
dfry Apr 18, 2024
e89c13b
Fix/refactor igw (#228)
sijo5722-2021 Apr 18, 2024
1b54a10
Draft - Refactoring app-deploy.tf (#229)
sijo5722-2021 Apr 19, 2024
2d8a758
first draft override kustomization (#225)
dfry Apr 19, 2024
8e4997e
Revert "Draft - Refactoring app-deploy.tf (#229)"
dfry Apr 19, 2024
2292755
New PR Feature/refactor appdeploy (#236)
dfry Apr 19, 2024
057b713
update versions (#237)
dfry Apr 19, 2024
4cd5844
Fixing typo (#238)
sijo5722-2021 Apr 22, 2024
711706a
Fix typo (#239)
sijo5722-2021 Apr 22, 2024
0036059
make tempo buckets in minio
muzammil360 Apr 19, 2024
92eb553
add tempo_data_expiry_days in terragrunt configs
muzammil360 Apr 19, 2024
8802f8e
add minio_tempo_bucket variable to gitlab
muzammil360 Apr 22, 2024
03dece9
move all the resources to a single file
muzammil360 Apr 22, 2024
39a6f17
fix the variable
muzammil360 Apr 23, 2024
5ddce43
Merge pull request #230 from mojaloop/IPROD-565/setup-tempo-storage-b…
sijo5722-2021 Apr 23, 2024
8995d30
Increase loki and longhorn data TTL to 7 days in minio
muzammil360 Apr 23, 2024
918eed2
use 1d for longhorn data
muzammil360 Apr 23, 2024
739b21d
Merge pull request #241 from mojaloop/muz/update-minio-data-ttl
sijo5722-2021 Apr 23, 2024
25d50ce
fix: admin portal name limit
vijayg10 Apr 23, 2024
1cea94d
Merge pull request #242 from mojaloop/fix/admin-portal-name-limit
sijo5722-2021 Apr 23, 2024
3991841
Fix for auth and wrong backend (#246)
sijo5722-2021 Apr 24, 2024
91f1219
Correcting the default values (#247)
sijo5722-2021 Apr 25, 2024
a018534
fine tune addons module config (#240)
dfry Apr 25, 2024
2c276f3
reduce loki_ingester_pvc_size to 10Gi (#245)
muzammil360 Apr 25, 2024
ead675f
renamed minio_credentials_secret_name to minio_loki_credentials_secre…
muzammil360 Apr 26, 2024
a33da60
IPROD-565: Setup tempo to use minio (#232)
muzammil360 Apr 26, 2024
232f46f
typo on minio_loki_credentials_secret_name (#248)
dfry Apr 26, 2024
54f2231
rm consul inject (#249)
dfry Apr 29, 2024
da009b5
Increase resource limits for tempo (#250)
muzammil360 Apr 30, 2024
a44db1c
feat: exposed ttk test cases tag and added ttk test cases labels (#252)
vijayg10 May 2, 2024
9432e9a
Verify IAC deployment using eks (#255)
sijo5722-2021 May 2, 2024
9563f13
increase resouce limit for tempo services (#259)
muzammil360 May 3, 2024
b049f2d
IPROD-668: Update command and args of loki memcached (#254)
muzammil360 May 3, 2024
d2568e4
enable metrics for memcachedChunks (#260)
muzammil360 May 3, 2024
35a6487
Fix/node pool map (#261)
sijo5722-2021 May 3, 2024
a5c599d
expose minio-loki-credentails to queryfrontend and distributor (#263)
muzammil360 May 7, 2024
b8c5a3e
Upgrading netmaker version
sijo5722-2021 May 8, 2024
e222567
All mojaloop grafana dashboards use same git tag (#262)
muzammil360 May 9, 2024
d2dfe34
Correcting the instance class for mysql rds
sijo5722-2021 May 9, 2024
e33291d
Bringing managed services changes
sijo5722-2021 May 9, 2024
0948b0f
Correcting the newline
sijo5722-2021 May 9, 2024
85987fc
Chaging the type of variable
sijo5722-2021 May 9, 2024
8cee30f
IPROD-686 : add loki-query-scheduler (#265)
muzammil360 May 9, 2024
e76c1be
Adding bastion to k8s nm network along with cc
sijo5722-2021 May 9, 2024
8015ba7
Correcting the quotes
sijo5722-2021 May 9, 2024
2313798
adding changes for external ms
sijo5722-2021 May 9, 2024
db024ed
Correcting the variable names
sijo5722-2021 May 9, 2024
0643434
Adding the map changes
sijo5722-2021 May 9, 2024
700d96d
adding managed_db_host var in middle layers
sijo5722-2021 May 9, 2024
3cd83e9
Passing the variable
sijo5722-2021 May 9, 2024
4629a28
adding map variable for port and destination for ms
sijo5722-2021 May 9, 2024
813453b
adding map variable assignment
sijo5722-2021 May 9, 2024
a082b43
correcting the syntax
sijo5722-2021 May 9, 2024
24afa02
correcting the syntax
sijo5722-2021 May 9, 2024
e64946c
correcting the syntax
sijo5722-2021 May 9, 2024
a44a380
ading variable
sijo5722-2021 May 9, 2024
9dc9cb4
Removing the inner loop
sijo5722-2021 May 9, 2024
7e02d45
Passing yaml encoded value
sijo5722-2021 May 10, 2024
b6dab0a
changing the ds to list of maps
sijo5722-2021 May 10, 2024
309d61f
change in inventory map
sijo5722-2021 May 10, 2024
9dcb1d6
Adding managed kafka
sijo5722-2021 May 10, 2024
3b64439
Formatting ansible tf
sijo5722-2021 May 10, 2024
1d06ef6
IPROD-694: Enable loki metrics monitoring (#268)
muzammil360 May 10, 2024
87939c0
Change in ref obj
sijo5722-2021 May 10, 2024
2fc9f33
Separating msk and rds
sijo5722-2021 May 10, 2024
5d67df8
adding local external_kafka_stateful_resource_instance_addresses
sijo5722-2021 May 10, 2024
7d1d640
Adding sg rule for kafka access
sijo5722-2021 May 10, 2024
2b2ea62
IPROD-694: Add dashboards for monitoring loki (#269)
muzammil360 May 14, 2024
783da32
feat: re-generate apps in branch pipeline (#257)
kalinkrustev May 14, 2024
2552b78
including bootstrap_brokers_plaintext
sijo5722-2021 May 14, 2024
d4fee60
chaing the expressin and instance type
sijo5722-2021 May 14, 2024
7d653d7
Correcting the expression
sijo5722-2021 May 14, 2024
45f7b31
changing the out
sijo5722-2021 May 14, 2024
e5aa4d7
Chaging the output
sijo5722-2021 May 14, 2024
cacc893
converting list to string
sijo5722-2021 May 14, 2024
e67cd18
change the default protocol for msk
sijo5722-2021 May 15, 2024
ff4abc7
Finance portal override (#270)
kalinkrustev May 15, 2024
479b0a1
Default value to PLAINTEXT
sijo5722-2021 May 15, 2024
0ff5921
Setting the bastion instance type to t2.micro
sijo5722-2021 May 15, 2024
9349568
Merge pull request #267 from mojaloop/feature/upgrade-netmaker-v24
sijo5722-2021 May 15, 2024
93afde5
use valid yaml in default (#272)
dfry May 15, 2024
ad23548
fix: optimize defaults (#278)
kalinkrustev May 28, 2024
0fe6a71
IPROD-545: Enable prometheus remote write and read (#275)
muzammil360 May 28, 2024
b4a8efc
chore: update versions
kleyow Jun 5, 2024
fa553e3
update
kleyow Jun 5, 2024
3bbe631
Merge remote-tracking branch 'origin/main' into chore/update-fx
kleyow Jun 5, 2024
43f23f9
revert ttk version
kleyow Jun 6, 2024
2490c88
update services
kleyow Jun 7, 2024
b3a3185
update tkk
kleyow Jun 7, 2024
55c3aac
bump
kleyow Jun 7, 2024
6eb17db
bump
kleyow Jun 8, 2024
9c28e96
update
kleyow Jun 9, 2024
f04e25a
revert quoting
kleyow Jun 10, 2024
6af5397
downgrade
kleyow Jun 10, 2024
eb8dedd
undo
kleyow Jun 10, 2024
6ef9a77
bump
kleyow Jun 10, 2024
4921d79
bump services
kleyow Jun 12, 2024
ca02c3d
downgrade quoting
kleyow Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions terraform/ansible/k8s-deploy/ansible.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "local_sensitive_file" "ansible_inventory" {
all_hosts_var_maps = merge(var.all_hosts_var_maps, local.ssh_private_key_file_map, local.all_hosts_var_maps),
agent_hosts_yaml_maps = var.agent_hosts_yaml_maps,
master_hosts_yaml_maps = var.master_hosts_yaml_maps,
bastion_hosts_yaml_maps = var.bastion_hosts_yaml_maps,
bastion_hosts_yaml_maps = merge(var.bastion_hosts_yaml_maps, local.bastion_hosts_yaml_maps)
test_harness_hosts = var.test_harness_hosts,
test_harness_hosts_var_maps = merge(var.test_harness_hosts_var_maps, local.jumphostmap)
}
Expand All @@ -36,7 +36,7 @@ resource "null_resource" "run_ansible" {
EOT
working_dir = path.module
}

depends_on = [
local_sensitive_file.ansible_inventory,
local_sensitive_file.ec2_ssh_key
Expand All @@ -53,12 +53,12 @@ resource "null_resource" "destroy_ansible_actions" {
ansible-playbook "$destroy_ansible_playbook" -i "$destroy_ansible_inventory"
EOT
working_dir = path.module
}
}

depends_on = [
depends_on = [
local_sensitive_file.ansible_inventory,
local_sensitive_file.ec2_ssh_key,
]
]

}

Expand All @@ -68,6 +68,19 @@ resource "local_sensitive_file" "ec2_ssh_key" {
file_permission = "0600"
}

data "gitlab_project_variable" "external_rds_stateful_resource_instance_address" {
for_each = local.managed_rds_stateful_resources
project = var.current_gitlab_project_id
key = each.value.external_resource_config.instance_address_key_name
}

data "gitlab_project_variable" "external_kafka_stateful_resource_instance_address" {
for_each = local.managed_kafka_stateful_resources
project = var.current_gitlab_project_id
key = each.value.external_resource_config.instance_address_key_name
}


locals {
jumphostmap = {
ansible_ssh_common_args = "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ProxyCommand=\"ssh -W %h:%p -i ${local_sensitive_file.ec2_ssh_key.filename} -o StrictHostKeyChecking=no -q ${var.ansible_bastion_os_username}@${var.ansible_bastion_public_ip}\""
Expand All @@ -80,4 +93,41 @@ locals {
kubeconfig_local_location = local.ansible_output_dir
}

stateful_resources = jsondecode(file(var.stateful_resources_config_file))
enabled_stateful_resources = { for stateful_resource in local.stateful_resources : stateful_resource.resource_name => stateful_resource if stateful_resource.enabled }
managed_rds_stateful_resources = { for managed_resource in local.enabled_stateful_resources : managed_resource.resource_name => managed_resource if managed_resource.external_service && managed_resource.resource_type == "mysql" }
managed_kafka_stateful_resources = { for managed_resource in local.enabled_stateful_resources : managed_resource.resource_name => managed_resource if managed_resource.external_service && managed_resource.resource_type == "kafka" }


external_rds_stateful_resource_instance_addresses = { for address in data.gitlab_project_variable.external_rds_stateful_resource_instance_address : address.key => address.value }
external_kafka_stateful_resource_instance_addresses = { for address in data.gitlab_project_variable.external_kafka_stateful_resource_instance_address : address.key => address.value }


managed_kafka_brokers_list = { for service in local.managed_kafka_stateful_resources : service.resource_name => split(",", local.external_kafka_stateful_resource_instance_addresses[service.external_resource_config.instance_address_key_name]) }


managed_rds_svc_port_maps = [for service in local.managed_rds_stateful_resources :
{
"local_listening_port" = service.logical_service_config.logical_service_port
"mode" = service.communication_mode
"name" = service.resource_name
"dest_fqdn" = local.external_rds_stateful_resource_instance_addresses[service.external_resource_config.instance_address_key_name]
"dest_port" = service.external_resource_config.port
}
]

managed_kafka_svc_maps = [for service in local.managed_kafka_stateful_resources :
{
"local_listening_port" = service.logical_service_config.logical_service_port
"managed_kafka_brokers_list" = local.managed_kafka_brokers_list[service.resource_name]
"mode" = service.communication_mode
"name" = service.resource_name
"dest_port" = service.external_resource_config.port
}

]
bastion_hosts_yaml_maps = {
managed_rds_svc = yamlencode(local.managed_rds_svc_port_maps)
managed_kafka_svc = yamlencode(local.managed_kafka_svc_maps)
}
}
9 changes: 9 additions & 0 deletions terraform/ansible/k8s-deploy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,12 @@ variable "ansible_debug" {
type = string
default = ""
}

variable "stateful_resources_config_file" {
type = string
}

variable "current_gitlab_project_id" {
type = string
description = "current_gitlab_project_id"
}
15 changes: 10 additions & 5 deletions terraform/aws/base-infra/data.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
data "aws_route53_zone" "public" {
count = (var.create_public_zone || !var.configure_route_53) ? 0 : 1
name = "${local.cluster_domain}."
name = "${local.cluster_domain}."
}

data "aws_route53_zone" "public_int" {
count = (var.create_public_zone || !var.configure_route_53) ? 0 : 1
name = "${var.private_subdomain_string}.${local.cluster_domain}."
}

data "aws_route53_zone" "private" {
count = (var.create_private_zone || !var.configure_route_53) ? 0 : 1
name = "${local.cluster_domain}.internal."
name = "${local.cluster_domain}.internal."
}

data "aws_route53_zone" "cluster_parent" {
count = (var.manage_parent_domain || !var.configure_route_53) ? 0 : 1
name = "${local.cluster_parent_domain}."
name = "${local.cluster_parent_domain}."
}

data "aws_route53_zone" "cluster_parent_parent" {
count = (var.manage_parent_domain && var.manage_parent_domain_ns && var.configure_route_53) ? 1 : 0
name = "${local.cluster_parent_parent_domain}."
name = "${local.cluster_parent_parent_domain}."
}

data "aws_availability_zones" "available" {
state = "available"
}
}
5 changes: 4 additions & 1 deletion terraform/aws/base-infra/infra.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module "vpc" {
enable_dns_hostnames = true
enable_dns_support = true
enable_nat_gateway = true
single_nat_gateway = true
one_nat_gateway_per_az = false
reuse_nat_ips = false
manage_default_security_group = false
manage_default_network_acl = false
manage_default_route_table = false
Expand All @@ -34,7 +37,7 @@ module "subnet_addrs" {

base_cidr_block = var.vpc_cidr
networks = [
for subnet in concat(local.private_subnets_list, local.public_subnets_list) : {
for subnet in local.subnet_list : {
name = subnet
new_bits = var.block_size
}
Expand Down
6 changes: 5 additions & 1 deletion terraform/aws/base-infra/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ output "private_zone" {
value = local.private_zone
}

output "public_int_zone" {
value = local.public_int_zone
}

output "public_zone" {
value = local.public_zone
}
Expand Down Expand Up @@ -62,4 +66,4 @@ output "key_pair_name" {
output "haproxy_server_fqdn" {
description = "haproxy server Hostname"
value = var.create_haproxy_dns_record ? aws_route53_record.haproxy_server_private[0].fqdn : ""
}
}
40 changes: 28 additions & 12 deletions terraform/aws/base-infra/route53.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "aws_route53_zone" "private" {
force_destroy = var.route53_zone_force_destroy
count = (var.configure_route_53 && var.create_private_zone) ? 1 : 0
name = "${local.cluster_domain}.internal."
count = (var.configure_route_53 && var.create_private_zone) ? 1 : 0
name = "${local.cluster_domain}.internal."

vpc {
vpc_id = module.vpc.vpc_id
Expand All @@ -11,29 +11,45 @@ resource "aws_route53_zone" "private" {

resource "aws_route53_zone" "public" {
force_destroy = var.route53_zone_force_destroy
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
name = "${local.cluster_domain}."
tags = merge({ Name = "${local.cluster_domain}-public" }, local.common_tags)
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
name = "${local.cluster_domain}."
tags = merge({ Name = "${local.cluster_domain}-public" }, local.common_tags)
}

resource "aws_route53_zone" "public_int" {
force_destroy = var.route53_zone_force_destroy
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
name = "${var.private_subdomain_string}.${local.cluster_domain}."
tags = merge({ Name = "${local.cluster_domain}-public-int" }, local.common_tags)
}

resource "aws_route53_record" "public_ns" {
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
zone_id = local.cluster_parent_zone_id
name = local.cluster_domain
type = "NS"
ttl = "30"
records = aws_route53_zone.public[0].name_servers
}

resource "aws_route53_record" "public_int_ns" {
count = (var.configure_route_53 && var.create_public_zone) ? 1 : 0
zone_id = aws_route53_zone.public[0].zone_id
name = "${var.private_subdomain_string}.${local.cluster_domain}"
type = "NS"
ttl = "30"
records = aws_route53_zone.public_int[0].name_servers
}

resource "aws_route53_zone" "cluster_parent" {
force_destroy = var.route53_zone_force_destroy
count = (var.configure_route_53 && var.manage_parent_domain) ? 1 : 0
name = "${local.cluster_parent_domain}."
tags = merge({ Name = "${local.cluster_domain}-cluster-parent" }, local.common_tags)
count = (var.configure_route_53 && var.manage_parent_domain) ? 1 : 0
name = "${local.cluster_parent_domain}."
tags = merge({ Name = "${local.cluster_domain}-cluster-parent" }, local.common_tags)
}

resource "aws_route53_record" "cluster_ns" {
count = (var.configure_route_53 && var.manage_parent_domain && var.manage_parent_domain_ns) ? 1 : 0
count = (var.configure_route_53 && var.manage_parent_domain && var.manage_parent_domain_ns) ? 1 : 0
zone_id = data.aws_route53_zone.cluster_parent_parent[0].zone_id
name = local.cluster_parent_domain
type = "NS"
Expand All @@ -42,10 +58,10 @@ resource "aws_route53_record" "cluster_ns" {
}

resource "aws_route53_record" "haproxy_server_private" {
count = (var.configure_route_53 && var.create_haproxy_dns_record) ? 1 : 0
count = (var.configure_route_53 && var.create_haproxy_dns_record) ? 1 : 0
zone_id = local.public_zone.id
name = "haproxy"
type = "A"
ttl = "300"
records = [aws_instance.bastion.private_ip]
}
}
86 changes: 47 additions & 39 deletions terraform/aws/base-infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variable "cluster_name" {
variable "domain" {
description = "Domain to attach the cluster to."
type = string
default = ""
default = ""
}

variable "tags" {
Expand All @@ -25,33 +25,33 @@ variable "vpc_cidr" {
}

variable "configure_route_53" {
type = bool
default = true
type = bool
default = true
description = "whether route53 is to be configured at all or not"
}

variable "create_public_zone" {
default = true
type = bool
default = true
type = bool
description = "Whether to create public zone in route53. true or false, default true"
}

variable "create_private_zone" {
default = true
type = bool
default = true
type = bool
description = "Whether to create private zone in route53. true or false, default true"
}
variable "manage_parent_domain" {
default = false
type = bool
variable "manage_parent_domain" {
default = false
type = bool
description = "whether parent domain should be created and managed here"
}
}

variable "manage_parent_domain_ns" {
default = false
type = bool
variable "manage_parent_domain_ns" {
default = false
type = bool
description = "whether ns record should be created for parent domain in that parent's zone that should already exist"
}
}

variable "az_count" {
type = number
Expand All @@ -70,48 +70,56 @@ variable "bastion_ami" {
}
variable "netmaker_ami" {
description = "ami for netmaker"
default = "none for enable_netmaker false"
default = "none for enable_netmaker false"
}

variable "block_size" {
type = number
type = number
default = 3
}

variable "enable_netmaker" {
type = bool
type = bool
default = false
}

variable "netmaker_vpc_cidr" {
type = string
type = string
default = "10.26.0.0/24"
}

variable "create_haproxy_dns_record" {
default = false
type = bool
variable "create_haproxy_dns_record" {
default = false
type = bool
description = "whether to create public dns record for private ip of bastion for haproxy"
}
}

variable "private_subdomain_string" {
type = string
default = "int"
}


###
# Local copies of variables to allow for parsing
###
locals {
name = var.cluster_name
cluster_domain = "${replace(var.cluster_name, "-", "")}.${var.domain}"
cluster_parent_domain = join(".", [for idx, part in split(".", local.cluster_domain) : part if idx > 0])
cluster_parent_parent_domain = join(".", [for idx, part in split(".", local.cluster_parent_domain) : part if idx > 0])
identifying_tags = { Cluster = var.cluster_name, Domain = local.cluster_domain}
common_tags = merge(local.identifying_tags, var.tags)
azs = slice(data.aws_availability_zones.available.names, 0, var.az_count)
public_zone = var.configure_route_53 ? (var.create_public_zone ? aws_route53_zone.public[0] : data.aws_route53_zone.public[0]) : null
private_zone = var.configure_route_53 ? (var.create_private_zone ? aws_route53_zone.private[0] : data.aws_route53_zone.private[0]) : null
cluster_parent_zone_id = var.configure_route_53 ? (var.manage_parent_domain ? aws_route53_zone.cluster_parent[0].zone_id : data.aws_route53_zone.cluster_parent[0].zone_id) : null
name = var.cluster_name
cluster_domain = "${replace(var.cluster_name, "-", "")}.${var.domain}"
cluster_parent_domain = join(".", [for idx, part in split(".", local.cluster_domain) : part if idx > 0])
cluster_parent_parent_domain = join(".", [for idx, part in split(".", local.cluster_parent_domain) : part if idx > 0])
identifying_tags = { Cluster = var.cluster_name, Domain = local.cluster_domain }
common_tags = merge(local.identifying_tags, var.tags)
azs = slice(data.aws_availability_zones.available.names, 0, var.az_count)
public_zone = var.configure_route_53 ? (var.create_public_zone ? aws_route53_zone.public[0] : data.aws_route53_zone.public[0]) : null
private_zone = var.configure_route_53 ? (var.create_private_zone ? aws_route53_zone.private[0] : data.aws_route53_zone.private[0]) : null
public_int_zone = var.configure_route_53 ? (var.create_public_zone ? aws_route53_zone.public_int[0] : data.aws_route53_zone.public_int[0]) : null
cluster_parent_zone_id = var.configure_route_53 ? (var.manage_parent_domain ? aws_route53_zone.cluster_parent[0].zone_id : data.aws_route53_zone.cluster_parent[0].zone_id) : null
cluster_parent_parent_zone_id = var.configure_route_53 ? ((var.manage_parent_domain && var.manage_parent_domain_ns) ? data.aws_route53_zone.cluster_parent_parent[0].zone_id : null) : null
ssh_keys = []
public_subnets_list = [for az in local.azs : "public-${az}"]
private_subnets_list = [for az in local.azs : "private-${az}"]
public_subnet_cidrs = [for subnet_name in local.public_subnets_list : module.subnet_addrs.network_cidr_blocks[subnet_name]]
private_subnet_cidrs = [for subnet_name in local.private_subnets_list : module.subnet_addrs.network_cidr_blocks[subnet_name]]
}
ssh_keys = []
public_subnets_list = [for az in local.azs : "public-${az}"]
private_subnets_list = [for az in local.azs : "private-${az}"]
subnet_list = flatten([for az in local.azs : concat(["private-${az}", "public-${az}"])])
public_subnet_cidrs = [for subnet_name in local.public_subnets_list : module.subnet_addrs.network_cidr_blocks[subnet_name]]
private_subnet_cidrs = [for subnet_name in local.private_subnets_list : module.subnet_addrs.network_cidr_blocks[subnet_name]]
}
Loading