Skip to content

Commit f4791cf

Browse files
committed
Add more check for serverless
1 parent 8e2edd6 commit f4791cf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cloud/resource_pulsar_cluster.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,34 +106,49 @@ func resourcePulsarCluster() *schema.Resource {
106106
Default: "rapid",
107107
Description: descriptions["release_channel"],
108108
ValidateFunc: validateReleaseChannel,
109+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
110+
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
111+
},
109112
},
110113
"bookie_replicas": {
111114
Type: schema.TypeInt,
112115
Optional: true,
113116
Default: 3,
114117
Description: descriptions["bookie_replicas"],
115118
ValidateFunc: validateBookieReplicas,
119+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
120+
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
121+
},
116122
},
117123
"broker_replicas": {
118124
Type: schema.TypeInt,
119125
Optional: true,
120126
Default: 2,
121127
Description: descriptions["broker_replicas"],
122128
ValidateFunc: validateBrokerReplicas,
129+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
130+
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
131+
},
123132
},
124133
"compute_unit": {
125134
Type: schema.TypeFloat,
126135
Optional: true,
127136
Default: 0.5,
128137
Description: descriptions["compute_unit"],
129138
ValidateFunc: validateCUSU,
139+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
140+
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
141+
},
130142
},
131143
"storage_unit": {
132144
Type: schema.TypeFloat,
133145
Optional: true,
134146
Default: 0.5,
135147
Description: descriptions["storage_unit"],
136148
ValidateFunc: validateCUSU,
149+
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
150+
return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless)
151+
},
137152
},
138153
"config": {
139154
Type: schema.TypeList,

0 commit comments

Comments
 (0)