lowercase everything in r53 names

This commit is contained in:
clint shryock 2015-10-20 16:36:25 -05:00
parent d798042475
commit 953f38c534
2 changed files with 5 additions and 4 deletions

View File

@ -196,12 +196,13 @@ func resourceAwsRoute53RecordCreate(d *schema.ResourceData, meta interface{}) er
// Generate an ID
vars := []string{
zone,
d.Get("name").(string),
strings.ToLower(d.Get("name").(string)),
d.Get("type").(string),
}
if v, ok := d.GetOk("set_identifier"); ok {
vars = append(vars, v.(string))
}
d.SetId(strings.Join(vars, "_"))
// Wait until we are done
@ -447,7 +448,7 @@ func cleanRecordName(name string) string {
// If it does not, add the zone name to form a fully qualified name
// and keep AWS happy.
func expandRecordName(name, zone string) string {
rn := strings.TrimSuffix(name, ".")
rn := strings.ToLower(strings.TrimSuffix(name, "."))
zone = strings.TrimSuffix(zone, ".")
if !strings.HasSuffix(rn, zone) {
rn = strings.Join([]string{name, zone}, ".")

View File

@ -291,7 +291,7 @@ func testAccCheckRoute53RecordExists(n string) resource.TestCheckFunc {
// rec := resp.ResourceRecordSets[0]
for _, rec := range resp.ResourceRecordSets {
recName := cleanRecordName(*rec.Name)
if FQDN(recName) == FQDN(en) && *rec.Type == rType {
if FQDN(strings.ToLower(recName)) == FQDN(strings.ToLower(en)) && *rec.Type == rType {
return nil
}
}
@ -306,7 +306,7 @@ resource "aws_route53_zone" "main" {
resource "aws_route53_record" "default" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "www.notexample.com"
name = "www.NOTexamplE.com"
type = "A"
ttl = "30"
records = ["127.0.0.1", "127.0.0.27"]