File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -373,9 +373,10 @@ func ResourceServer() *schema.Resource {
373373 },
374374 },
375375 "admin_password_encryption_ssh_key_id" : {
376- Type : schema .TypeString ,
377- Optional : true ,
378- Description : "The ID of the IAM SSH key used to encrypt the initial admin password on a Windows server" ,
376+ Type : schema .TypeString ,
377+ Optional : true ,
378+ ValidateDiagFunc : verify .IsUUIDOrEmpty (),
379+ Description : "The ID of the IAM SSH key used to encrypt the initial admin password on a Windows server" ,
379380 },
380381 "zone" : zonal .Schema (),
381382 "organization_id" : account .OrganizationIDSchema (),
Original file line number Diff line number Diff line change @@ -42,6 +42,33 @@ func IsUUID() schema.SchemaValidateDiagFunc {
4242 }
4343}
4444
45+ func IsUUIDOrEmpty () schema.SchemaValidateDiagFunc {
46+ return func (value any , path cty.Path ) diag.Diagnostics {
47+ uuid , isString := value .(string )
48+ if ! isString {
49+ return diag.Diagnostics {diag.Diagnostic {
50+ Severity : diag .Error ,
51+ Summary : "invalid UUID not a string" ,
52+ AttributePath : path ,
53+ }}
54+ }
55+ if uuid == "" {
56+ return nil
57+ }
58+
59+ if ! validation .IsUUID (uuid ) {
60+ return diag.Diagnostics {diag.Diagnostic {
61+ Severity : diag .Error ,
62+ Summary : "invalid UUID: " + uuid ,
63+ AttributePath : path ,
64+ Detail : "format should be 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' (36) and contains valid hexadecimal characters" ,
65+ }}
66+ }
67+
68+ return nil
69+ }
70+ }
71+
4572func IsUUIDWithLocality () schema.SchemaValidateDiagFunc {
4673 return func (value any , path cty.Path ) diag.Diagnostics {
4774 uuid , isString := value .(string )
You can’t perform that action at this time.
0 commit comments