Skip to content

Commit f86673c

Browse files
Gowiemmaximmiactions-bot
authored
Adds dns_subdomain variable to override subdomain (#58)
* Adds dns_subdomain variable to override subdomain * Adds dns_subdomain var to README * Updated README.md Co-authored-by: Maxim Mironenko <simixido@gmail.com> Co-authored-by: actions-bot <58130806+actions-bot@users.noreply.github.com>
1 parent 99d2a91 commit f86673c

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ Available targets:
184184
| cluster_mode_replicas_per_node_group | Number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will force a new resource | number | `0` | no |
185185
| cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no |
186186
| delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no |
187+
| dns_subdomain | The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name. | string | `` | no |
187188
| elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no |
188189
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
189190
| engine_version | Redis engine version | string | `4.0.10` | no |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| cluster_mode_replicas_per_node_group | Number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will force a new resource | number | `0` | no |
1919
| cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no |
2020
| delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no |
21+
| dns_subdomain | The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name. | string | `` | no |
2122
| elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no |
2223
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
2324
| engine_version | Redis engine version | string | `4.0.10` | no |

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" {
162162
module "dns" {
163163
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.3.0"
164164
enabled = var.enabled && var.zone_id != "" ? true : false
165-
name = var.name
165+
name = var.dns_subdomain != "" ? var.dns_subdomain : var.name
166166
ttl = 60
167167
zone_id = var.zone_id
168168
records = var.cluster_mode_enabled ? [join("", aws_elasticache_replication_group.default.*.configuration_endpoint_address)] : [join("", aws_elasticache_replication_group.default.*.primary_endpoint_address)]

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ variable "zone_id" {
174174
description = "Route53 DNS Zone ID"
175175
}
176176

177+
variable "dns_subdomain" {
178+
type = string
179+
default = ""
180+
description = "The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name."
181+
}
182+
177183
variable "delimiter" {
178184
type = string
179185
default = "-"

0 commit comments

Comments
 (0)