Skip to content

Commit

Permalink
Adds dns_subdomain var to control final hostname (#96)
Browse files Browse the repository at this point in the history
`dns_subdomain` allows a more customized name then the default `name` provided so consumers can scope their subdomains by environment or other customer needs.
  • Loading branch information
Gowiem authored and aknysh committed Oct 23, 2019
1 parent 8505a0a commit 9cfbd59
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ Available targets:
| availability_zone_selector | Availability Zone selector | string | `Any 2` | no |
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
| description | Short description of the Environment | string | `` | no |
| dns_subdomain | The subdomain to create on Route53 for the EB environment. For the subdomain to be created, the `dns_zone_id` variable must be set as well | string | `` | no |
| dns_zone_id | Route53 parent zone ID. The module will create sub-domain DNS record in the parent zone for the EB environment | string | `` | no |
| elastic_beanstalk_application_name | Elastic Beanstalk application name | string | - | yes |
| elb_scheme | Specify `internal` if you want to create an internal load balancer in your Amazon VPC so that your Elastic Beanstalk application cannot be accessed from outside your Amazon VPC | string | `public` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
| availability_zone_selector | Availability Zone selector | string | `Any 2` | no |
| delimiter | Delimiter to be used between `name`, `namespace`, `stage`, etc. | string | `-` | no |
| description | Short description of the Environment | string | `` | no |
| dns_subdomain | The subdomain to create on Route53 for the EB environment. For the subdomain to be created, the `dns_zone_id` variable must be set as well | string | `` | no |
| dns_zone_id | Route53 parent zone ID. The module will create sub-domain DNS record in the parent zone for the EB environment | string | `` | no |
| elastic_beanstalk_application_name | Elastic Beanstalk application name | string | - | yes |
| elb_scheme | Specify `internal` if you want to create an internal load balancer in your Amazon VPC so that your Elastic Beanstalk application cannot be accessed from outside your Amazon VPC | string | `public` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ resource "aws_s3_bucket" "elb_logs" {
module "dns_hostname" {
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.3.0"
enabled = var.dns_zone_id != "" && var.tier == "WebServer" ? true : false
name = var.name
name = var.dns_subdomain != "" ? var.dns_subdomain : var.name
zone_id = var.dns_zone_id
records = [aws_elastic_beanstalk_environment.default.cname]
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ variable "dns_zone_id" {
description = "Route53 parent zone ID. The module will create sub-domain DNS record in the parent zone for the EB environment"
}

variable "dns_subdomain" {
type = string
default = ""
description = "The subdomain to create on Route53 for the EB environment. For the subdomain to be created, the `dns_zone_id` variable must be set as well"
}

variable "allowed_security_groups" {
type = list(string)
description = "List of security groups to be allowed to connect to the EC2 instances"
Expand Down

0 comments on commit 9cfbd59

Please sign in to comment.