Skip to content

Commit

Permalink
fix: use short hostname for dns record (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
syphernl authored Dec 24, 2020
1 parent 8defd13 commit f42f0fc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Available targets:
| egress\_allowed | Allow all egress traffic from instance | `bool` | `false` | no |
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| host\_name | The Bastion hostname created in Route53 | `string` | `"bastion"` | no |
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| ingress\_security\_groups | AWS security group IDs allowed ingress to instance | `list(string)` | `[]` | no |
| instance\_type | Bastion instance type | `string` | `"t2.micro"` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
| egress\_allowed | Allow all egress traffic from instance | `bool` | `false` | no |
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| environment | Environment, e.g. 'uw2', 'us-west-2', OR 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| host\_name | The Bastion hostname created in Route53 | `string` | `"bastion"` | no |
| id\_length\_limit | Limit `id` to this many characters.<br>Set to `0` for unlimited length.<br>Set to `null` for default, which is `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| ingress\_security\_groups | AWS security group IDs allowed ingress to instance | `list(string)` | `[]` | no |
| instance\_type | Bastion instance type | `string` | `"t2.micro"` | no |
Expand Down
15 changes: 8 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ resource "aws_instance" "default" {
}

module "dns" {
source = "cloudposse/route53-cluster-hostname/aws"
version = "0.9.0"
enabled = module.this.enabled && var.zone_id != "" ? true : false
zone_id = var.zone_id
ttl = 60
records = var.associate_public_ip_address ? aws_instance.default.*.public_dns : aws_instance.default.*.private_dns
context = module.this.context
source = "cloudposse/route53-cluster-hostname/aws"
version = "0.9.0"
enabled = module.this.enabled && var.zone_id != "" ? true : false
zone_id = var.zone_id
ttl = 60
records = var.associate_public_ip_address ? aws_instance.default.*.public_dns : aws_instance.default.*.private_dns
context = module.this.context
dns_name = var.host_name
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ variable "egress_allowed" {
default = false
description = "Allow all egress traffic from instance"
}

variable "host_name" {
type = string
default = "bastion"
description = "The Bastion hostname created in Route53"
}

0 comments on commit f42f0fc

Please sign in to comment.