@@ -43,7 +43,6 @@ func resourceCloudStackTrafficType() *schema.Resource {
4343 Description : "The network name label of the physical device dedicated to this traffic on a Hyperv host" ,
4444 Type : schema .TypeString ,
4545 Optional : true ,
46- ForceNew : true ,
4746 },
4847 "isolation_method" : {
4948 Description : "Used if physical network has multiple isolation types and traffic type is public. Choose which isolation method. Valid options currently 'vlan' or 'vxlan', defaults to 'vlan'." ,
@@ -55,13 +54,11 @@ func resourceCloudStackTrafficType() *schema.Resource {
5554 Description : "The network name label of the physical device dedicated to this traffic on a KVM host" ,
5655 Type : schema .TypeString ,
5756 Optional : true ,
58- ForceNew : true ,
5957 },
6058 "ovm3_network_label" : {
6159 Description : "The network name of the physical device dedicated to this traffic on an OVM3 host" ,
6260 Type : schema .TypeString ,
6361 Optional : true ,
64- ForceNew : true ,
6562 },
6663 "physical_network_id" : {
6764 Description : "the Physical Network ID" ,
@@ -80,19 +77,16 @@ func resourceCloudStackTrafficType() *schema.Resource {
8077 Description : "The VLAN id to be used for Management traffic by VMware host" ,
8178 Type : schema .TypeString ,
8279 Optional : true ,
83- ForceNew : true ,
8480 },
8581 "vmware_network_label" : {
8682 Description : "The network name label of the physical device dedicated to this traffic on a VMware host" ,
8783 Type : schema .TypeString ,
8884 Optional : true ,
89- ForceNew : true ,
9085 },
9186 "xen_network_label" : {
9287 Description : "The network name label of the physical device dedicated to this traffic on a XenServer host" ,
9388 Type : schema .TypeString ,
9489 Optional : true ,
95- ForceNew : true ,
9690 },
9791 },
9892 }
@@ -102,7 +96,7 @@ func resourceCloudStackTrafficTypeCreate(d *schema.ResourceData, meta interface{
10296 cs := meta .(* cloudstack.CloudStackClient )
10397
10498 physicalNetworkID := d .Get ("physical_network_id" ).(string )
105- trafficType := d .Get ("type " ).(string )
99+ trafficType := d .Get ("traffic_type " ).(string )
106100
107101 // Create a new parameter struct
108102 p := cs .Usage .NewAddTrafficTypeParams (physicalNetworkID , trafficType )
@@ -144,14 +138,6 @@ func resourceCloudStackTrafficTypeCreate(d *schema.ResourceData, meta interface{
144138
145139 d .SetId (r .Id )
146140
147- d .Set ("physical_network_id" , d .Get ("physical_network_id" ).(string ))
148- d .Set ("hyperv_network_label" , r .Hypervnetworklabel )
149- d .Set ("kvm_network_label" , r .Kvmnetworklabel )
150- d .Set ("ovm3_network_label" , r .Ovm3networklabel )
151- d .Set ("traffic_type" , r .Traffictype )
152- d .Set ("vmware_network_label" , r .Vmwarenetworklabel )
153- d .Set ("xen_network_label" , r .Xennetworklabel )
154-
155141 return resourceCloudStackTrafficTypeRead (d , meta )
156142}
157143
@@ -176,15 +162,15 @@ func resourceCloudStackTrafficTypeRead(d *schema.ResourceData, meta interface{})
176162 }
177163
178164 if trafficType == nil {
179- log .Printf ("[DEBUG] Traffic type %s does no longer exist" , d .Get ("type " ).(string ))
165+ log .Printf ("[DEBUG] Traffic type %s does no longer exist" , d .Get ("traffic_type " ).(string ))
180166 d .SetId ("" )
181167 return nil
182168 }
183169
184170 // The TrafficType struct has a Name field which contains the traffic type
185171 // But in some cases it might be empty, so we'll keep the original value from the state
186172 if trafficType .Name != "" {
187- d .Set ("type " , trafficType .Name )
173+ d .Set ("traffic_type " , trafficType .Name )
188174 }
189175
190176 // Note: The TrafficType struct doesn't have fields for network labels or VLAN
@@ -224,18 +210,11 @@ func resourceCloudStackTrafficTypeUpdate(d *schema.ResourceData, meta interface{
224210 // so we can't update the VLAN
225211
226212 // Update the traffic type
227- r , err := cs .Usage .UpdateTrafficType (p )
213+ _ , err := cs .Usage .UpdateTrafficType (p )
228214 if err != nil {
229- return fmt .Errorf ("Error updating traffic type %s: %s" , d .Get ("type " ).(string ), err )
215+ return fmt .Errorf ("Error updating traffic type %s: %s" , d .Get ("traffic_type " ).(string ), err )
230216 }
231217
232- d .Set ("hyperv_network_label" , r .Hypervnetworklabel )
233- d .Set ("kvm_network_label" , r .Kvmnetworklabel )
234- d .Set ("ovm3_network_label" , r .Ovm3networklabel )
235- d .Set ("traffic_type" , r .Traffictype )
236- d .Set ("vmware_network_label" , r .Vmwarenetworklabel )
237- d .Set ("xen_network_label" , r .Xennetworklabel )
238-
239218 return resourceCloudStackTrafficTypeRead (d , meta )
240219}
241220
@@ -255,7 +234,7 @@ func resourceCloudStackTrafficTypeDelete(d *schema.ResourceData, meta interface{
255234 return nil
256235 }
257236
258- return fmt .Errorf ("Error deleting traffic type %s: %s" , d .Get ("type " ).(string ), err )
237+ return fmt .Errorf ("Error deleting traffic type %s: %s" , d .Get ("traffic_type " ).(string ), err )
259238 }
260239
261240 return nil
@@ -289,11 +268,11 @@ func resourceCloudStackTrafficTypeImport(d *schema.ResourceData, meta interface{
289268 // Set the type attribute - use the original value from the API call
290269 // If the Name field is empty, use a default value based on the traffic type ID
291270 if tt .Name != "" {
292- d .Set ("type " , tt .Name )
271+ d .Set ("traffic_type " , tt .Name )
293272 } else {
294273 // Use a default value based on common traffic types
295274 // This is a fallback and might not be accurate
296- d .Set ("type " , "Management" )
275+ d .Set ("traffic_type " , "Management" )
297276 }
298277
299278 // For import to work correctly, we need to set default values for network labels
0 commit comments