File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 55 "fmt"
66 "strings"
77
8- dnsUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/utils"
9-
108 "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
119 "github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
1210 "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
@@ -23,6 +21,7 @@ import (
2321 "github.com/stackitcloud/stackit-sdk-go/services/dns/wait"
2422 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
2523 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
24+ dnsUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/dns/utils"
2625 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"
2726 "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/validate"
2827)
Original file line number Diff line number Diff line change @@ -132,6 +132,14 @@ func RecordSet() *Validator {
132132 ))
133133 }
134134 case "CNAME" :
135+ name := req .ConfigValue .ValueString ()
136+ if name == "" || name [len (name )- 1 ] != '.' {
137+ resp .Diagnostics .Append (validatordiag .InvalidAttributeValueDiagnostic (
138+ req .Path ,
139+ "value must be a Fully Qualified Domain Name (FQDN) and end with dot '.'" ,
140+ req .ConfigValue .ValueString (),
141+ ))
142+ }
135143 case "NS" :
136144 case "MX" :
137145 case "TXT" :
Original file line number Diff line number Diff line change @@ -264,8 +264,14 @@ func TestRecordSet(t *testing.T) {
264264 false ,
265265 },
266266 {
267- "CNAME record" ,
268- "some-record" ,
267+ "CNAME record Not a Fully Qualified Domain Name" ,
268+ "stackit.de" ,
269+ "CNAME" ,
270+ false ,
271+ },
272+ {
273+ "CNAME record ok Fully Qualified Domain Name" ,
274+ "stackit.de." ,
269275 "CNAME" ,
270276 true ,
271277 },
You can’t perform that action at this time.
0 commit comments