Commit f86673ce authored by Matt Gowie's avatar Matt Gowie Committed by GitHub

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: default avatarMaxim Mironenko <simixido@gmail.com>
Co-authored-by: default avataractions-bot <58130806+actions-bot@users.noreply.github.com>
parent 99d2a91e
...@@ -184,6 +184,7 @@ Available targets: ...@@ -184,6 +184,7 @@ Available targets:
| 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 | | 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 |
| cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no | | cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no |
| delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no | | delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no |
| dns_subdomain | The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name. | string | `` | no |
| elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no | | elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no |
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no | | enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
| engine_version | Redis engine version | string | `4.0.10` | no | | engine_version | Redis engine version | string | `4.0.10` | no |
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
| 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 | | 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 |
| cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no | | cluster_size | Number of nodes in cluster. *Ignored when `cluster_mode_enabled` == `true`* | number | `1` | no |
| delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no | | delimiter | Delimiter between `name`, `namespace`, `stage` and `attributes` | string | `-` | no |
| dns_subdomain | The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name. | string | `` | no |
| elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no | | elasticache_subnet_group_name | Subnet group name for the ElastiCache instance | string | `` | no |
| enabled | Set to false to prevent the module from creating any resources | bool | `true` | no | | enabled | Set to false to prevent the module from creating any resources | bool | `true` | no |
| engine_version | Redis engine version | string | `4.0.10` | no | | engine_version | Redis engine version | string | `4.0.10` | no |
......
...@@ -162,7 +162,7 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" { ...@@ -162,7 +162,7 @@ resource "aws_cloudwatch_metric_alarm" "cache_memory" {
module "dns" { module "dns" {
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.3.0" source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.3.0"
enabled = var.enabled && var.zone_id != "" ? true : false enabled = var.enabled && var.zone_id != "" ? true : false
name = var.name name = var.dns_subdomain != "" ? var.dns_subdomain : var.name
ttl = 60 ttl = 60
zone_id = var.zone_id zone_id = var.zone_id
records = var.cluster_mode_enabled ? [join("", aws_elasticache_replication_group.default.*.configuration_endpoint_address)] : [join("", aws_elasticache_replication_group.default.*.primary_endpoint_address)] records = var.cluster_mode_enabled ? [join("", aws_elasticache_replication_group.default.*.configuration_endpoint_address)] : [join("", aws_elasticache_replication_group.default.*.primary_endpoint_address)]
......
...@@ -174,6 +174,12 @@ variable "zone_id" { ...@@ -174,6 +174,12 @@ variable "zone_id" {
description = "Route53 DNS Zone ID" description = "Route53 DNS Zone ID"
} }
variable "dns_subdomain" {
type = string
default = ""
description = "The subdomain to use for the CNAME record. If not provided then the CNAME record will use var.name."
}
variable "delimiter" { variable "delimiter" {
type = string type = string
default = "-" default = "-"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment