Skip to content

Commit d19afed

Browse files
feat: customize dns name in sub-module composer_net (#170)
1 parent 597f1a4 commit d19afed

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

modules/composer_net/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This example illustrates how to use the `composer-net` module. Please see exampl
1010
| cloud\_composer\_network\_ipv4\_cidr\_block | The CIDR block from which IP range in tenant project will be reserved. | `string` | `null` | no |
1111
| composer\_env\_name | Name of Cloud Composer Environment | `string` | n/a | yes |
1212
| composer\_sa\_name | Service Account name to be used for running Cloud Composer Environment. | `string` | `"composer-sa"` | no |
13+
| dns\_name | The DNS name of the managed zone | `string` | `"composer.cloud.google.com."` | no |
1314
| dns\_zone\_name | Composer DNS private zone name | `string` | `"composer-google-cloud-dns"` | no |
1415
| gke\_pods\_services\_ip\_ranges | The secondary IP ranges for the GKE Pods and Services IP ranges | `list(string)` | n/a | yes |
1516
| gke\_subnet\_ip\_range | The GKE subnet IP range | `list(string)` | n/a | yes |

modules/composer_net/dns.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ composer.cloud.google.com
1919
resource "google_dns_managed_zone" "composer_cloud_zone" {
2020
name = var.dns_zone_name
2121
project = var.network_project_id
22-
dns_name = "composer.cloud.google.com."
23-
description = "composer.cloud.google.com zone"
22+
dns_name = var.dns_name
23+
description = "${var.dns_name} zone"
2424

2525
visibility = "private"
2626

@@ -32,7 +32,7 @@ resource "google_dns_managed_zone" "composer_cloud_zone" {
3232
}
3333

3434
resource "google_dns_record_set" "composer_cloud_zone-dev-A-record" {
35-
name = "composer.cloud.google.com."
35+
name = var.dns_name
3636
project = var.network_project_id
3737
type = "A"
3838
ttl = 300
@@ -43,12 +43,12 @@ resource "google_dns_record_set" "composer_cloud_zone-dev-A-record" {
4343
}
4444

4545
resource "google_dns_record_set" "composer_cloud_zone-CNAME" {
46-
name = "*.composer.cloud.google.com."
46+
name = "*.${var.dns_name}"
4747
project = var.network_project_id
4848
type = "CNAME"
4949
ttl = 300
5050

5151
managed_zone = google_dns_managed_zone.composer_cloud_zone.name
5252

53-
rrdatas = ["composer.cloud.google.com."]
53+
rrdatas = [var.dns_name]
5454
}

modules/composer_net/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ variable "dns_zone_name" {
7878
default = "composer-google-cloud-dns"
7979
}
8080

81+
variable "dns_name" {
82+
description = "The DNS name of the managed zone"
83+
type = string
84+
default = "composer.cloud.google.com."
85+
}
86+
8187
variable "composer_sa_name" {
8288
description = "Service Account name to be used for running Cloud Composer Environment."
8389
type = string

0 commit comments

Comments
 (0)