feat(dns): add validation for cname record-sets (#1019)

relates to #1014 and STACKITTPR-375
This commit is contained in:
Marcel Jacek 2025-10-15 09:42:22 +02:00 committed by GitHub
parent 82c1d1e644
commit 87bc7415fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 4 deletions

View file

@ -132,6 +132,14 @@ func RecordSet() *Validator {
))
}
case "CNAME":
name := req.ConfigValue.ValueString()
if name == "" || name[len(name)-1] != '.' {
resp.Diagnostics.Append(validatordiag.InvalidAttributeValueDiagnostic(
req.Path,
"value must be a Fully Qualified Domain Name (FQDN) and end with dot '.'",
req.ConfigValue.ValueString(),
))
}
case "NS":
case "MX":
case "TXT":

View file

@ -264,8 +264,14 @@ func TestRecordSet(t *testing.T) {
false,
},
{
"CNAME record",
"some-record",
"CNAME record Not a Fully Qualified Domain Name",
"stackit.de",
"CNAME",
false,
},
{
"CNAME record ok Fully Qualified Domain Name",
"stackit.de.",
"CNAME",
true,
},