@@ -80,24 +80,27 @@ func resourceCloudStackNetwork() *schema.Resource {
8080 },
8181
8282 "gateway" : {
83- Type : schema .TypeString ,
84- Optional : true ,
85- Computed : true ,
86- ForceNew : true ,
83+ Type : schema .TypeString ,
84+ Optional : true ,
85+ Computed : true ,
86+ ForceNew : true ,
87+ RequiredWith : []string {"cidr" },
8788 },
8889
8990 "startip" : {
90- Type : schema .TypeString ,
91- Optional : true ,
92- Computed : true ,
93- ForceNew : true ,
91+ Type : schema .TypeString ,
92+ Optional : true ,
93+ Computed : true ,
94+ ForceNew : true ,
95+ RequiredWith : []string {"cidr" },
9496 },
9597
9698 "endip" : {
97- Type : schema .TypeString ,
98- Optional : true ,
99- Computed : true ,
100- ForceNew : true ,
99+ Type : schema .TypeString ,
100+ Optional : true ,
101+ Computed : true ,
102+ ForceNew : true ,
103+ RequiredWith : []string {"cidr" },
101104 },
102105
103106 "network_domain" : {
@@ -185,13 +188,13 @@ func resourceCloudStackNetworkCreate(d *schema.ResourceData, meta interface{}) e
185188 p .SetDisplaytext (name )
186189 }
187190
188- // Get the network offering to check if it supports specifying IP ranges
189- no , _ , err := cs .NetworkOffering .GetNetworkOfferingByID (networkofferingid )
190- if err != nil {
191- return err
192- }
193-
194191 if _ , ok := d .GetOk ("cidr" ); ok {
192+ // Get the network offering to check if it supports specifying IP ranges
193+ no , _ , err := cs .NetworkOffering .GetNetworkOfferingByID (networkofferingid )
194+ if err != nil {
195+ return err
196+ }
197+
195198 m , err := parseCIDR (d , no .Specifyipranges )
196199 if err != nil {
197200 return err
0 commit comments