vsphere/virtual_machine_config_structure.go
func flattenVAppConfig(d *schema.ResourceData, config types.BaseVmConfigInfo) error {
	if config == nil {
		d.Set("vapp_transport", []string{})
		return nil
	}
	// Set `vapp_config here while config is available to avoid extra API calls
	d.Set("vapp_transport", config.GetVmConfigInfo().OvfEnvironmentTransport)

	props := config.GetVmConfigInfo().Property
	if len(props) < 1 {
		// No props to read is a no-op
		return nil
	}
	vac := make(map[string]interface{})
	for _, v := range props {
		if v.Value != "" && v.Value != v.DefaultValue {
			vac[v.Id] = v.Value
		}
	}
	// Only set if properties exist to prevent creating an unnecessary diff
	if len(vac) > 0 {
		return d.Set("vapp", []interface{}{
			map[string]interface{}{
				"properties": vac,
			},
		})
	}
	return nil
}
func flattenVAppConfig(d *schema.ResourceData, config types.BaseVmConfigInfo) error {
	if config == nil {
		d.Set("vapp_transport", []string{})
		return nil
	}
	// Set `vapp_config here while config is available to avoid extra API calls
	d.Set("vapp_transport", config.GetVmConfigInfo().OvfEnvironmentTransport)

	props := config.GetVmConfigInfo().Property
	if len(props) < 1 {
		// No props to read is a no-op
		return nil
	}
	vac := make(map[string]interface{})
	for _, v := range props {
		if v.Value != "" && v.Value != v.DefaultValue {
			vac[v.Id] = v.Value
		}
	}
	// Only set if properties exist to prevent creating an unnecessary diff
	if len(vac) > 0 {
		return d.Set("vapp", []interface{}{
			map[string]interface{}{
				"properties": vac,
			},
		})
	}
	return nil
}
// flattenVAppConfig reads in the vAppConfig from a running virtual machine
// and sets all keys in vapp.