From 78ebd66278be81b058acbd3b6b6bdb1ffde9daa2 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Mon, 20 Oct 2025 12:46:08 -0400 Subject: [PATCH 1/2] Fix traffic type import due to incorrect parameter --- cloudstack/resource_cloudstack_traffic_type.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cloudstack/resource_cloudstack_traffic_type.go b/cloudstack/resource_cloudstack_traffic_type.go index 1e3a3a9e..b4368c34 100644 --- a/cloudstack/resource_cloudstack_traffic_type.go +++ b/cloudstack/resource_cloudstack_traffic_type.go @@ -167,10 +167,8 @@ func resourceCloudStackTrafficTypeRead(d *schema.ResourceData, meta interface{}) return nil } - // The TrafficType struct has a Name field which contains the traffic type - // But in some cases it might be empty, so we'll keep the original value from the state - if trafficType.Name != "" { - d.Set("traffic_type", trafficType.Name) + if trafficType.Traffictype != "" { + d.Set("traffic_type", trafficType.Traffictype) } // Note: The TrafficType struct doesn't have fields for network labels or VLAN @@ -266,9 +264,9 @@ func resourceCloudStackTrafficTypeImport(d *schema.ResourceData, meta interface{ d.Set("physical_network_id", pn.Id) // Set the type attribute - use the original value from the API call - // If the Name field is empty, use a default value based on the traffic type ID - if tt.Name != "" { - d.Set("traffic_type", tt.Name) + // If the Traffictype field is empty, use a default value based on the traffic type ID + if tt.Traffictype != "" { + d.Set("traffic_type", tt.Traffictype) } else { // Use a default value based on common traffic types // This is a fallback and might not be accurate From 409cdac8a7673c4ea76ab20a8909a90c3e7b5cfa Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Mon, 27 Oct 2025 17:03:44 -0400 Subject: [PATCH 2/2] fix traffic type --- .../resource_cloudstack_traffic_type.go | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/cloudstack/resource_cloudstack_traffic_type.go b/cloudstack/resource_cloudstack_traffic_type.go index b4368c34..0bb4a4f9 100644 --- a/cloudstack/resource_cloudstack_traffic_type.go +++ b/cloudstack/resource_cloudstack_traffic_type.go @@ -171,8 +171,29 @@ func resourceCloudStackTrafficTypeRead(d *schema.ResourceData, meta interface{}) d.Set("traffic_type", trafficType.Traffictype) } - // Note: The TrafficType struct doesn't have fields for network labels or VLAN - // We'll need to rely on what we store in the state + if trafficType.Kvmnetworklabel != "" { + d.Set("kvm_network_label", trafficType.Kvmnetworklabel) + } + + if trafficType.Vlan != "" { + d.Set("vlan", trafficType.Vlan) + } + + if trafficType.Xennetworklabel != "" { + d.Set("xen_network_label", trafficType.Xennetworklabel) + } + + if trafficType.Vmwarenetworklabel != "" { + d.Set("vmware_network_label", trafficType.Vmwarenetworklabel) + } + + if trafficType.Hypervnetworklabel != "" { + d.Set("hyperv_network_label", trafficType.Hypervnetworklabel) + } + + if trafficType.Ovm3networklabel != "" { + d.Set("ovm3_network_label", trafficType.Ovm3networklabel) + } return nil }