Skip to content

Commit

Permalink
Update record-set
Browse files Browse the repository at this point in the history
  • Loading branch information
posquit0 committed Jun 7, 2024
1 parent edd9539 commit 9f42234
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.2
0.15.3
2 changes: 1 addition & 1 deletion modules/record-set/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ No modules.
| <a name="input_type"></a> [type](#input\_type) | (Required) The DNS record type. Valid values are `A`, `AAAA`, `CAA`, `CNAME`, `DS`, `MX`, `NAPTR`, `NS`, `PTR`, `SOA`, `SPF`, `SRV` and `TXT`. | `string` | n/a | yes |
| <a name="input_zone"></a> [zone](#input\_zone) | (Required) The ID of the hosted zone to contain this record set. | `string` | n/a | yes |
| <a name="input_overwrite"></a> [overwrite](#input\_overwrite) | (Optional) Whether to allow creation of this record in Terraform to overwrite an existing record, if any. This does not affect the ability to update the record in Terraform and does not prevent other resources within Terraform or manual Route 53 changes outside Terraform from overwriting this record. This configuration is not recommended for most environments. Defaults to `false`. | `bool` | `false` | no |
| <a name="input_records"></a> [records](#input\_records) | (Optional) A list of records for the record set. Each item of `records` as defined below.<br> (Optional) `id` - A unique ID to differentiate this record from other records with the same domain name and type. Not required if the `routing_policy` is `SIMPLE`. Defaults to `default`.<br> (Optional) `value` - A configuration for non-alias record with a set of the record values. You can specify more than one value for all record types except `CNAME` and `SOA`. Conflicts with `alias`.<br> (Optional) `alias` - A configuration for alias record. Conflicts with `value`. `alias` as defined below.<br> (Required) `name` - DNS domain name for a CloudFront distribution, S3 bucket, ELB, or another record set in this hosted zone.<br> (Required) `zone` - Hosted zone ID for a CloudFront distribution, S3 bucket, ELB, or Route 53 hosted zone.<br> (Optional) `evaluate_target_health` - Whether to respond to DNS queries using this record by checking the health of the alias target. Some resources have special requirements, see related part of documentation. Defaults to `true`. | <pre>list(object({<br> id = optional(string, "default")<br> value = optional(set(string))<br> alias = optional(object({<br> name = string<br> zone = string<br> evaluate_target_health = optional(bool, true)<br> }))<br> }))</pre> | `[]` | no |
| <a name="input_records"></a> [records](#input\_records) | (Optional) A list of records for the record set. Each item of `records` as defined below.<br> (Optional) `id` - A unique ID to differentiate this record from other records with the same domain name and type. Not required if the `routing_policy` is `SIMPLE`. Defaults to `default`.<br> (Optional) `value` - A configuration for non-alias record with a list of the record values. You can specify more than one value for all record types except `CNAME` and `SOA`. Conflicts with `alias`.<br> (Optional) `alias` - A configuration for alias record. Conflicts with `value`. `alias` as defined below.<br> (Required) `name` - DNS domain name for a CloudFront distribution, S3 bucket, ELB, or another record set in this hosted zone.<br> (Required) `zone` - Hosted zone ID for a CloudFront distribution, S3 bucket, ELB, or Route 53 hosted zone.<br> (Optional) `evaluate_target_health` - Whether to respond to DNS queries using this record by checking the health of the alias target. Some resources have special requirements, see related part of documentation. Defaults to `true`. | <pre>list(object({<br> id = optional(string, "default")<br> value = optional(list(string))<br> alias = optional(object({<br> name = string<br> zone = string<br> evaluate_target_health = optional(bool, true)<br> }))<br> }))</pre> | `[]` | no |
| <a name="input_routing_policy"></a> [routing\_policy](#input\_routing\_policy) | (Optional) The routing policy determines how Route 53 responds to queries. Defaults to `SIMPLE`. Supported routing policies are following:<br> `SIMPLE`<br> `WEIGHTED`<br> `GEOLOCATION`<br> `LATENCY`<br> `FAILOVER`<br> `MULTIVALUE_ANSWER`<br> `CIDR`<br> `GEOPROXIMITY` | `string` | `"SIMPLE"` | no |
| <a name="input_ttl"></a> [ttl](#input\_ttl) | (Optional) The record cache time to live (TTL) in seconds. Defaults to `300`.<br> - If you're creating or updating an alias record set, omit `ttl`. Route 53 uses the value of TTL for the alias target.<br> - If you're associating this record set with a health check, we recommend that you specify a `ttl` of `60` seconds or less so clients respond quickly to changes in health status.<br> - All of the records in a group of weighted record sets must have the same value for `ttl`.<br> - If a group of weighted record sets includes one or more weighted alias records for which the alias target is an ELB load balancer, we recommend that you specify a `ttl` of `60` seconds for all of the non-alias weighted records that have the same name and type. Values other than `60` seconds (the TTL for load balancers) will change the effect of the values that you specify for weight. | `number` | `300` | no |

Expand Down
11 changes: 10 additions & 1 deletion modules/record-set/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,16 @@ resource "aws_route53_record" "this" {

## Record
# Non-alias Record
records = each.value.value
records = (var.type == "TXT"
? [
for v in each.value.value :
join("\"\"", [
for idx in range(0, length(v), 255) :
substr(v, idx, 255)
])
]
: each.value.value
)

# Alias Record
dynamic "alias" {
Expand Down
2 changes: 1 addition & 1 deletion modules/record-set/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ output "records" {
value = {
for id, record in aws_route53_record.this :
id => {
id = record.set_identifier
id = record.set_identifier == "" ? null : record.set_identifier
value = record.records
alias = (one(record.alias) != null
? {
Expand Down
4 changes: 2 additions & 2 deletions modules/record-set/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ variable "records" {
description = <<EOF
(Optional) A list of records for the record set. Each item of `records` as defined below.
(Optional) `id` - A unique ID to differentiate this record from other records with the same domain name and type. Not required if the `routing_policy` is `SIMPLE`. Defaults to `default`.
(Optional) `value` - A configuration for non-alias record with a set of the record values. You can specify more than one value for all record types except `CNAME` and `SOA`. Conflicts with `alias`.
(Optional) `value` - A configuration for non-alias record with a list of the record values. You can specify more than one value for all record types except `CNAME` and `SOA`. Conflicts with `alias`.
(Optional) `alias` - A configuration for alias record. Conflicts with `value`. `alias` as defined below.
(Required) `name` - DNS domain name for a CloudFront distribution, S3 bucket, ELB, or another record set in this hosted zone.
(Required) `zone` - Hosted zone ID for a CloudFront distribution, S3 bucket, ELB, or Route 53 hosted zone.
(Optional) `evaluate_target_health` - Whether to respond to DNS queries using this record by checking the health of the alias target. Some resources have special requirements, see related part of documentation. Defaults to `true`.
EOF
type = list(object({
id = optional(string, "default")
value = optional(set(string))
value = optional(list(string))
alias = optional(object({
name = string
zone = string
Expand Down

0 comments on commit 9f42234

Please sign in to comment.