feat(dns): add validation for cname record-sets (#1019)
relates to #1014 and STACKITTPR-375
This commit is contained in:
parent
82c1d1e644
commit
87bc7415fc
3 changed files with 17 additions and 4 deletions
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue