@@ -74,7 +74,7 @@ func resourceCloudStackNetwork() *schema.Resource {
7474
7575 "cidr" : {
7676 Type : schema .TypeString ,
77- Required : true ,
77+ Optional : true ,
7878 ForceNew : true ,
7979 },
8080
@@ -190,23 +190,25 @@ func resourceCloudStackNetworkCreate(d *schema.ResourceData, meta interface{}) e
190190 return err
191191 }
192192
193- m , err := parseCIDR (d , no .Specifyipranges )
194- if err != nil {
195- return err
196- }
193+ if _ , ok := d .GetOk ("cidr" ); ok {
194+ m , err := parseCIDR (d , no .Specifyipranges )
195+ if err != nil {
196+ return err
197+ }
197198
198- // Set the needed IP config
199- p .SetGateway (m ["gateway" ])
200- p .SetNetmask (m ["netmask" ])
199+ // Set the needed IP config
200+ p .SetGateway (m ["gateway" ])
201+ p .SetNetmask (m ["netmask" ])
201202
202- // Only set the start IP if we have one
203- if startip , ok := m ["startip" ]; ok {
204- p .SetStartip (startip )
205- }
203+ // Only set the start IP if we have one
204+ if startip , ok := m ["startip" ]; ok {
205+ p .SetStartip (startip )
206+ }
206207
207- // Only set the end IP if we have one
208- if endip , ok := m ["endip" ]; ok {
209- p .SetEndip (endip )
208+ // Only set the end IP if we have one
209+ if endip , ok := m ["endip" ]; ok {
210+ p .SetEndip (endip )
211+ }
210212 }
211213
212214 // Set the network domain if we have one
0 commit comments