Skip to content

Commit

Permalink
take [0] of values
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 24, 2023
1 parent 60f8020 commit 575c9db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cname/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# About
A CNAME may contain only one entry, so if you pass multiple values (a list), it will only use the first one.
# Usage

```hcl
module "lakefront_cname" {
source = "git@github.e.it.census.gov:terraform-modules/aws-dns//cname"
name = format("%v.%v", local.app_shortname, var.vpc_domain_name)
values = [format("%v.execute-api.%v.amazonaws.com", data.aws_api_gateway_rest_api.lakefront.id, local.region)]
values = format("%v.execute-api.%v.amazonaws.com", data.aws_api_gateway_rest_api.lakefront.id, local.region)
}
```

Expand Down
5 changes: 4 additions & 1 deletion cname/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/* aws-dns :: cname
* # About
* A CNAME may contain only one entry, so if you pass multiple values (a list), it will only use the first one.
* # Usage
*
* ```hcl
* module "lakefront_cname" {
* source = "git@github.e.it.census.gov:terraform-modules/aws-dns//cname"
*
* name = format("%v.%v", local.app_shortname, var.vpc_domain_name)
* values = [format("%v.execute-api.%v.amazonaws.com", data.aws_api_gateway_rest_api.lakefront.id, local.region)]
* values = format("%v.execute-api.%v.amazonaws.com", data.aws_api_gateway_rest_api.lakefront.id, local.region)
* }
* ```
*
*/

locals {
record_type = "cname"
values = [local.default_values[0]]
}
2 changes: 1 addition & 1 deletion common/common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ locals {
rr_type = upper(local.record_type)
default_enable_ptr = lookup(local._defaults.enable_ptr, local.record_type, false)
default_heritage_prefix = lookup(local._defaults.heritage_prefix, local.record_type, "") != "" ? format("%v.", lookup(local._defaults.heritage_prefix, local.record_type)) : ""
values = try([tostring(var.values)], tolist(var.values))
default_values = try([tostring(var.values)], tolist(var.values))
}

resource "time_static" "timestamp" {}
2 changes: 1 addition & 1 deletion common/entry.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ resource "aws_route53_record" "entry" {
name = var.name
type = local.rr_type
ttl = var.ttl
records = var.values
records = local.values
}

0 comments on commit 575c9db

Please sign in to comment.