This module replicates the official external-dns
Helm chart with focus on Google Cloud and some additions:
- Create Kubernetes namespace
- Create GKE workload identity
- Bind cross-project Cloud DNS managed zone IAM role
The work has been inspired by ExternalDNS GKE and Cloud DNS integration official guide.
- Enable TXT records encryption
When external-dns creates records now, it creates 2 TXT records instead of 1. Each record has the same --txt-prefix,
however the other one has an a at the end:
txt-prefix-example.com
txt-prefix-a-example.com
The default policy for DNS records management is sync which allows ExternalDNS to create, update, and delete DNS records.
You can change the policy by setting the policy input variable to create-only, upsert-only or delete-only value.
apiVersion: v1
kind: Service
metadata:
annotations:
external-dns.alpha.kubernetes.io/hostname: app.acme.com.
external-dns.alpha.kubernetes.io/ttl: "60"
Google APIs are expected to be activated:
dns.googleapis.comCloud DNS APIcontainer.googleapis.comGKE APIiam.googleapis.comIAM API
module "example" {
source = "git::git@github.com:livelink/terraform-kubernetes-external-dns.git?ref=v0.3.0"
project_id = "com-livelinklabs-4-3"
dns_project_id = "com-livelinklabs-dns"
dns_managed_zone_name = "dice"
dns_zones = ["dice.livelinklabs.com"]
txt_owner_id = "livelink-test-external-dns"
}| Name | Version |
|---|---|
| terraform | >= 1.7.0 |
| ~> 5.0 | |
| kubernetes | ~> 2.0 |
| Name | Version |
|---|---|
| google.dns | ~> 5.0 |
| kubernetes | ~> 2.0 |
| Name | Source | Version |
|---|---|---|
| runtime_identity | terraform-google-modules/kubernetes-engine/google//modules/workload-identity | 31.0.0 |
| Name | Type |
|---|---|
| google_project_iam_member.default | resource |
| kubernetes_cluster_role.default | resource |
| kubernetes_cluster_role_binding.default | resource |
| kubernetes_deployment.default | resource |
| kubernetes_namespace.default | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| dns_project_id | GCP project ID where DNS zones are hosted | string |
n/a | yes |
| dns_zones | DNS zones: example.com, acme.com | list(string) |
n/a | yes |
| image | Docker image | string |
"registry.k8s.io/external-dns/external-dns:v0.14.2" |
no |
| interval | Interval for DNS sync | string |
"1m" |
no |
| name | Global name | string |
"external-dns" |
no |
| namespace | Kubernetes namespace | string |
"external-dns" |
no |
| policy | Policy for DNS records: sync, create-only, upsert-only, delete-only | string |
"sync" |
no |
| project_id | GCP project ID where GKE cluster is deployed | string |
n/a | yes |
| resources | Kubernetes deployment container resources | object({ |
{ |
no |
| txt_owner_id | Registry TXT Owner ID | string |
"" |
no |
| txt_prefix | Registry TXT Prefix | string |
"external-dns-" |
no |
No outputs.
brew install pre-commit tswitch terraform-docs tflint tfsec
pre-commit install --install-hooks