Skip to content

Commit

Permalink
♻️ refactor(dns): refactor to use tf native
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Oct 10, 2024
1 parent 75cbec8 commit 3979d7d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 34 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ have a istio proxy configured, prevent communication with that pod.)
| [helm_release.ingress](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [helm_release.istiod](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource |
| [kubernetes_namespace.ns](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource |
| [kubernetes_service.apiserver](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/service) | data source |

## Inputs

Expand All @@ -116,6 +115,7 @@ have a istio proxy configured, prevent communication with that pod.)
| <a name="input_extra_listener_ports"></a> [extra\_listener\_ports](#input\_extra\_listener\_ports) | A list of additional ports that the ingress load balancer should listen to, 9094 for kafka as an example. | <pre>list(object({<br> name = string<br> port = string<br> }))</pre> | `[]` | no |
| <a name="input_istio_chart_version"></a> [istio\_chart\_version](#input\_istio\_chart\_version) | The version of istio to install into the cluster. | `string` | `"1.22.3"` | no |
| <a name="input_istio_version"></a> [istio\_version](#input\_istio\_version) | The version of istio to install into the cluster. | `string` | `"1.22.3"` | no |
| <a name="input_kubernetes_service_apiserver"></a> [kubernetes\_service\_apiserver](#input\_kubernetes\_service\_apiserver) | Use to exclude internal API service traffic from the service mesh; it should not change but could be necessary to lookup | `string` | `"172.20.0.1"` | no |
| <a name="input_namespace"></a> [namespace](#input\_namespace) | The namespace to install the istio components. Defaults to 'istio-system' | `string` | `"istio-system"` | no |
| <a name="input_profile"></a> [profile](#input\_profile) | AWS\_PROFILE to use to apply the terraform script. | `string` | `""` | no |
| <a name="input_region"></a> [region](#input\_region) | The region in which the cluster is running. | `string` | n/a | yes |
Expand All @@ -125,6 +125,7 @@ have a istio proxy configured, prevent communication with that pod.)

| Name | Description |
|------|-------------|
| <a name="output_istio_namespace"></a> [istio\_namespace](#output\_istio\_namespace) | The namespace used by istio. |
| <a name="output_module_name"></a> [module\_name](#output\_module\_name) | The name of this module. |
| <a name="output_module_version"></a> [module\_version](#output\_module\_version) | The version of this module. |
<!-- END_TF_DOCS -->
15 changes: 0 additions & 15 deletions load_balancer_dns.sh

This file was deleted.

13 changes: 0 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,3 @@ resource "helm_release" "egress" {

timeout = 90
}

###################################################################
# INGRESS NLB DATA
###################################################################

# We need to lookup the DNS entry for the istio ingress load balancer
# This value is used to create the CNAME record for cluster app/api addressing in the DNS module
# We use this external data source to avoid issues with running plans
data "external" "load_balancer_dns" {
depends_on = [helm_release.ingress]

program = ["bash", "${path.module}/load_balancer_dns.sh", format("%v-%v", var.cluster_name, "istio-ingress")]
}
8 changes: 4 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ output "module_version" {
value = local.module_version
}

output "istio_ingress_lb" {
description = "The Istio ingress network load balancer."
value = data.external.load_balancer_dns.result.dnsName
}
output "istio_namespace" {
description = "The namespace used by istio."
value = kubernetes_namespace.ns.metadata[0].name
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ variable "kubernetes_service_apiserver" {
description = "Use to exclude internal API service traffic from the service mesh; it should not change but could be necessary to lookup"
type = string
default = "172.20.0.1"
}
}

0 comments on commit 3979d7d

Please sign in to comment.