From f42f0fcb1858b849bd4e03ea580f79c00c222db9 Mon Sep 17 00:00:00 2001
From: Frank <639906+syphernl@users.noreply.github.com>
Date: Thu, 24 Dec 2020 08:58:19 +0100
Subject: [PATCH] fix: use short hostname for dns record (#53)
---
README.md | 1 +
docs/terraform.md | 1 +
main.tf | 15 ++++++++-------
variables.tf | 6 ++++++
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 226c8db..ed02f51 100644
--- a/README.md
+++ b/README.md
@@ -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.
Set to `0` for unlimited length.
Set to `null` for default, which is `0`.
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 |
diff --git a/docs/terraform.md b/docs/terraform.md
index ef56ea8..48dcd9f 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -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.
Set to `0` for unlimited length.
Set to `null` for default, which is `0`.
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 |
diff --git a/main.tf b/main.tf
index 066a88a..a1b60c9 100644
--- a/main.tf
+++ b/main.tf
@@ -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
}
diff --git a/variables.tf b/variables.tf
index 0c060c9..c2bdc48 100644
--- a/variables.tf
+++ b/variables.tf
@@ -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"
+}