File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ func ResourceServer() *schema.Resource {
68
68
69
69
return ok && newValue == offerName
70
70
},
71
+ ValidateDiagFunc : verify .IsUUIDOrNameOffer (),
71
72
},
72
73
"offer_id" : {
73
74
Type : schema .TypeString ,
Original file line number Diff line number Diff line change @@ -66,3 +66,28 @@ func IsUUIDWithLocality() schema.SchemaValidateDiagFunc {
66
66
return IsUUID ()(subUUID , path )
67
67
}
68
68
}
69
+
70
+ func IsUUIDOrNameOffer () schema.SchemaValidateDiagFunc {
71
+ return func (value interface {}, path cty.Path ) diag.Diagnostics {
72
+ uuid , _ := value .(string )
73
+ if ! validation .IsUUID (uuid ) {
74
+ return diag.Diagnostics {diag.Diagnostic {
75
+ Severity : diag .Warning ,
76
+ Summary : "Using a datasource for better consistency and reliability is recommended instead of directly using offer names." ,
77
+ AttributePath : path ,
78
+ Detail : `The offer name should be retrieved using a datasource to ensure reliable and consistent configuration.
79
+
80
+ Example:
81
+ data "scaleway_baremetal_offer" "my_offer_monthly" {
82
+ zone = "fr-par-2"
83
+ name = "EM-B112X-SSD"
84
+ subscription_period = "monthly"
85
+ }
86
+
87
+ Then, you can reference the datasource's attributes in your resources.` ,
88
+ }}
89
+ }
90
+
91
+ return nil
92
+ }
93
+ }
You can’t perform that action at this time.
0 commit comments