From 48388aa91f150cce60c6d375537b1e055392be35 Mon Sep 17 00:00:00 2001 From: fmunoz Date: Wed, 21 Sep 2022 09:05:02 -0600 Subject: [PATCH] ## 0.6.6-beta (Sep 21, 2022) FEATURES: * New provider configuration variable added: - **enable_auto_import** (String) Flag to enable or disable terraform automatic import (Automatic import means that when Terraform attempts to create the resource, it will perform a get operation if it founds a matching resource, it will perform an import of the resource it found, this is a similar operation to the terraform import command.) in resources, this is a configuration added to the provider, it uses the ISE_ENABLE_AUTO_IMPORT environment variable; `true` to enable it, defaults to `false`. BUG FIXES: * The provider overwrites the configuration to the one in the `tf file` even if it is updated outside of the provider. * On `resource_sgt` `value` parameter adds new validation, it only allows numbers greatest or equal than `2` and lower or equal than `65519`. --- CHANGELOG.md | 10 + Makefile | 2 +- README.md | 4 +- ciscoise/config.go | 18 +- ciscoise/data_source_aci_bindings.go | 3 +- ciscoise/data_source_aci_settings.go | 3 +- ciscoise/data_source_aci_test_connectivity.go | 3 +- ciscoise/data_source_active_directory.go | 3 +- ...ive_directory_get_groups_by_domain_info.go | 3 +- ...tive_directory_get_trusted_domains_info.go | 3 +- ...e_active_directory_get_user_groups_info.go | 3 +- ...ctive_directory_is_user_member_of_group.go | 3 +- ciscoise/data_source_admin_user.go | 3 +- ciscoise/data_source_allowed_protocols.go | 3 +- ciscoise/data_source_anc_endpoint.go | 3 +- ...source_anc_endpoint_bulk_monitor_status.go | 3 +- ciscoise/data_source_anc_policy.go | 3 +- ...a_source_anc_policy_bulk_monitor_status.go | 3 +- ciscoise/data_source_authorization_profile.go | 3 +- ciscoise/data_source_backup_last_status.go | 3 +- ciscoise/data_source_byod_portal.go | 3 +- ciscoise/data_source_certificate_profile.go | 3 +- ciscoise/data_source_certificate_template.go | 3 +- ciscoise/data_source_csr.go | 3 +- ciscoise/data_source_csr_export.go | 5 +- ciscoise/data_source_deployment.go | 3 +- ...ice_administration_authentication_rules.go | 3 +- ...vice_administration_authorization_rules.go | 3 +- ...ource_device_administration_command_set.go | 3 +- ...source_device_administration_conditions.go | 3 +- ...tion_conditions_for_authentication_rule.go | 3 +- ...ation_conditions_for_authorization_rule.go | 3 +- ...dministration_conditions_for_policy_set.go | 3 +- ...on_dictionary_attributes_authentication.go | 3 +- ...ion_dictionary_attributes_authorization.go | 3 +- ...ration_dictionary_attributes_policy_set.go | 3 +- ...e_administration_global_exception_rules.go | 3 +- ...e_device_administration_identity_stores.go | 3 +- ...ce_administration_local_exception_rules.go | 3 +- ...evice_administration_network_conditions.go | 3 +- ...source_device_administration_policy_set.go | 3 +- ...a_source_device_administration_profiles.go | 3 +- ...rce_device_administration_service_names.go | 3 +- ...ice_administration_time_date_conditions.go | 3 +- ciscoise/data_source_downloadable_acl.go | 3 +- ciscoise/data_source_egress_matrix_cell.go | 3 +- ..._egress_matrix_cell_bulk_monitor_status.go | 3 +- ciscoise/data_source_endpoint.go | 3 +- ...ata_source_endpoint_bulk_monitor_status.go | 3 +- ..._source_endpoint_get_rejected_endpoints.go | 3 +- ciscoise/data_source_endpoint_group.go | 3 +- .../data_source_external_radius_server.go | 3 +- ciscoise/data_source_filter_policy.go | 3 +- ciscoise/data_source_guest_location.go | 3 +- ...source_guest_smtp_notification_settings.go | 3 +- ciscoise/data_source_guest_ssid.go | 3 +- ciscoise/data_source_guest_type.go | 3 +- ciscoise/data_source_guest_user.go | 3 +- ...a_source_guest_user_bulk_monitor_status.go | 3 +- ciscoise/data_source_hotpatch.go | 3 +- ciscoise/data_source_hotspot_portal.go | 3 +- ciscoise/data_source_id_store_sequence.go | 3 +- ciscoise/data_source_identity_group.go | 3 +- ciscoise/data_source_internal_user.go | 3 +- .../data_source_licensing_connection_type.go | 3 +- .../data_source_licensing_eval_license.go | 3 +- ...ource_licensing_feature_to_tier_mapping.go | 3 +- .../data_source_licensing_registration.go | 3 +- ciscoise/data_source_licensing_smart_state.go | 3 +- ciscoise/data_source_licensing_tier_state.go | 3 +- ciscoise/data_source_mnt_account_status.go | 5 +- .../data_source_mnt_authentication_status.go | 5 +- ciscoise/data_source_mnt_failure_reasons.go | 5 +- .../data_source_mnt_session_active_count.go | 3 +- .../data_source_mnt_session_active_list.go | 3 +- ciscoise/data_source_mnt_session_auth_list.go | 3 +- ciscoise/data_source_mnt_session_by_ip.go | 5 +- ciscoise/data_source_mnt_session_by_mac.go | 5 +- ciscoise/data_source_mnt_session_by_nas_ip.go | 5 +- .../data_source_mnt_session_by_username.go | 5 +- .../data_source_mnt_session_disconnect.go | 5 +- .../data_source_mnt_session_posture_count.go | 3 +- .../data_source_mnt_session_profiler_count.go | 3 +- ...ata_source_mnt_session_reauthentication.go | 5 +- .../data_source_mnt_sessions_by_session_id.go | 5 +- ciscoise/data_source_mnt_version.go | 3 +- ciscoise/data_source_my_device_portal.go | 3 +- .../data_source_native_supplicant_profile.go | 3 +- ...rce_network_access_authentication_rules.go | 3 +- ...urce_network_access_authorization_rules.go | 3 +- .../data_source_network_access_conditions.go | 3 +- ...cess_conditions_for_authentication_rule.go | 3 +- ...ccess_conditions_for_authorization_rule.go | 3 +- ...etwork_access_conditions_for_policy_set.go | 3 +- .../data_source_network_access_dictionary.go | 3 +- ...rce_network_access_dictionary_attribute.go | 3 +- ...ss_dictionary_attributes_authentication.go | 3 +- ...ess_dictionary_attributes_authorization.go | 3 +- ...access_dictionary_attributes_policy_set.go | 3 +- ...e_network_access_global_exception_rules.go | 3 +- ...a_source_network_access_identity_stores.go | 3 +- ...ce_network_access_local_exception_rules.go | 3 +- ...source_network_access_network_condition.go | 3 +- .../data_source_network_access_policy_set.go | 3 +- .../data_source_network_access_profiles.go | 3 +- ...a_source_network_access_security_groups.go | 3 +- ...data_source_network_access_service_name.go | 3 +- ...rce_network_access_time_date_conditions.go | 3 +- ciscoise/data_source_network_device.go | 3 +- ...urce_network_device_bulk_monitor_status.go | 3 +- ciscoise/data_source_network_device_group.go | 3 +- ciscoise/data_source_node.go | 3 +- ciscoise/data_source_node_deployment.go | 3 +- ciscoise/data_source_node_group.go | 3 +- ciscoise/data_source_node_group_node.go | 3 +- .../data_source_node_services_interfaces.go | 3 +- ...rce_node_services_profiler_probe_config.go | 3 +- ...ata_source_node_services_sxp_interfaces.go | 3 +- ciscoise/data_source_pan_ha.go | 3 +- ciscoise/data_source_patch.go | 3 +- ciscoise/data_source_portal.go | 3 +- ciscoise/data_source_portal_global_setting.go | 3 +- ciscoise/data_source_portal_theme.go | 3 +- ciscoise/data_source_profiler_profile.go | 3 +- .../data_source_proxy_connection_settings.go | 3 +- ciscoise/data_source_px_grid_node.go | 3 +- ciscoise/data_source_pxgrid_bindings_info.go | 5 +- ...data_source_pxgrid_egress_matrices_info.go | 5 +- ...data_source_pxgrid_egress_policies_info.go | 5 +- ...data_source_pxgrid_endpoint_by_mac_info.go | 5 +- ...source_pxgrid_endpoints_by_os_type_info.go | 5 +- ...ta_source_pxgrid_endpoints_by_type_info.go | 5 +- ciscoise/data_source_pxgrid_endpoints_info.go | 5 +- ciscoise/data_source_pxgrid_failures.go | 5 +- ciscoise/data_source_pxgrid_healths_info.go | 5 +- .../data_source_pxgrid_performances_info.go | 5 +- ciscoise/data_source_pxgrid_profiles_info.go | 5 +- ..._source_pxgrid_security_group_acls_info.go | 5 +- ...data_source_pxgrid_security_groups_info.go | 5 +- .../data_source_pxgrid_session_by_ip_info.go | 5 +- .../data_source_pxgrid_session_by_mac_info.go | 5 +- ...source_pxgrid_session_for_recovery_info.go | 5 +- ciscoise/data_source_pxgrid_sessions_info.go | 5 +- ...urce_pxgrid_user_group_by_username_info.go | 5 +- .../data_source_pxgrid_user_groups_info.go | 5 +- .../data_source_radius_server_sequence.go | 3 +- ciscoise/data_source_repository.go | 3 +- ciscoise/data_source_repository_files.go | 3 +- ciscoise/data_source_resource_version.go | 3 +- ciscoise/data_source_rest_id_store.go | 3 +- .../data_source_self_registered_portal.go | 3 +- ciscoise/data_source_session_service_node.go | 3 +- ciscoise/data_source_sg_acl.go | 3 +- .../data_source_sg_acl_bulk_monitor_status.go | 3 +- ciscoise/data_source_sg_mapping.go | 3 +- ...a_source_sg_mapping_bulk_monitor_status.go | 3 +- ...ta_source_sg_mapping_deploy_status_info.go | 3 +- ciscoise/data_source_sg_mapping_group.go | 3 +- ...ce_sg_mapping_group_bulk_monitor_status.go | 3 +- ...rce_sg_mapping_group_deploy_status_info.go | 3 +- ciscoise/data_source_sg_to_vn_to_vlan.go | 3 +- ...ce_sg_to_vn_to_vlan_bulk_monitor_status.go | 3 +- ciscoise/data_source_sgt.go | 3 +- .../data_source_sgt_bulk_monitor_status.go | 3 +- ciscoise/data_source_sms_provider.go | 3 +- ciscoise/data_source_sponsor_group.go | 3 +- ciscoise/data_source_sponsor_group_member.go | 3 +- ciscoise/data_source_sponsor_portal.go | 3 +- .../data_source_sponsored_guest_portal.go | 3 +- .../data_source_support_bundle_download.go | 3 +- ciscoise/data_source_support_bundle_status.go | 3 +- ciscoise/data_source_sxp_connections.go | 3 +- ...rce_sxp_connections_bulk_monitor_status.go | 3 +- ciscoise/data_source_sxp_local_bindings.go | 3 +- ..._sxp_local_bindings_bulk_monitor_status.go | 3 +- ciscoise/data_source_sxp_vpns.go | 3 +- ...ata_source_sxp_vpns_bulk_monitor_status.go | 3 +- ciscoise/data_source_system_certificate.go | 3 +- ...a_source_system_certificate_export_info.go | 3 +- ciscoise/data_source_system_config_version.go | 3 +- ciscoise/data_source_tacacs_command_sets.go | 3 +- .../data_source_tacacs_external_servers.go | 3 +- ciscoise/data_source_tacacs_profile.go | 3 +- .../data_source_tacacs_server_sequence.go | 3 +- ciscoise/data_source_tasks.go | 3 +- ciscoise/data_source_telemetry_info.go | 3 +- .../data_source_transport_gateway_settings.go | 3 +- ciscoise/data_source_trusted_certificate.go | 3 +- .../data_source_trusted_certificate_export.go | 5 +- ciscoise/data_source_trustsec_nbar_app.go | 3 +- .../data_source_trustsec_sg_vn_mapping.go | 3 +- ciscoise/data_source_trustsec_vn.go | 3 +- .../data_source_trustsec_vn_vlan_mapping.go | 3 +- ciscoise/diffs.go | 11 + ciscoise/provider.go | 7 + ciscoise/resource_aci_settings.go | 41 +- ciscoise/resource_active_directory.go | 486 +++-- .../resource_active_directory_join_domain.go | 3 +- ...ve_directory_join_domain_with_all_nodes.go | 3 +- .../resource_active_directory_leave_domain.go | 3 +- ...e_directory_leave_domain_with_all_nodes.go | 3 +- ciscoise/resource_allowed_protocols.go | 824 +++++--- ciscoise/resource_anc_endpoint.go | 109 +- .../resource_anc_endpoint_bulk_request.go | 3 +- ciscoise/resource_anc_policy.go | 107 +- ciscoise/resource_anc_policy_bulk_request.go | 3 +- ciscoise/resource_authorization_profile.go | 426 +++-- ciscoise/resource_backup_restore.go | 3 +- ciscoise/resource_backup_schedule_config.go | 3 +- .../resource_backup_schedule_config_update.go | 3 +- ciscoise/resource_bind_signed_certificate.go | 3 +- ciscoise/resource_byod_portal.go | 649 ++++--- ciscoise/resource_certificate_profile.go | 163 +- ...istration_authentication_reset_hitcount.go | 3 +- ...ice_administration_authentication_rules.go | 444 +++-- ...nistration_authorization_reset_hitcount.go | 3 +- ...vice_administration_authorization_rules.go | 424 +++-- ...source_device_administration_conditions.go | 305 ++- ...e_administration_global_exception_rules.go | 411 ++-- ...n_global_exception_rules_reset_hitcount.go | 3 +- ...ce_administration_local_exception_rules.go | 434 +++-- ...on_local_exception_rules_reset_hitcount.go | 3 +- ...evice_administration_network_conditions.go | 193 +- ...source_device_administration_policy_set.go | 402 ++-- ...dministration_policy_set_reset_hitcount.go | 3 +- ...ice_administration_time_date_conditions.go | 343 ++-- ciscoise/resource_downloadable_acl.go | 326 +++- ciscoise/resource_egress_matrix_cell.go | 150 +- ...esource_egress_matrix_cell_bulk_request.go | 3 +- .../resource_egress_matrix_cell_clear_all.go | 5 +- ciscoise/resource_egress_matrix_cell_clone.go | 3 +- ...ource_egress_matrix_cell_set_all_status.go | 5 +- ciscoise/resource_endpoint.go | 266 ++- ciscoise/resource_endpoint_bulk_request.go | 3 +- ciscoise/resource_endpoint_certificate.go | 3 +- ciscoise/resource_endpoint_deregister.go | 5 +- ciscoise/resource_endpoint_group.go | 108 +- ciscoise/resource_endpoint_register.go | 3 +- ciscoise/resource_external_radius_server.go | 196 +- ciscoise/resource_filter_policy.go | 111 +- ...source_guest_smtp_notification_settings.go | 179 +- ciscoise/resource_guest_ssid.go | 102 +- ciscoise/resource_guest_type.go | 349 ++-- ciscoise/resource_guest_user.go | 277 ++- ciscoise/resource_guest_user_approve.go | 5 +- ciscoise/resource_guest_user_bulk_request.go | 3 +- ciscoise/resource_guest_user_deny.go | 5 +- ciscoise/resource_guest_user_reinstate.go | 5 +- .../resource_guest_user_reset_password.go | 3 +- ciscoise/resource_guest_user_suspend.go | 3 +- ciscoise/resource_hotpatch.go | 9 +- ciscoise/resource_hotspot_portal.go | 625 +++--- ciscoise/resource_id_store_sequence.go | 138 +- ciscoise/resource_identity_group.go | 103 +- ciscoise/resource_internal_user.go | 222 ++- ciscoise/resource_ise_root_ca_regenerate.go | 3 +- ciscoise/resource_licensing_registration.go | 53 +- ciscoise/resource_licensing_tier_state.go | 43 +- ciscoise/resource_mnt_session_delete_all.go | 5 +- ciscoise/resource_my_device_portal.go | 674 ++++--- .../resource_native_supplicant_profile.go | 122 +- ...rce_network_access_authentication_rules.go | 438 +++-- ...ess_authentication_rules_reset_hitcount.go | 3 +- ...urce_network_access_authorization_rules.go | 393 ++-- ...cess_authorization_rules_reset_hitcount.go | 3 +- .../resource_network_access_conditions.go | 292 ++- .../resource_network_access_dictionary.go | 92 +- ...rce_network_access_dictionary_attribute.go | 118 +- ...e_network_access_global_exception_rules.go | 407 ++-- ...s_global_exception_rules_reset_hitcount.go | 3 +- ...ce_network_access_local_exception_rules.go | 422 ++-- ...s_local_exception_rules_reset_hitcounts.go | 3 +- ...source_network_access_network_condition.go | 162 +- .../resource_network_access_policy_set.go | 260 ++- ...etwork_access_policy_set_reset_hitcount.go | 3 +- ...rce_network_access_time_date_conditions.go | 343 ++-- ciscoise/resource_network_device.go | 455 +++-- .../resource_network_device_bulk_request.go | 3 +- ciscoise/resource_network_device_group.go | 106 +- ciscoise/resource_node_deployment.go | 88 +- ciscoise/resource_node_deployment_sync.go | 3 +- ciscoise/resource_node_group.go | 85 +- ciscoise/resource_node_group_node.go | 21 +- .../resource_node_primary_to_standalone.go | 3 +- .../resource_node_secondary_to_primary.go | 3 +- ...rce_node_services_profiler_probe_config.go | 141 +- .../resource_node_services_sxp_interfaces.go | 22 +- .../resource_node_standalone_to_primary.go | 3 +- ciscoise/resource_pan_ha.go | 55 +- ciscoise/resource_patch.go | 37 +- ciscoise/resource_portal_global_setting.go | 69 +- ciscoise/resource_portal_theme.go | 114 +- .../resource_proxy_connection_settings.go | 67 +- ciscoise/resource_px_grid_node.go | 52 +- .../resource_px_grid_settings_auto_approve.go | 3 +- ciscoise/resource_pxgrid_access_secret.go | 3 +- ciscoise/resource_pxgrid_account_activate.go | 3 +- ciscoise/resource_pxgrid_account_create.go | 3 +- ciscoise/resource_pxgrid_authorization.go | 5 +- ciscoise/resource_pxgrid_service_lookup.go | 3 +- ciscoise/resource_pxgrid_service_register.go | 3 +- .../resource_pxgrid_service_reregister.go | 5 +- .../resource_pxgrid_service_unregister.go | 5 +- ciscoise/resource_radius_server_sequence.go | 280 ++- ciscoise/resource_renew_certificate.go | 3 +- ciscoise/resource_repository.go | 41 +- ciscoise/resource_rest_id_store.go | 155 +- ciscoise/resource_self_registered_portal.go | 1696 ++++++++++------- ...esource_selfsigned_certificate_generate.go | 3 +- ciscoise/resource_sg_acl.go | 149 +- ciscoise/resource_sg_acl_bulk_request.go | 3 +- ciscoise/resource_sg_mapping.go | 147 +- ciscoise/resource_sg_mapping_bulk_request.go | 3 +- ciscoise/resource_sg_mapping_deploy.go | 5 +- ciscoise/resource_sg_mapping_deploy_all.go | 5 +- ciscoise/resource_sg_mapping_group.go | 87 +- .../resource_sg_mapping_group_bulk_request.go | 3 +- ciscoise/resource_sg_mapping_group_deploy.go | 5 +- .../resource_sg_mapping_group_deploy_all.go | 5 +- ciscoise/resource_sg_to_vn_to_vlan.go | 190 +- .../resource_sg_to_vn_to_vlan_bulk_request.go | 3 +- ciscoise/resource_sgt.go | 137 +- ciscoise/resource_sgt_bulk_request.go | 3 +- ciscoise/resource_sponsor_group.go | 320 ++-- ciscoise/resource_sponsor_portal.go | 680 ++++--- ciscoise/resource_sponsored_guest_portal.go | 948 +++++---- ciscoise/resource_sxp_connections.go | 142 +- .../resource_sxp_connections_bulk_request.go | 3 +- ciscoise/resource_sxp_local_bindings.go | 133 +- ...esource_sxp_local_bindings_bulk_request.go | 3 +- ciscoise/resource_sxp_vpns.go | 99 +- ciscoise/resource_sxp_vpns_bulk_request.go | 3 +- ciscoise/resource_system_certificate.go | 267 ++- .../resource_system_certificate_import.go | 3 +- ciscoise/resource_tacacs_command_sets.go | 153 +- ciscoise/resource_tacacs_external_servers.go | 142 +- ciscoise/resource_tacacs_profile.go | 135 +- ciscoise/resource_tacacs_server_sequence.go | 160 +- .../resource_threat_vulnerabilities_clear.go | 3 +- .../resource_transport_gateway_settings.go | 22 +- ciscoise/resource_trusted_certificate.go | 268 ++- .../resource_trusted_certificate_import.go | 3 +- ciscoise/resource_trustsec_nbar_app.go | 101 +- ciscoise/resource_trustsec_sg_vn_mapping.go | 118 +- ...urce_trustsec_sg_vn_mapping_bulk_create.go | 3 +- ...urce_trustsec_sg_vn_mapping_bulk_delete.go | 4 +- ...urce_trustsec_sg_vn_mapping_bulk_update.go | 3 +- ciscoise/resource_trustsec_vn.go | 68 +- ciscoise/resource_trustsec_vn_bulk_create.go | 3 +- ciscoise/resource_trustsec_vn_bulk_delete.go | 3 +- ciscoise/resource_trustsec_vn_bulk_update.go | 3 +- ciscoise/resource_trustsec_vn_vlan_mapping.go | 132 +- ...ce_trustsec_vn_vlan_mapping_bulk_create.go | 3 +- ...ce_trustsec_vn_vlan_mapping_bulk_delete.go | 3 +- ...ce_trustsec_vn_vlan_mapping_bulk_update.go | 3 +- ciscoise/utils.go | 15 + docs/index.md | 5 + examples/provider/provider.tf | 4 + .../ciscoise_aci_bindings/main.tf | 2 +- .../ciscoise_aci_test_connectivity/main.tf | 2 +- .../data-sources/ciscoise_admin_user/main.tf | 2 +- .../ciscoise_allowed_protocols/main.tf | 2 +- .../data-sources/ciscoise_anc_policy/main.tf | 2 +- .../ciscoise_authorization_profile/main.tf | 2 +- .../ciscoise_certificate_template/main.tf | 2 +- .../samples/data-sources/ciscoise_csr/main.tf | 2 +- .../data-sources/ciscoise_csr_export/main.tf | 2 +- .../data-sources/ciscoise_deployment/main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../ciscoise_guest_location/main.tf | 2 +- .../data-sources/ciscoise_guest_type/main.tf | 2 +- .../ciscoise_hotspot_portal/main.tf | 2 +- .../ciscoise_id_store_sequence/main.tf | 2 +- .../ciscoise_identity_group/main.tf | 2 +- .../samples/data-sources/ciscoise_mnt/main.tf | 2 +- .../ciscoise_mnt_account_status/main.tf | 2 +- .../ciscoise_mnt_athentication_status/main.tf | 2 +- .../ciscoise_mnt_session_active_count/main.tf | 2 +- .../ciscoise_mnt_session_active_list/main.tf | 2 +- .../ciscoise_mnt_session_auth_list/main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../data-sources/ciscoise_mnt_version/main.tf | 2 +- .../ciscoise_my_device_portal/main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../ciscoise_network_access_profiles/main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../ciscoise_network_device/main.tf | 2 +- .../ciscoise_network_device_group/main.tf | 2 +- .../data-sources/ciscoise_node/main.tf | 2 +- .../data-sources/ciscoise_portal/main.tf | 2 +- .../ciscoise_portal_theme/main.tf | 2 +- .../ciscoise_profiler_profile/main.tf | 2 +- .../ciscoise_radius_server_sequence/main.tf | 2 +- .../ciscoise_self_registered_portal/main.tf | 2 +- .../data-sources/ciscoise_sg_acl/main.tf | 2 +- .../samples/data-sources/ciscoise_sgt/main.tf | 2 +- .../ciscoise_sms_provider/main.tf | 2 +- .../ciscoise_sponsor_group/main.tf | 2 +- .../ciscoise_sponsor_group_member/main.tf | 2 +- .../ciscoise_sponsor_portal/main.tf | 2 +- .../ciscoise_sponsored_guest_portal/main.tf | 2 +- .../ciscoise_sxp_connections/main.tf | 2 +- .../ciscoise_sxp_local_bindings/main.tf | 2 +- .../data-sources/ciscoise_sxp_vpns/main.tf | 2 +- .../ciscoise_system_config_version/main.tf | 2 +- .../ciscoise_tacacs_command_sets/main.tf | 2 +- .../ciscoise_tacacs_profile/main.tf | 2 +- .../data-sources/ciscoise_tasks/main.tf | 2 +- .../ciscoise_telemetry_info/main.tf | 2 +- .../main.tf | 2 +- .../mixed/ciscoise_aci_settings/main.tf | 2 +- .../mixed/ciscoise_active_directory/main.tf | 2 +- .../mixed/ciscoise_downloadable_acl/main.tf | 2 +- .../samples/mixed/ciscoise_endpoint/main.tf | 2 +- .../samples/mixed/ciscoise_guest_ssid/main.tf | 2 +- .../mixed/ciscoise_internal_user/main.tf | 2 +- .../ciscoise_mnt_failure_reasons/main.tf | 2 +- .../main.tf | 2 +- .../samples/mixed/ciscoise_repository/main.tf | 2 +- .../samples/mixed/ciscoise_sg_mapping/main.tf | 2 +- .../mixed/ciscoise_sg_mapping_group/main.tf | 2 +- .../ciscoise_tacacs_external_servers/main.tf | 2 +- .../ciscoise_tacacs_server_sequence/main.tf | 2 +- .../ciscoise_trusted_certificate/main.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../ciscoise_allowed_protocols/main.tf | 2 +- .../resources/ciscoise_anc_endpoint/main.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../ciscoise_authorization_profile/main.tf | 2 +- .../resources/ciscoise_backup_restore/main.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../main.tf | 2 +- .../resource.tf | 2 +- .../main.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../main.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../main.tf | 2 +- .../ciscoise_egress_matrix_cell/main.tf | 2 +- .../resource.tf | 2 +- .../resources/ciscoise_endpoint_group/main.tf | 2 +- .../resources/ciscoise_filter_policy/main.tf | 2 +- .../main.tf | 2 +- .../resources/ciscoise_guest_user/main.tf | 2 +- .../resources/ciscoise_identity_group/main.tf | 2 +- .../resource.tf | 2 +- .../ciscoise_my_device_portal/main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../main.tf | 2 +- .../ciscoise_node_deployment_sync/resource.tf | 2 +- .../ciscoise_node_group_node/resource.tf | 2 +- .../main.tf | 2 +- .../ciscoise_portal_global_setting/main.tf | 2 +- .../resource.tf | 2 +- .../ciscoise_pxgrid_access_secret/resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../ciscoise_radius_server_sequence/main.tf | 2 +- .../ciscoise_renew_certificate/resource.tf | 2 +- .../ciscoise_resource_version/main.tf | 2 +- .../resource.tf | 2 +- .../samples/resources/ciscoise_sgt/main.tf | 2 +- .../resources/ciscoise_sgt_2/resource.tf | 25 + .../ciscoise_tacacs_command_sets/resource.tf | 6 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- .../resource.tf | 2 +- 510 files changed, 13972 insertions(+), 8144 deletions(-) create mode 100644 examples/samples/resources/ciscoise_sgt_2/resource.tf diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0aa20f..91c506a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 0.6.6-beta (Sep 21, 2022) + +FEATURES: +* New provider configuration variable added: + - **enable_auto_import** (String) Flag to enable or disable terraform automatic import (Automatic import means that when Terraform attempts to create the resource, it will perform a get operation if it founds a matching resource, it will perform an import of the resource it found, this is a similar operation to the terraform import command.) in resources, this is a configuration added to the provider, it uses the ISE_ENABLE_AUTO_IMPORT environment variable; `true` to enable it, defaults to `false`. + +BUG FIXES: +* The provider overwrites the configuration to the one in the `tf file` even if it is updated outside of the provider. +* On `resource_sgt` `value` parameter adds new validation, it only allows numbers greatest or equal than `2` and lower or equal than `65519`. + ## 0.6.5-beta (Jun 07, 2022) FEATURES: diff --git a/Makefile b/Makefile index 12f7721e..1efcc52d 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ HOSTNAME=hashicorp.com NAMESPACE=edu NAME=ciscoise BINARY=terraform-provider-${NAME} -VERSION=0.6.5-beta +VERSION=0.6.6-beta OS_ARCH=darwin_amd64 GOFMT_FILES?=$$(find . -name '*.go' |grep -v vendor) default: install diff --git a/README.md b/README.md index 3c860659..0a219976 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ terraform { required_providers { ciscoise = { source = "CiscoISE/ciscoise" - version = "0.6.5-beta" + version = "0.6.6-beta" } } } @@ -67,7 +67,7 @@ terraform { required_providers { ciscoise = { source = "hashicorp.com/edu/ciscoise" - version = "0.6.5-beta" + version = "0.6.6-beta" } } } diff --git a/ciscoise/config.go b/ciscoise/config.go index 01554241..02f14c80 100644 --- a/ciscoise/config.go +++ b/ciscoise/config.go @@ -2,6 +2,7 @@ package ciscoise import ( "context" + "strconv" "time" isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" @@ -23,6 +24,11 @@ type Config struct { RequestTimeout int } +type ClientConfig struct { + Client *isegosdk.Client + EnableAutoImport bool +} + // NewClient returns a new Cisco Identity Services Engine client. func (c *Config) NewClient() (*isegosdk.Client, error) { client, err := isegosdk.NewClientWithOptions(c.BaseURL, @@ -63,5 +69,15 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{} }) return nil, diags } - return client, diags + boolValue, err := strconv.ParseBool(d.Get("enable_auto_import").(string)) + + if err != nil { + boolValue = false + } + + clientConfig := ClientConfig{ + Client: client, + EnableAutoImport: boolValue, + } + return clientConfig, diags } diff --git a/ciscoise/data_source_aci_bindings.go b/ciscoise/data_source_aci_bindings.go index 23b7bfc9..44445713 100644 --- a/ciscoise/data_source_aci_bindings.go +++ b/ciscoise/data_source_aci_bindings.go @@ -116,7 +116,8 @@ Filtering will be based on one attribute only, such as ip/sgt/vn/psn/learnedFrom } func dataSourceAciBindingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_aci_settings.go b/ciscoise/data_source_aci_settings.go index 1b0768d9..c81d74d8 100644 --- a/ciscoise/data_source_aci_settings.go +++ b/ciscoise/data_source_aci_settings.go @@ -140,7 +140,8 @@ func dataSourceAciSettings() *schema.Resource { } func dataSourceAciSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_aci_test_connectivity.go b/ciscoise/data_source_aci_test_connectivity.go index 758244b5..99a4309a 100644 --- a/ciscoise/data_source_aci_test_connectivity.go +++ b/ciscoise/data_source_aci_test_connectivity.go @@ -39,7 +39,8 @@ func dataSourceAciTestConnectivity() *schema.Resource { } func dataSourceAciTestConnectivityRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_active_directory.go b/ciscoise/data_source_active_directory.go index 685bdbeb..3085a901 100644 --- a/ciscoise/data_source_active_directory.go +++ b/ciscoise/data_source_active_directory.go @@ -689,7 +689,8 @@ default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUST } func dataSourceActiveDirectoryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_active_directory_get_groups_by_domain_info.go b/ciscoise/data_source_active_directory_get_groups_by_domain_info.go index d34a2139..df7988b8 100644 --- a/ciscoise/data_source_active_directory_get_groups_by_domain_info.go +++ b/ciscoise/data_source_active_directory_get_groups_by_domain_info.go @@ -81,7 +81,8 @@ func dataSourceActiveDirectoryGetGroupsByDomainInfo() *schema.Resource { } func dataSourceActiveDirectoryGetGroupsByDomainInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("id") diff --git a/ciscoise/data_source_active_directory_get_trusted_domains_info.go b/ciscoise/data_source_active_directory_get_trusted_domains_info.go index 62bd284e..25757031 100644 --- a/ciscoise/data_source_active_directory_get_trusted_domains_info.go +++ b/ciscoise/data_source_active_directory_get_trusted_domains_info.go @@ -62,7 +62,8 @@ relationships. } func dataSourceActiveDirectoryGetTrustedDomainsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("id") diff --git a/ciscoise/data_source_active_directory_get_user_groups_info.go b/ciscoise/data_source_active_directory_get_user_groups_info.go index fa6ebd99..52c5e663 100644 --- a/ciscoise/data_source_active_directory_get_user_groups_info.go +++ b/ciscoise/data_source_active_directory_get_user_groups_info.go @@ -81,7 +81,8 @@ func dataSourceActiveDirectoryGetUserGroupsInfo() *schema.Resource { } func dataSourceActiveDirectoryGetUserGroupsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("id") diff --git a/ciscoise/data_source_active_directory_is_user_member_of_group.go b/ciscoise/data_source_active_directory_is_user_member_of_group.go index 687eb3bf..70482be9 100644 --- a/ciscoise/data_source_active_directory_is_user_member_of_group.go +++ b/ciscoise/data_source_active_directory_is_user_member_of_group.go @@ -81,7 +81,8 @@ func dataSourceActiveDirectoryIsUserMemberOfGroup() *schema.Resource { } func dataSourceActiveDirectoryIsUserMemberOfGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("id") diff --git a/ciscoise/data_source_admin_user.go b/ciscoise/data_source_admin_user.go index ef75f436..b28441ed 100644 --- a/ciscoise/data_source_admin_user.go +++ b/ciscoise/data_source_admin_user.go @@ -226,7 +226,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceAdminUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_allowed_protocols.go b/ciscoise/data_source_allowed_protocols.go index b90c9584..80ac904d 100644 --- a/ciscoise/data_source_allowed_protocols.go +++ b/ciscoise/data_source_allowed_protocols.go @@ -1029,7 +1029,8 @@ Valid range is 0-3`, } func dataSourceAllowedProtocolsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_anc_endpoint.go b/ciscoise/data_source_anc_endpoint.go index c7f0ab24..0ad839c9 100644 --- a/ciscoise/data_source_anc_endpoint.go +++ b/ciscoise/data_source_anc_endpoint.go @@ -180,7 +180,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceAncEndpointRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_anc_endpoint_bulk_monitor_status.go b/ciscoise/data_source_anc_endpoint_bulk_monitor_status.go index 63801fd8..aa9ba222 100644 --- a/ciscoise/data_source_anc_endpoint_bulk_monitor_status.go +++ b/ciscoise/data_source_anc_endpoint_bulk_monitor_status.go @@ -96,7 +96,8 @@ func dataSourceAncEndpointBulkMonitorStatus() *schema.Resource { } func dataSourceAncEndpointBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_anc_policy.go b/ciscoise/data_source_anc_policy.go index f15fe33a..b45cd31f 100644 --- a/ciscoise/data_source_anc_policy.go +++ b/ciscoise/data_source_anc_policy.go @@ -247,7 +247,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceAncPolicyRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_anc_policy_bulk_monitor_status.go b/ciscoise/data_source_anc_policy_bulk_monitor_status.go index 375ce0ce..6db6a28a 100644 --- a/ciscoise/data_source_anc_policy_bulk_monitor_status.go +++ b/ciscoise/data_source_anc_policy_bulk_monitor_status.go @@ -96,7 +96,8 @@ func dataSourceAncPolicyBulkMonitorStatus() *schema.Resource { } func dataSourceAncPolicyBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_authorization_profile.go b/ciscoise/data_source_authorization_profile.go index 3dc07dd9..9f1cdad9 100644 --- a/ciscoise/data_source_authorization_profile.go +++ b/ciscoise/data_source_authorization_profile.go @@ -641,7 +641,8 @@ For all other 'WebRedirectionType' values the field must be ignored`, } func dataSourceAuthorizationProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_backup_last_status.go b/ciscoise/data_source_backup_last_status.go index 2e5e9b62..84733537 100644 --- a/ciscoise/data_source_backup_last_status.go +++ b/ciscoise/data_source_backup_last_status.go @@ -100,7 +100,8 @@ func dataSourceBackupLastStatus() *schema.Resource { } func dataSourceBackupLastStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_byod_portal.go b/ciscoise/data_source_byod_portal.go index db795dc3..3ce4259f 100644 --- a/ciscoise/data_source_byod_portal.go +++ b/ciscoise/data_source_byod_portal.go @@ -601,7 +601,8 @@ Allowed values: } func dataSourceByodPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_certificate_profile.go b/ciscoise/data_source_certificate_profile.go index 69d656d0..a4aeb3c9 100644 --- a/ciscoise/data_source_certificate_profile.go +++ b/ciscoise/data_source_certificate_profile.go @@ -215,7 +215,8 @@ func dataSourceCertificateProfile() *schema.Resource { } func dataSourceCertificateProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_certificate_template.go b/ciscoise/data_source_certificate_template.go index 7981d8e8..596c1661 100644 --- a/ciscoise/data_source_certificate_template.go +++ b/ciscoise/data_source_certificate_template.go @@ -163,7 +163,8 @@ func dataSourceCertificateTemplate() *schema.Resource { } func dataSourceCertificateTemplateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_csr.go b/ciscoise/data_source_csr.go index 99bbadb8..13e032e6 100644 --- a/ciscoise/data_source_csr.go +++ b/ciscoise/data_source_csr.go @@ -323,7 +323,8 @@ Not Contains } func dataSourceCsrRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_csr_export.go b/ciscoise/data_source_csr_export.go index f30279b6..e0e63ed2 100644 --- a/ciscoise/data_source_csr_export.go +++ b/ciscoise/data_source_csr_export.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -40,7 +38,8 @@ func dataSourceCsrExport() *schema.Resource { } func dataSourceCsrExportRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vHostname := d.Get("hostname") diff --git a/ciscoise/data_source_deployment.go b/ciscoise/data_source_deployment.go index 18aa1b37..2574d5ab 100644 --- a/ciscoise/data_source_deployment.go +++ b/ciscoise/data_source_deployment.go @@ -447,7 +447,8 @@ func dataSourceDeployment() *schema.Resource { } func dataSourceDeploymentRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_authentication_rules.go b/ciscoise/data_source_device_administration_authentication_rules.go index fd07c0b9..789d2c49 100644 --- a/ciscoise/data_source_device_administration_authentication_rules.go +++ b/ciscoise/data_source_device_administration_authentication_rules.go @@ -633,7 +633,8 @@ func dataSourceDeviceAdministrationAuthenticationRules() *schema.Resource { } func dataSourceDeviceAdministrationAuthenticationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_device_administration_authorization_rules.go b/ciscoise/data_source_device_administration_authorization_rules.go index ea0428a6..757ae104 100644 --- a/ciscoise/data_source_device_administration_authorization_rules.go +++ b/ciscoise/data_source_device_administration_authorization_rules.go @@ -619,7 +619,8 @@ func dataSourceDeviceAdministrationAuthorizationRules() *schema.Resource { } func dataSourceDeviceAdministrationAuthorizationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_device_administration_command_set.go b/ciscoise/data_source_device_administration_command_set.go index af33a1fc..260ee226 100644 --- a/ciscoise/data_source_device_administration_command_set.go +++ b/ciscoise/data_source_device_administration_command_set.go @@ -44,7 +44,8 @@ func dataSourceDeviceAdministrationCommandSet() *schema.Resource { } func dataSourceDeviceAdministrationCommandSetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_conditions.go b/ciscoise/data_source_device_administration_conditions.go index 046b2930..97e14b7a 100644 --- a/ciscoise/data_source_device_administration_conditions.go +++ b/ciscoise/data_source_device_administration_conditions.go @@ -663,7 +663,8 @@ func dataSourceDeviceAdministrationConditions() *schema.Resource { } func dataSourceDeviceAdministrationConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vName, okName := d.GetOk("name") diff --git a/ciscoise/data_source_device_administration_conditions_for_authentication_rule.go b/ciscoise/data_source_device_administration_conditions_for_authentication_rule.go index f4570dfd..5cb1c1c3 100644 --- a/ciscoise/data_source_device_administration_conditions_for_authentication_rule.go +++ b/ciscoise/data_source_device_administration_conditions_for_authentication_rule.go @@ -233,7 +233,8 @@ func dataSourceDeviceAdministrationConditionsForAuthenticationRule() *schema.Res } func dataSourceDeviceAdministrationConditionsForAuthenticationRuleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_conditions_for_authorization_rule.go b/ciscoise/data_source_device_administration_conditions_for_authorization_rule.go index a8d373c4..9ca18c0b 100644 --- a/ciscoise/data_source_device_administration_conditions_for_authorization_rule.go +++ b/ciscoise/data_source_device_administration_conditions_for_authorization_rule.go @@ -233,7 +233,8 @@ func dataSourceDeviceAdministrationConditionsForAuthorizationRule() *schema.Reso } func dataSourceDeviceAdministrationConditionsForAuthorizationRuleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_conditions_for_policy_set.go b/ciscoise/data_source_device_administration_conditions_for_policy_set.go index 7d5f3288..1572c7cb 100644 --- a/ciscoise/data_source_device_administration_conditions_for_policy_set.go +++ b/ciscoise/data_source_device_administration_conditions_for_policy_set.go @@ -233,7 +233,8 @@ func dataSourceDeviceAdministrationConditionsForPolicySet() *schema.Resource { } func dataSourceDeviceAdministrationConditionsForPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_dictionary_attributes_authentication.go b/ciscoise/data_source_device_administration_dictionary_attributes_authentication.go index 1b6b9948..4f101101 100644 --- a/ciscoise/data_source_device_administration_dictionary_attributes_authentication.go +++ b/ciscoise/data_source_device_administration_dictionary_attributes_authentication.go @@ -92,7 +92,8 @@ func dataSourceDeviceAdministrationDictionaryAttributesAuthentication() *schema. } func dataSourceDeviceAdministrationDictionaryAttributesAuthenticationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_dictionary_attributes_authorization.go b/ciscoise/data_source_device_administration_dictionary_attributes_authorization.go index c298eb03..95546f1c 100644 --- a/ciscoise/data_source_device_administration_dictionary_attributes_authorization.go +++ b/ciscoise/data_source_device_administration_dictionary_attributes_authorization.go @@ -92,7 +92,8 @@ func dataSourceDeviceAdministrationDictionaryAttributesAuthorization() *schema.R } func dataSourceDeviceAdministrationDictionaryAttributesAuthorizationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_dictionary_attributes_policy_set.go b/ciscoise/data_source_device_administration_dictionary_attributes_policy_set.go index eae98788..0ade7110 100644 --- a/ciscoise/data_source_device_administration_dictionary_attributes_policy_set.go +++ b/ciscoise/data_source_device_administration_dictionary_attributes_policy_set.go @@ -92,7 +92,8 @@ func dataSourceDeviceAdministrationDictionaryAttributesPolicySet() *schema.Resou } func dataSourceDeviceAdministrationDictionaryAttributesPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_global_exception_rules.go b/ciscoise/data_source_device_administration_global_exception_rules.go index 517cac85..0980c250 100644 --- a/ciscoise/data_source_device_administration_global_exception_rules.go +++ b/ciscoise/data_source_device_administration_global_exception_rules.go @@ -614,7 +614,8 @@ func dataSourceDeviceAdministrationGlobalExceptionRules() *schema.Resource { } func dataSourceDeviceAdministrationGlobalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_device_administration_identity_stores.go b/ciscoise/data_source_device_administration_identity_stores.go index a163d3c7..ae33cc5a 100644 --- a/ciscoise/data_source_device_administration_identity_stores.go +++ b/ciscoise/data_source_device_administration_identity_stores.go @@ -43,7 +43,8 @@ func dataSourceDeviceAdministrationIDentityStores() *schema.Resource { } func dataSourceDeviceAdministrationIDentityStoresRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_local_exception_rules.go b/ciscoise/data_source_device_administration_local_exception_rules.go index 8f553142..35c2b2ac 100644 --- a/ciscoise/data_source_device_administration_local_exception_rules.go +++ b/ciscoise/data_source_device_administration_local_exception_rules.go @@ -619,7 +619,8 @@ func dataSourceDeviceAdministrationLocalExceptionRules() *schema.Resource { } func dataSourceDeviceAdministrationLocalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_device_administration_network_conditions.go b/ciscoise/data_source_device_administration_network_conditions.go index 5e2789c7..2a5191f5 100644 --- a/ciscoise/data_source_device_administration_network_conditions.go +++ b/ciscoise/data_source_device_administration_network_conditions.go @@ -304,7 +304,8 @@ func dataSourceDeviceAdministrationNetworkConditions() *schema.Resource { } func dataSourceDeviceAdministrationNetworkConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_device_administration_policy_set.go b/ciscoise/data_source_device_administration_policy_set.go index 07f602e1..4dc9bc6b 100644 --- a/ciscoise/data_source_device_administration_policy_set.go +++ b/ciscoise/data_source_device_administration_policy_set.go @@ -598,7 +598,8 @@ func dataSourceDeviceAdministrationPolicySet() *schema.Resource { } func dataSourceDeviceAdministrationPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_device_administration_profiles.go b/ciscoise/data_source_device_administration_profiles.go index 6a83593f..8eea2d81 100644 --- a/ciscoise/data_source_device_administration_profiles.go +++ b/ciscoise/data_source_device_administration_profiles.go @@ -43,7 +43,8 @@ func dataSourceDeviceAdministrationProfiles() *schema.Resource { } func dataSourceDeviceAdministrationProfilesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_service_names.go b/ciscoise/data_source_device_administration_service_names.go index 2eea281b..1c69d41d 100644 --- a/ciscoise/data_source_device_administration_service_names.go +++ b/ciscoise/data_source_device_administration_service_names.go @@ -53,7 +53,8 @@ func dataSourceDeviceAdministrationServiceNames() *schema.Resource { } func dataSourceDeviceAdministrationServiceNamesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_device_administration_time_date_conditions.go b/ciscoise/data_source_device_administration_time_date_conditions.go index 4d8a7bb9..d82c75ce 100644 --- a/ciscoise/data_source_device_administration_time_date_conditions.go +++ b/ciscoise/data_source_device_administration_time_date_conditions.go @@ -448,7 +448,8 @@ func dataSourceDeviceAdministrationTimeDateConditions() *schema.Resource { } func dataSourceDeviceAdministrationTimeDateConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_downloadable_acl.go b/ciscoise/data_source_downloadable_acl.go index 822b9985..aaa8124e 100644 --- a/ciscoise/data_source_downloadable_acl.go +++ b/ciscoise/data_source_downloadable_acl.go @@ -141,7 +141,8 @@ func dataSourceDownloadableACL() *schema.Resource { } func dataSourceDownloadableACLRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_egress_matrix_cell.go b/ciscoise/data_source_egress_matrix_cell.go index bb3a958c..30c26ed9 100644 --- a/ciscoise/data_source_egress_matrix_cell.go +++ b/ciscoise/data_source_egress_matrix_cell.go @@ -221,7 +221,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceEgressMatrixCellRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_egress_matrix_cell_bulk_monitor_status.go b/ciscoise/data_source_egress_matrix_cell_bulk_monitor_status.go index c8148ca1..14931875 100644 --- a/ciscoise/data_source_egress_matrix_cell_bulk_monitor_status.go +++ b/ciscoise/data_source_egress_matrix_cell_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceEgressMatrixCellBulkMonitorStatus() *schema.Resource { } func dataSourceEgressMatrixCellBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_endpoint.go b/ciscoise/data_source_endpoint.go index f5c84f82..3d55bf4e 100644 --- a/ciscoise/data_source_endpoint.go +++ b/ciscoise/data_source_endpoint.go @@ -472,7 +472,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceEndpointRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_endpoint_bulk_monitor_status.go b/ciscoise/data_source_endpoint_bulk_monitor_status.go index 22fac853..d5b6faa3 100644 --- a/ciscoise/data_source_endpoint_bulk_monitor_status.go +++ b/ciscoise/data_source_endpoint_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceEndpointBulkMonitorStatus() *schema.Resource { } func dataSourceEndpointBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_endpoint_get_rejected_endpoints.go b/ciscoise/data_source_endpoint_get_rejected_endpoints.go index a478f705..14e3c6f3 100644 --- a/ciscoise/data_source_endpoint_get_rejected_endpoints.go +++ b/ciscoise/data_source_endpoint_get_rejected_endpoints.go @@ -51,7 +51,8 @@ func dataSourceEndpointGetRejectedEndpoints() *schema.Resource { } func dataSourceEndpointGetRejectedEndpointsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_endpoint_group.go b/ciscoise/data_source_endpoint_group.go index dfa0c82d..b86450d7 100644 --- a/ciscoise/data_source_endpoint_group.go +++ b/ciscoise/data_source_endpoint_group.go @@ -247,7 +247,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_external_radius_server.go b/ciscoise/data_source_external_radius_server.go index 390f5eb7..b536c8be 100644 --- a/ciscoise/data_source_external_radius_server.go +++ b/ciscoise/data_source_external_radius_server.go @@ -299,7 +299,8 @@ Allowed Values: } func dataSourceExternalRadiusServerRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_filter_policy.go b/ciscoise/data_source_filter_policy.go index f768f270..9e1451bc 100644 --- a/ciscoise/data_source_filter_policy.go +++ b/ciscoise/data_source_filter_policy.go @@ -115,7 +115,8 @@ At least one of subnet or sgt or vn should be defined`, } func dataSourceFilterPolicyRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_location.go b/ciscoise/data_source_guest_location.go index 02aa94d0..895d666b 100644 --- a/ciscoise/data_source_guest_location.go +++ b/ciscoise/data_source_guest_location.go @@ -186,7 +186,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceGuestLocationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_smtp_notification_settings.go b/ciscoise/data_source_guest_smtp_notification_settings.go index 5af74557..26cb6279 100644 --- a/ciscoise/data_source_guest_smtp_notification_settings.go +++ b/ciscoise/data_source_guest_smtp_notification_settings.go @@ -225,7 +225,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceGuestSmtpNotificationSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_ssid.go b/ciscoise/data_source_guest_ssid.go index 5c1809fa..5fd951ab 100644 --- a/ciscoise/data_source_guest_ssid.go +++ b/ciscoise/data_source_guest_ssid.go @@ -183,7 +183,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceGuestSSIDRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_type.go b/ciscoise/data_source_guest_type.go index f1a0232a..f78bceae 100644 --- a/ciscoise/data_source_guest_type.go +++ b/ciscoise/data_source_guest_type.go @@ -359,7 +359,8 @@ Allowed values are: } func dataSourceGuestTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_user.go b/ciscoise/data_source_guest_user.go index 669d870b..37ae5e0a 100644 --- a/ciscoise/data_source_guest_user.go +++ b/ciscoise/data_source_guest_user.go @@ -490,7 +490,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceGuestUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_guest_user_bulk_monitor_status.go b/ciscoise/data_source_guest_user_bulk_monitor_status.go index cc41cd77..80e45cf1 100644 --- a/ciscoise/data_source_guest_user_bulk_monitor_status.go +++ b/ciscoise/data_source_guest_user_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceGuestUserBulkMonitorStatus() *schema.Resource { } func dataSourceGuestUserBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_hotpatch.go b/ciscoise/data_source_hotpatch.go index 21499dae..c18c81e2 100644 --- a/ciscoise/data_source_hotpatch.go +++ b/ciscoise/data_source_hotpatch.go @@ -42,7 +42,8 @@ func dataSourceHotpatch() *schema.Resource { } func dataSourceHotpatchRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_hotspot_portal.go b/ciscoise/data_source_hotspot_portal.go index 9f7a258d..56a4f664 100644 --- a/ciscoise/data_source_hotspot_portal.go +++ b/ciscoise/data_source_hotspot_portal.go @@ -595,7 +595,8 @@ Allowed values: } func dataSourceHotspotPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_id_store_sequence.go b/ciscoise/data_source_id_store_sequence.go index 658e93d2..584c774a 100644 --- a/ciscoise/data_source_id_store_sequence.go +++ b/ciscoise/data_source_id_store_sequence.go @@ -233,7 +233,8 @@ func dataSourceIDStoreSequence() *schema.Resource { } func dataSourceIDStoreSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_identity_group.go b/ciscoise/data_source_identity_group.go index 2f6febc8..086fd27a 100644 --- a/ciscoise/data_source_identity_group.go +++ b/ciscoise/data_source_identity_group.go @@ -247,7 +247,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceIDentityGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_internal_user.go b/ciscoise/data_source_internal_user.go index 1cf9a99a..39398cce 100644 --- a/ciscoise/data_source_internal_user.go +++ b/ciscoise/data_source_internal_user.go @@ -355,7 +355,8 @@ The values are case sensitive. For example, '[ERSObjectURL]?filter=enabled.EQ.En } func dataSourceInternalUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_licensing_connection_type.go b/ciscoise/data_source_licensing_connection_type.go index e58c507f..61e0aa25 100644 --- a/ciscoise/data_source_licensing_connection_type.go +++ b/ciscoise/data_source_licensing_connection_type.go @@ -42,7 +42,8 @@ func dataSourceLicensingConnectionType() *schema.Resource { } func dataSourceLicensingConnectionTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_licensing_eval_license.go b/ciscoise/data_source_licensing_eval_license.go index cf30ff93..6eaf33ed 100644 --- a/ciscoise/data_source_licensing_eval_license.go +++ b/ciscoise/data_source_licensing_eval_license.go @@ -39,7 +39,8 @@ func dataSourceLicensingEvalLicense() *schema.Resource { } func dataSourceLicensingEvalLicenseRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_licensing_feature_to_tier_mapping.go b/ciscoise/data_source_licensing_feature_to_tier_mapping.go index 9e1713df..c000ce63 100644 --- a/ciscoise/data_source_licensing_feature_to_tier_mapping.go +++ b/ciscoise/data_source_licensing_feature_to_tier_mapping.go @@ -46,7 +46,8 @@ func dataSourceLicensingFeatureToTierMapping() *schema.Resource { } func dataSourceLicensingFeatureToTierMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_licensing_registration.go b/ciscoise/data_source_licensing_registration.go index adace43c..85b37bef 100644 --- a/ciscoise/data_source_licensing_registration.go +++ b/ciscoise/data_source_licensing_registration.go @@ -54,7 +54,8 @@ func dataSourceLicensingRegistration() *schema.Resource { } func dataSourceLicensingRegistrationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_licensing_smart_state.go b/ciscoise/data_source_licensing_smart_state.go index 30ad7221..35543882 100644 --- a/ciscoise/data_source_licensing_smart_state.go +++ b/ciscoise/data_source_licensing_smart_state.go @@ -42,7 +42,8 @@ func dataSourceLicensingSmartState() *schema.Resource { } func dataSourceLicensingSmartStateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_licensing_tier_state.go b/ciscoise/data_source_licensing_tier_state.go index 2b12b291..bd6254f4 100644 --- a/ciscoise/data_source_licensing_tier_state.go +++ b/ciscoise/data_source_licensing_tier_state.go @@ -61,7 +61,8 @@ func dataSourceLicensingTierState() *schema.Resource { } func dataSourceLicensingTierStateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_account_status.go b/ciscoise/data_source_mnt_account_status.go index b05ba30c..b1b04a94 100644 --- a/ciscoise/data_source_mnt_account_status.go +++ b/ciscoise/data_source_mnt_account_status.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -39,7 +37,8 @@ func dataSourceMntAccountStatus() *schema.Resource { } func dataSourceMntAccountStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vMac := d.Get("mac") diff --git a/ciscoise/data_source_mnt_authentication_status.go b/ciscoise/data_source_mnt_authentication_status.go index 84f1956b..405ad020 100644 --- a/ciscoise/data_source_mnt_authentication_status.go +++ b/ciscoise/data_source_mnt_authentication_status.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -44,7 +42,8 @@ func dataSourceMntAuthenticationStatus() *schema.Resource { } func dataSourceMntAuthenticationStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vMAC := d.Get("mac") diff --git a/ciscoise/data_source_mnt_failure_reasons.go b/ciscoise/data_source_mnt_failure_reasons.go index b4dc19fc..557aaccc 100644 --- a/ciscoise/data_source_mnt_failure_reasons.go +++ b/ciscoise/data_source_mnt_failure_reasons.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -29,7 +27,8 @@ func dataSourceMntFailureReasons() *schema.Resource { } func dataSourceMntFailureReasonsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_active_count.go b/ciscoise/data_source_mnt_session_active_count.go index b4ee21dd..c9bf86d7 100644 --- a/ciscoise/data_source_mnt_session_active_count.go +++ b/ciscoise/data_source_mnt_session_active_count.go @@ -38,7 +38,8 @@ func dataSourceMntSessionActiveCount() *schema.Resource { } func dataSourceMntSessionActiveCountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_active_list.go b/ciscoise/data_source_mnt_session_active_list.go index 8d7489f0..d0d78c4a 100644 --- a/ciscoise/data_source_mnt_session_active_list.go +++ b/ciscoise/data_source_mnt_session_active_list.go @@ -38,7 +38,8 @@ func dataSourceMntSessionActiveList() *schema.Resource { } func dataSourceMntSessionActiveListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_auth_list.go b/ciscoise/data_source_mnt_session_auth_list.go index b1ce9422..b4c6f0ba 100644 --- a/ciscoise/data_source_mnt_session_auth_list.go +++ b/ciscoise/data_source_mnt_session_auth_list.go @@ -38,7 +38,8 @@ func dataSourceMntSessionAuthList() *schema.Resource { } func dataSourceMntSessionAuthListRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_by_ip.go b/ciscoise/data_source_mnt_session_by_ip.go index 23ce6934..619fb79e 100644 --- a/ciscoise/data_source_mnt_session_by_ip.go +++ b/ciscoise/data_source_mnt_session_by_ip.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -34,7 +32,8 @@ func dataSourceMntSessionByIP() *schema.Resource { } func dataSourceMntSessionByIPRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vEndpointIPv4 := d.Get("endpoint_ipv4") diff --git a/ciscoise/data_source_mnt_session_by_mac.go b/ciscoise/data_source_mnt_session_by_mac.go index dde1c62c..6b360d84 100644 --- a/ciscoise/data_source_mnt_session_by_mac.go +++ b/ciscoise/data_source_mnt_session_by_mac.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -34,7 +32,8 @@ func dataSourceMntSessionByMac() *schema.Resource { } func dataSourceMntSessionByMacRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vMac := d.Get("mac") diff --git a/ciscoise/data_source_mnt_session_by_nas_ip.go b/ciscoise/data_source_mnt_session_by_nas_ip.go index 19f584d1..7e513031 100644 --- a/ciscoise/data_source_mnt_session_by_nas_ip.go +++ b/ciscoise/data_source_mnt_session_by_nas_ip.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -34,7 +32,8 @@ func dataSourceMntSessionByNasIP() *schema.Resource { } func dataSourceMntSessionByNasIPRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vNasIPv4 := d.Get("nas_ipv4") diff --git a/ciscoise/data_source_mnt_session_by_username.go b/ciscoise/data_source_mnt_session_by_username.go index a5117eb9..d532311c 100644 --- a/ciscoise/data_source_mnt_session_by_username.go +++ b/ciscoise/data_source_mnt_session_by_username.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -34,7 +32,8 @@ func dataSourceMntSessionByUsername() *schema.Resource { } func dataSourceMntSessionByUsernameRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vUsername := d.Get("username") diff --git a/ciscoise/data_source_mnt_session_disconnect.go b/ciscoise/data_source_mnt_session_disconnect.go index a7dcf6bf..29e43b0b 100644 --- a/ciscoise/data_source_mnt_session_disconnect.go +++ b/ciscoise/data_source_mnt_session_disconnect.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -54,7 +52,8 @@ func dataSourceMntSessionDisconnect() *schema.Resource { } func dataSourceMntSessionDisconnectRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vENDPOINTIP := d.Get("end_poi_nti_p") diff --git a/ciscoise/data_source_mnt_session_posture_count.go b/ciscoise/data_source_mnt_session_posture_count.go index 83b01cb1..b5bde487 100644 --- a/ciscoise/data_source_mnt_session_posture_count.go +++ b/ciscoise/data_source_mnt_session_posture_count.go @@ -38,7 +38,8 @@ func dataSourceMntSessionPostureCount() *schema.Resource { } func dataSourceMntSessionPostureCountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_profiler_count.go b/ciscoise/data_source_mnt_session_profiler_count.go index 61e27d14..90831940 100644 --- a/ciscoise/data_source_mnt_session_profiler_count.go +++ b/ciscoise/data_source_mnt_session_profiler_count.go @@ -38,7 +38,8 @@ func dataSourceMntSessionProfilerCount() *schema.Resource { } func dataSourceMntSessionProfilerCountRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_mnt_session_reauthentication.go b/ciscoise/data_source_mnt_session_reauthentication.go index b3c408f7..e84c34aa 100644 --- a/ciscoise/data_source_mnt_session_reauthentication.go +++ b/ciscoise/data_source_mnt_session_reauthentication.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -44,7 +42,8 @@ func dataSourceMntSessionReauthentication() *schema.Resource { } func dataSourceMntSessionReauthenticationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPSNNAME := d.Get("psn_nam_e") diff --git a/ciscoise/data_source_mnt_sessions_by_session_id.go b/ciscoise/data_source_mnt_sessions_by_session_id.go index 1941b830..1242ce0e 100644 --- a/ciscoise/data_source_mnt_sessions_by_session_id.go +++ b/ciscoise/data_source_mnt_sessions_by_session_id.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -34,7 +32,8 @@ func dataSourceMntSessionsBySessionID() *schema.Resource { } func dataSourceMntSessionsBySessionIDRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vSessionID := d.Get("session_id") diff --git a/ciscoise/data_source_mnt_version.go b/ciscoise/data_source_mnt_version.go index 8617083d..7f801c20 100644 --- a/ciscoise/data_source_mnt_version.go +++ b/ciscoise/data_source_mnt_version.go @@ -46,7 +46,8 @@ func dataSourceMntVersion() *schema.Resource { } func dataSourceMntVersionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_my_device_portal.go b/ciscoise/data_source_my_device_portal.go index 228e05e5..22851de4 100644 --- a/ciscoise/data_source_my_device_portal.go +++ b/ciscoise/data_source_my_device_portal.go @@ -628,7 +628,8 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, } func dataSourceMyDevicePortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_native_supplicant_profile.go b/ciscoise/data_source_native_supplicant_profile.go index d7a674f9..2069e204 100644 --- a/ciscoise/data_source_native_supplicant_profile.go +++ b/ciscoise/data_source_native_supplicant_profile.go @@ -162,7 +162,8 @@ Allowed values: } func dataSourceNativeSupplicantProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_network_access_authentication_rules.go b/ciscoise/data_source_network_access_authentication_rules.go index d6809f25..d0d8a7d2 100644 --- a/ciscoise/data_source_network_access_authentication_rules.go +++ b/ciscoise/data_source_network_access_authentication_rules.go @@ -633,7 +633,8 @@ func dataSourceNetworkAccessAuthenticationRules() *schema.Resource { } func dataSourceNetworkAccessAuthenticationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_network_access_authorization_rules.go b/ciscoise/data_source_network_access_authorization_rules.go index 295cbf0d..b8c37c7a 100644 --- a/ciscoise/data_source_network_access_authorization_rules.go +++ b/ciscoise/data_source_network_access_authorization_rules.go @@ -619,7 +619,8 @@ func dataSourceNetworkAccessAuthorizationRules() *schema.Resource { } func dataSourceNetworkAccessAuthorizationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_network_access_conditions.go b/ciscoise/data_source_network_access_conditions.go index cccc72e4..dd2d0949 100644 --- a/ciscoise/data_source_network_access_conditions.go +++ b/ciscoise/data_source_network_access_conditions.go @@ -663,7 +663,8 @@ func dataSourceNetworkAccessConditions() *schema.Resource { } func dataSourceNetworkAccessConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vName, okName := d.GetOk("name") diff --git a/ciscoise/data_source_network_access_conditions_for_authentication_rule.go b/ciscoise/data_source_network_access_conditions_for_authentication_rule.go index 5718d96e..79f6507c 100644 --- a/ciscoise/data_source_network_access_conditions_for_authentication_rule.go +++ b/ciscoise/data_source_network_access_conditions_for_authentication_rule.go @@ -233,7 +233,8 @@ func dataSourceNetworkAccessConditionsForAuthenticationRule() *schema.Resource { } func dataSourceNetworkAccessConditionsForAuthenticationRuleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_conditions_for_authorization_rule.go b/ciscoise/data_source_network_access_conditions_for_authorization_rule.go index d585c9ed..eca20165 100644 --- a/ciscoise/data_source_network_access_conditions_for_authorization_rule.go +++ b/ciscoise/data_source_network_access_conditions_for_authorization_rule.go @@ -233,7 +233,8 @@ func dataSourceNetworkAccessConditionsForAuthorizationRule() *schema.Resource { } func dataSourceNetworkAccessConditionsForAuthorizationRuleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_conditions_for_policy_set.go b/ciscoise/data_source_network_access_conditions_for_policy_set.go index af65cde8..214fba9f 100644 --- a/ciscoise/data_source_network_access_conditions_for_policy_set.go +++ b/ciscoise/data_source_network_access_conditions_for_policy_set.go @@ -233,7 +233,8 @@ func dataSourceNetworkAccessConditionsForPolicySet() *schema.Resource { } func dataSourceNetworkAccessConditionsForPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_dictionary.go b/ciscoise/data_source_network_access_dictionary.go index 4406cfd9..61325be1 100644 --- a/ciscoise/data_source_network_access_dictionary.go +++ b/ciscoise/data_source_network_access_dictionary.go @@ -142,7 +142,8 @@ func dataSourceNetworkAccessDictionary() *schema.Resource { } func dataSourceNetworkAccessDictionaryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vName, okName := d.GetOk("name") diff --git a/ciscoise/data_source_network_access_dictionary_attribute.go b/ciscoise/data_source_network_access_dictionary_attribute.go index ddc06061..fb18148a 100644 --- a/ciscoise/data_source_network_access_dictionary_attribute.go +++ b/ciscoise/data_source_network_access_dictionary_attribute.go @@ -171,7 +171,8 @@ func dataSourceNetworkAccessDictionaryAttribute() *schema.Resource { } func dataSourceNetworkAccessDictionaryAttributeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vDictionaryName, okDictionaryName := d.GetOk("dictionary_name") diff --git a/ciscoise/data_source_network_access_dictionary_attributes_authentication.go b/ciscoise/data_source_network_access_dictionary_attributes_authentication.go index 3a1f5680..d95e1100 100644 --- a/ciscoise/data_source_network_access_dictionary_attributes_authentication.go +++ b/ciscoise/data_source_network_access_dictionary_attributes_authentication.go @@ -92,7 +92,8 @@ func dataSourceNetworkAccessDictionaryAttributesAuthentication() *schema.Resourc } func dataSourceNetworkAccessDictionaryAttributesAuthenticationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_dictionary_attributes_authorization.go b/ciscoise/data_source_network_access_dictionary_attributes_authorization.go index 2f88a542..5c2d09ca 100644 --- a/ciscoise/data_source_network_access_dictionary_attributes_authorization.go +++ b/ciscoise/data_source_network_access_dictionary_attributes_authorization.go @@ -92,7 +92,8 @@ func dataSourceNetworkAccessDictionaryAttributesAuthorization() *schema.Resource } func dataSourceNetworkAccessDictionaryAttributesAuthorizationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_dictionary_attributes_policy_set.go b/ciscoise/data_source_network_access_dictionary_attributes_policy_set.go index 153378d0..213909e3 100644 --- a/ciscoise/data_source_network_access_dictionary_attributes_policy_set.go +++ b/ciscoise/data_source_network_access_dictionary_attributes_policy_set.go @@ -92,7 +92,8 @@ func dataSourceNetworkAccessDictionaryAttributesPolicySet() *schema.Resource { } func dataSourceNetworkAccessDictionaryAttributesPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_global_exception_rules.go b/ciscoise/data_source_network_access_global_exception_rules.go index 6682a297..71c68204 100644 --- a/ciscoise/data_source_network_access_global_exception_rules.go +++ b/ciscoise/data_source_network_access_global_exception_rules.go @@ -614,7 +614,8 @@ func dataSourceNetworkAccessGlobalExceptionRules() *schema.Resource { } func dataSourceNetworkAccessGlobalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_network_access_identity_stores.go b/ciscoise/data_source_network_access_identity_stores.go index fcb5b8b0..24a1eecf 100644 --- a/ciscoise/data_source_network_access_identity_stores.go +++ b/ciscoise/data_source_network_access_identity_stores.go @@ -43,7 +43,8 @@ func dataSourceNetworkAccessIDentityStores() *schema.Resource { } func dataSourceNetworkAccessIDentityStoresRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_local_exception_rules.go b/ciscoise/data_source_network_access_local_exception_rules.go index 69522856..d3dacd9a 100644 --- a/ciscoise/data_source_network_access_local_exception_rules.go +++ b/ciscoise/data_source_network_access_local_exception_rules.go @@ -619,7 +619,8 @@ func dataSourceNetworkAccessLocalExceptionRules() *schema.Resource { } func dataSourceNetworkAccessLocalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID, okPolicyID := d.GetOk("policy_id") diff --git a/ciscoise/data_source_network_access_network_condition.go b/ciscoise/data_source_network_access_network_condition.go index e8f562ef..6262d235 100644 --- a/ciscoise/data_source_network_access_network_condition.go +++ b/ciscoise/data_source_network_access_network_condition.go @@ -304,7 +304,8 @@ func dataSourceNetworkAccessNetworkCondition() *schema.Resource { } func dataSourceNetworkAccessNetworkConditionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_network_access_policy_set.go b/ciscoise/data_source_network_access_policy_set.go index 72d0d418..1ff0d3b8 100644 --- a/ciscoise/data_source_network_access_policy_set.go +++ b/ciscoise/data_source_network_access_policy_set.go @@ -375,7 +375,8 @@ func dataSourceNetworkAccessPolicySet() *schema.Resource { } func dataSourceNetworkAccessPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_network_access_profiles.go b/ciscoise/data_source_network_access_profiles.go index 4aeb39df..09df36c5 100644 --- a/ciscoise/data_source_network_access_profiles.go +++ b/ciscoise/data_source_network_access_profiles.go @@ -43,7 +43,8 @@ func dataSourceNetworkAccessProfiles() *schema.Resource { } func dataSourceNetworkAccessProfilesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_security_groups.go b/ciscoise/data_source_network_access_security_groups.go index 5843f51a..c2b09eaf 100644 --- a/ciscoise/data_source_network_access_security_groups.go +++ b/ciscoise/data_source_network_access_security_groups.go @@ -43,7 +43,8 @@ func dataSourceNetworkAccessSecurityGroups() *schema.Resource { } func dataSourceNetworkAccessSecurityGroupsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_service_name.go b/ciscoise/data_source_network_access_service_name.go index 9767364e..b3d2377b 100644 --- a/ciscoise/data_source_network_access_service_name.go +++ b/ciscoise/data_source_network_access_service_name.go @@ -53,7 +53,8 @@ func dataSourceNetworkAccessServiceName() *schema.Resource { } func dataSourceNetworkAccessServiceNameRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_network_access_time_date_conditions.go b/ciscoise/data_source_network_access_time_date_conditions.go index 890f3e1f..f3385818 100644 --- a/ciscoise/data_source_network_access_time_date_conditions.go +++ b/ciscoise/data_source_network_access_time_date_conditions.go @@ -448,7 +448,8 @@ func dataSourceNetworkAccessTimeDateConditions() *schema.Resource { } func dataSourceNetworkAccessTimeDateConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID, okID := d.GetOk("id") diff --git a/ciscoise/data_source_network_device.go b/ciscoise/data_source_network_device.go index c27054f3..5783b1aa 100644 --- a/ciscoise/data_source_network_device.go +++ b/ciscoise/data_source_network_device.go @@ -763,7 +763,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_network_device_bulk_monitor_status.go b/ciscoise/data_source_network_device_bulk_monitor_status.go index 0e89a4f6..e360430a 100644 --- a/ciscoise/data_source_network_device_bulk_monitor_status.go +++ b/ciscoise/data_source_network_device_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceNetworkDeviceBulkMonitorStatus() *schema.Resource { } func dataSourceNetworkDeviceBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_network_device_group.go b/ciscoise/data_source_network_device_group.go index 59d24743..9a6aad11 100644 --- a/ciscoise/data_source_network_device_group.go +++ b/ciscoise/data_source_network_device_group.go @@ -248,7 +248,8 @@ For example, if the name is a#b#c it should appear in the request URL as a:b:c`, } func dataSourceNetworkDeviceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_node.go b/ciscoise/data_source_node.go index d1ce19f5..eb6eceb1 100644 --- a/ciscoise/data_source_node.go +++ b/ciscoise/data_source_node.go @@ -336,7 +336,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_node_deployment.go b/ciscoise/data_source_node_deployment.go index 0c7b5095..835421e2 100644 --- a/ciscoise/data_source_node_deployment.go +++ b/ciscoise/data_source_node_deployment.go @@ -198,7 +198,8 @@ Not Contains } func dataSourceNodeDeploymentRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vFilter, okFilter := d.GetOk("filter") diff --git a/ciscoise/data_source_node_group.go b/ciscoise/data_source_node_group.go index fe342e0d..daecfe26 100644 --- a/ciscoise/data_source_node_group.go +++ b/ciscoise/data_source_node_group.go @@ -126,7 +126,8 @@ replication-attempts, replication-timeout. } func dataSourceNodeGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vNodeGroupName, okNodeGroupName := d.GetOk("node_group_name") diff --git a/ciscoise/data_source_node_group_node.go b/ciscoise/data_source_node_group_node.go index d491541d..eb3431bb 100644 --- a/ciscoise/data_source_node_group_node.go +++ b/ciscoise/data_source_node_group_node.go @@ -43,7 +43,8 @@ func dataSourceNodeGroupNode() *schema.Resource { } func dataSourceNodeGroupNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vNodeGroupName := d.Get("node_group_name") diff --git a/ciscoise/data_source_node_services_interfaces.go b/ciscoise/data_source_node_services_interfaces.go index 91066e18..a864aaa9 100644 --- a/ciscoise/data_source_node_services_interfaces.go +++ b/ciscoise/data_source_node_services_interfaces.go @@ -43,7 +43,8 @@ func dataSourceNodeServicesInterfaces() *schema.Resource { } func dataSourceNodeServicesInterfacesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vHostname := d.Get("hostname") diff --git a/ciscoise/data_source_node_services_profiler_probe_config.go b/ciscoise/data_source_node_services_profiler_probe_config.go index 54fc79a4..402566c8 100644 --- a/ciscoise/data_source_node_services_profiler_probe_config.go +++ b/ciscoise/data_source_node_services_profiler_probe_config.go @@ -248,7 +248,8 @@ func dataSourceNodeServicesProfilerProbeConfig() *schema.Resource { } func dataSourceNodeServicesProfilerProbeConfigRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vHostname := d.Get("hostname") diff --git a/ciscoise/data_source_node_services_sxp_interfaces.go b/ciscoise/data_source_node_services_sxp_interfaces.go index 24236f6e..d5b7b4b0 100644 --- a/ciscoise/data_source_node_services_sxp_interfaces.go +++ b/ciscoise/data_source_node_services_sxp_interfaces.go @@ -43,7 +43,8 @@ func dataSourceNodeServicesSxpInterfaces() *schema.Resource { } func dataSourceNodeServicesSxpInterfacesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vHostname := d.Get("hostname") diff --git a/ciscoise/data_source_pan_ha.go b/ciscoise/data_source_pan_ha.go index 37138758..daf89161 100644 --- a/ciscoise/data_source_pan_ha.go +++ b/ciscoise/data_source_pan_ha.go @@ -77,7 +77,8 @@ unavailable. } func dataSourcePanHaRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_patch.go b/ciscoise/data_source_patch.go index 53b77201..26054b91 100644 --- a/ciscoise/data_source_patch.go +++ b/ciscoise/data_source_patch.go @@ -55,7 +55,8 @@ func dataSourcePatch() *schema.Resource { } func dataSourcePatchRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_portal.go b/ciscoise/data_source_portal.go index 3280147a..1d8a4136 100644 --- a/ciscoise/data_source_portal.go +++ b/ciscoise/data_source_portal.go @@ -194,7 +194,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourcePortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_portal_global_setting.go b/ciscoise/data_source_portal_global_setting.go index 817e2722..26003a5b 100644 --- a/ciscoise/data_source_portal_global_setting.go +++ b/ciscoise/data_source_portal_global_setting.go @@ -181,7 +181,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourcePortalGlobalSettingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_portal_theme.go b/ciscoise/data_source_portal_theme.go index 5705e391..472e950e 100644 --- a/ciscoise/data_source_portal_theme.go +++ b/ciscoise/data_source_portal_theme.go @@ -191,7 +191,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourcePortalThemeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_profiler_profile.go b/ciscoise/data_source_profiler_profile.go index b36491ac..b223f02d 100644 --- a/ciscoise/data_source_profiler_profile.go +++ b/ciscoise/data_source_profiler_profile.go @@ -194,7 +194,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceProfilerProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_proxy_connection_settings.go b/ciscoise/data_source_proxy_connection_settings.go index 5a6abc9a..a36ee63e 100644 --- a/ciscoise/data_source_proxy_connection_settings.go +++ b/ciscoise/data_source_proxy_connection_settings.go @@ -86,7 +86,8 @@ pxGrid Cloud } func dataSourceProxyConnectionSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_px_grid_node.go b/ciscoise/data_source_px_grid_node.go index 6bc090cb..bfec6517 100644 --- a/ciscoise/data_source_px_grid_node.go +++ b/ciscoise/data_source_px_grid_node.go @@ -199,7 +199,8 @@ func dataSourcePxGridNode() *schema.Resource { } func dataSourcePxGridNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_pxgrid_bindings_info.go b/ciscoise/data_source_pxgrid_bindings_info.go index ced6d7fa..ff21230f 100644 --- a/ciscoise/data_source_pxgrid_bindings_info.go +++ b/ciscoise/data_source_pxgrid_bindings_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridBindingsInfo() *schema.Resource { } func dataSourcePxgridBindingsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_egress_matrices_info.go b/ciscoise/data_source_pxgrid_egress_matrices_info.go index be1267fd..33f5aaa0 100644 --- a/ciscoise/data_source_pxgrid_egress_matrices_info.go +++ b/ciscoise/data_source_pxgrid_egress_matrices_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEgressMatricesInfo() *schema.Resource { } func dataSourcePxgridEgressMatricesInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_egress_policies_info.go b/ciscoise/data_source_pxgrid_egress_policies_info.go index 16c88631..14950145 100644 --- a/ciscoise/data_source_pxgrid_egress_policies_info.go +++ b/ciscoise/data_source_pxgrid_egress_policies_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEgressPoliciesInfo() *schema.Resource { } func dataSourcePxgridEgressPoliciesInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_endpoint_by_mac_info.go b/ciscoise/data_source_pxgrid_endpoint_by_mac_info.go index 57ee1957..89020518 100644 --- a/ciscoise/data_source_pxgrid_endpoint_by_mac_info.go +++ b/ciscoise/data_source_pxgrid_endpoint_by_mac_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEndpointByMacInfo() *schema.Resource { } func dataSourcePxgridEndpointByMacInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_endpoints_by_os_type_info.go b/ciscoise/data_source_pxgrid_endpoints_by_os_type_info.go index 0685dce2..0e076d77 100644 --- a/ciscoise/data_source_pxgrid_endpoints_by_os_type_info.go +++ b/ciscoise/data_source_pxgrid_endpoints_by_os_type_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEndpointsByOsTypeInfo() *schema.Resource { } func dataSourcePxgridEndpointsByOsTypeInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_endpoints_by_type_info.go b/ciscoise/data_source_pxgrid_endpoints_by_type_info.go index a982bf04..0a7fb911 100644 --- a/ciscoise/data_source_pxgrid_endpoints_by_type_info.go +++ b/ciscoise/data_source_pxgrid_endpoints_by_type_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEndpointsByTypeInfo() *schema.Resource { } func dataSourcePxgridEndpointsByTypeInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_endpoints_info.go b/ciscoise/data_source_pxgrid_endpoints_info.go index d67c2179..bed579f5 100644 --- a/ciscoise/data_source_pxgrid_endpoints_info.go +++ b/ciscoise/data_source_pxgrid_endpoints_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridEndpointsInfo() *schema.Resource { } func dataSourcePxgridEndpointsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_failures.go b/ciscoise/data_source_pxgrid_failures.go index f7ea0fd5..21936484 100644 --- a/ciscoise/data_source_pxgrid_failures.go +++ b/ciscoise/data_source_pxgrid_failures.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -29,7 +27,8 @@ func dataSourcePxgridFailures() *schema.Resource { } func dataSourcePxgridFailuresRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_healths_info.go b/ciscoise/data_source_pxgrid_healths_info.go index 044ea4fe..db871ac7 100644 --- a/ciscoise/data_source_pxgrid_healths_info.go +++ b/ciscoise/data_source_pxgrid_healths_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridHealthsInfo() *schema.Resource { } func dataSourcePxgridHealthsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_performances_info.go b/ciscoise/data_source_pxgrid_performances_info.go index f28ece54..ebdfbc5b 100644 --- a/ciscoise/data_source_pxgrid_performances_info.go +++ b/ciscoise/data_source_pxgrid_performances_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridPerformancesInfo() *schema.Resource { } func dataSourcePxgridPerformancesInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_profiles_info.go b/ciscoise/data_source_pxgrid_profiles_info.go index 13c07284..3df0c568 100644 --- a/ciscoise/data_source_pxgrid_profiles_info.go +++ b/ciscoise/data_source_pxgrid_profiles_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridProfilesInfo() *schema.Resource { } func dataSourcePxgridProfilesInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_security_group_acls_info.go b/ciscoise/data_source_pxgrid_security_group_acls_info.go index e119aec5..74e9e48a 100644 --- a/ciscoise/data_source_pxgrid_security_group_acls_info.go +++ b/ciscoise/data_source_pxgrid_security_group_acls_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSecurityGroupACLsInfo() *schema.Resource { } func dataSourcePxgridSecurityGroupACLsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_security_groups_info.go b/ciscoise/data_source_pxgrid_security_groups_info.go index 41eaff61..828e74dc 100644 --- a/ciscoise/data_source_pxgrid_security_groups_info.go +++ b/ciscoise/data_source_pxgrid_security_groups_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSecurityGroupsInfo() *schema.Resource { } func dataSourcePxgridSecurityGroupsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_session_by_ip_info.go b/ciscoise/data_source_pxgrid_session_by_ip_info.go index 57cde584..fac90463 100644 --- a/ciscoise/data_source_pxgrid_session_by_ip_info.go +++ b/ciscoise/data_source_pxgrid_session_by_ip_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSessionByIPInfo() *schema.Resource { } func dataSourcePxgridSessionByIPInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_session_by_mac_info.go b/ciscoise/data_source_pxgrid_session_by_mac_info.go index 513e7026..2022f6a3 100644 --- a/ciscoise/data_source_pxgrid_session_by_mac_info.go +++ b/ciscoise/data_source_pxgrid_session_by_mac_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSessionByMacInfo() *schema.Resource { } func dataSourcePxgridSessionByMacInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_session_for_recovery_info.go b/ciscoise/data_source_pxgrid_session_for_recovery_info.go index fadfe3b7..55d42b86 100644 --- a/ciscoise/data_source_pxgrid_session_for_recovery_info.go +++ b/ciscoise/data_source_pxgrid_session_for_recovery_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSessionForRecoveryInfo() *schema.Resource { } func dataSourcePxgridSessionForRecoveryInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_sessions_info.go b/ciscoise/data_source_pxgrid_sessions_info.go index 150f9d5c..19eef9e7 100644 --- a/ciscoise/data_source_pxgrid_sessions_info.go +++ b/ciscoise/data_source_pxgrid_sessions_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridSessionsInfo() *schema.Resource { } func dataSourcePxgridSessionsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_user_group_by_username_info.go b/ciscoise/data_source_pxgrid_user_group_by_username_info.go index b0550cdc..67ba2bb4 100644 --- a/ciscoise/data_source_pxgrid_user_group_by_username_info.go +++ b/ciscoise/data_source_pxgrid_user_group_by_username_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridUserGroupByUsernameInfo() *schema.Resource { } func dataSourcePxgridUserGroupByUsernameInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_pxgrid_user_groups_info.go b/ciscoise/data_source_pxgrid_user_groups_info.go index 85dab341..6445d645 100644 --- a/ciscoise/data_source_pxgrid_user_groups_info.go +++ b/ciscoise/data_source_pxgrid_user_groups_info.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -30,7 +28,8 @@ func dataSourcePxgridUserGroupsInfo() *schema.Resource { } func dataSourcePxgridUserGroupsInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_radius_server_sequence.go b/ciscoise/data_source_radius_server_sequence.go index e70dcd94..95a7e2f2 100644 --- a/ciscoise/data_source_radius_server_sequence.go +++ b/ciscoise/data_source_radius_server_sequence.go @@ -243,7 +243,8 @@ func dataSourceRadiusServerSequence() *schema.Resource { } func dataSourceRadiusServerSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_repository.go b/ciscoise/data_source_repository.go index 15e3ba9e..ac0bc7cc 100644 --- a/ciscoise/data_source_repository.go +++ b/ciscoise/data_source_repository.go @@ -116,7 +116,8 @@ func dataSourceRepository() *schema.Resource { } func dataSourceRepositoryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vRepositoryName, okRepositoryName := d.GetOk("repository_name") diff --git a/ciscoise/data_source_repository_files.go b/ciscoise/data_source_repository_files.go index ba57e676..3d09a025 100644 --- a/ciscoise/data_source_repository_files.go +++ b/ciscoise/data_source_repository_files.go @@ -50,7 +50,8 @@ func dataSourceRepositoryFiles() *schema.Resource { } func dataSourceRepositoryFilesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vRepositoryName := d.Get("repository_name") diff --git a/ciscoise/data_source_resource_version.go b/ciscoise/data_source_resource_version.go index 56535f09..3503fec4 100644 --- a/ciscoise/data_source_resource_version.go +++ b/ciscoise/data_source_resource_version.go @@ -68,7 +68,8 @@ func dataSourceResourceVersion() *schema.Resource { } func dataSourceResourceVersionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vResource := d.Get("resource") diff --git a/ciscoise/data_source_rest_id_store.go b/ciscoise/data_source_rest_id_store.go index 6af7522e..8e2e8acc 100644 --- a/ciscoise/data_source_rest_id_store.go +++ b/ciscoise/data_source_rest_id_store.go @@ -329,7 +329,8 @@ Options are: } func dataSourceRestIDStoreRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_self_registered_portal.go b/ciscoise/data_source_self_registered_portal.go index f39e4377..9d9b7d40 100644 --- a/ciscoise/data_source_self_registered_portal.go +++ b/ciscoise/data_source_self_registered_portal.go @@ -1302,7 +1302,8 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, } func dataSourceSelfRegisteredPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_session_service_node.go b/ciscoise/data_source_session_service_node.go index 6d27b08d..13d2b3db 100644 --- a/ciscoise/data_source_session_service_node.go +++ b/ciscoise/data_source_session_service_node.go @@ -191,7 +191,8 @@ func dataSourceSessionServiceNode() *schema.Resource { } func dataSourceSessionServiceNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sg_acl.go b/ciscoise/data_source_sg_acl.go index 659fc680..6fe89708 100644 --- a/ciscoise/data_source_sg_acl.go +++ b/ciscoise/data_source_sg_acl.go @@ -215,7 +215,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSgACLRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sg_acl_bulk_monitor_status.go b/ciscoise/data_source_sg_acl_bulk_monitor_status.go index 1d7dca2b..a0a52857 100644 --- a/ciscoise/data_source_sg_acl_bulk_monitor_status.go +++ b/ciscoise/data_source_sg_acl_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSgACLBulkMonitorStatus() *schema.Resource { } func dataSourceSgACLBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sg_mapping.go b/ciscoise/data_source_sg_mapping.go index c0d88f96..fd652643 100644 --- a/ciscoise/data_source_sg_mapping.go +++ b/ciscoise/data_source_sg_mapping.go @@ -215,7 +215,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSgMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sg_mapping_bulk_monitor_status.go b/ciscoise/data_source_sg_mapping_bulk_monitor_status.go index 04160620..e327e545 100644 --- a/ciscoise/data_source_sg_mapping_bulk_monitor_status.go +++ b/ciscoise/data_source_sg_mapping_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSgMappingBulkMonitorStatus() *schema.Resource { } func dataSourceSgMappingBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sg_mapping_deploy_status_info.go b/ciscoise/data_source_sg_mapping_deploy_status_info.go index 0edb28ab..26965c96 100644 --- a/ciscoise/data_source_sg_mapping_deploy_status_info.go +++ b/ciscoise/data_source_sg_mapping_deploy_status_info.go @@ -53,7 +53,8 @@ Deploy Status will show last Deploy command output. The information will be save } func dataSourceSgMappingDeployStatusInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_sg_mapping_group.go b/ciscoise/data_source_sg_mapping_group.go index 502a86dd..d573508d 100644 --- a/ciscoise/data_source_sg_mapping_group.go +++ b/ciscoise/data_source_sg_mapping_group.go @@ -196,7 +196,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSgMappingGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sg_mapping_group_bulk_monitor_status.go b/ciscoise/data_source_sg_mapping_group_bulk_monitor_status.go index ba65e304..c93c0e21 100644 --- a/ciscoise/data_source_sg_mapping_group_bulk_monitor_status.go +++ b/ciscoise/data_source_sg_mapping_group_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSgMappingGroupBulkMonitorStatus() *schema.Resource { } func dataSourceSgMappingGroupBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sg_mapping_group_deploy_status_info.go b/ciscoise/data_source_sg_mapping_group_deploy_status_info.go index ad5b94f8..6f0e72e3 100644 --- a/ciscoise/data_source_sg_mapping_group_deploy_status_info.go +++ b/ciscoise/data_source_sg_mapping_group_deploy_status_info.go @@ -53,7 +53,8 @@ Deploy Status will show last Deploy command output. The information will be save } func dataSourceSgMappingGroupDeployStatusInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_sg_to_vn_to_vlan.go b/ciscoise/data_source_sg_to_vn_to_vlan.go index 0898a77b..86a5a003 100644 --- a/ciscoise/data_source_sg_to_vn_to_vlan.go +++ b/ciscoise/data_source_sg_to_vn_to_vlan.go @@ -239,7 +239,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSgToVnToVLANRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sg_to_vn_to_vlan_bulk_monitor_status.go b/ciscoise/data_source_sg_to_vn_to_vlan_bulk_monitor_status.go index 0a75b16f..d819753f 100644 --- a/ciscoise/data_source_sg_to_vn_to_vlan_bulk_monitor_status.go +++ b/ciscoise/data_source_sg_to_vn_to_vlan_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSgToVnToVLANBulkMonitorStatus() *schema.Resource { } func dataSourceSgToVnToVLANBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sgt.go b/ciscoise/data_source_sgt.go index b9dae46c..26e2e6a6 100644 --- a/ciscoise/data_source_sgt.go +++ b/ciscoise/data_source_sgt.go @@ -214,7 +214,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sgt_bulk_monitor_status.go b/ciscoise/data_source_sgt_bulk_monitor_status.go index af11d863..b7a67608 100644 --- a/ciscoise/data_source_sgt_bulk_monitor_status.go +++ b/ciscoise/data_source_sgt_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSgtBulkMonitorStatus() *schema.Resource { } func dataSourceSgtBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sms_provider.go b/ciscoise/data_source_sms_provider.go index d6136b4e..397affce 100644 --- a/ciscoise/data_source_sms_provider.go +++ b/ciscoise/data_source_sms_provider.go @@ -137,7 +137,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSmsProviderRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sponsor_group.go b/ciscoise/data_source_sponsor_group.go index a504eea8..da99e845 100644 --- a/ciscoise/data_source_sponsor_group.go +++ b/ciscoise/data_source_sponsor_group.go @@ -325,7 +325,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSponsorGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sponsor_group_member.go b/ciscoise/data_source_sponsor_group_member.go index e7c27e42..03b219a9 100644 --- a/ciscoise/data_source_sponsor_group_member.go +++ b/ciscoise/data_source_sponsor_group_member.go @@ -137,7 +137,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSponsorGroupMemberRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sponsor_portal.go b/ciscoise/data_source_sponsor_portal.go index 578def9e..97a16a82 100644 --- a/ciscoise/data_source_sponsor_portal.go +++ b/ciscoise/data_source_sponsor_portal.go @@ -637,7 +637,8 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, } func dataSourceSponsorPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sponsored_guest_portal.go b/ciscoise/data_source_sponsored_guest_portal.go index 68abec4b..aece1a2d 100644 --- a/ciscoise/data_source_sponsored_guest_portal.go +++ b/ciscoise/data_source_sponsored_guest_portal.go @@ -816,7 +816,8 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, } func dataSourceSponsoredGuestPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_support_bundle_download.go b/ciscoise/data_source_support_bundle_download.go index db044e14..dc905a70 100644 --- a/ciscoise/data_source_support_bundle_download.go +++ b/ciscoise/data_source_support_bundle_download.go @@ -37,7 +37,8 @@ func dataSourceSupportBundleDownload() *schema.Resource { } func dataSourceSupportBundleDownloadRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_support_bundle_status.go b/ciscoise/data_source_support_bundle_status.go index 1025a1d8..6166c9a6 100644 --- a/ciscoise/data_source_support_bundle_status.go +++ b/ciscoise/data_source_support_bundle_status.go @@ -150,7 +150,8 @@ func dataSourceSupportBundleStatus() *schema.Resource { } func dataSourceSupportBundleStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sxp_connections.go b/ciscoise/data_source_sxp_connections.go index faf1335d..517281d8 100644 --- a/ciscoise/data_source_sxp_connections.go +++ b/ciscoise/data_source_sxp_connections.go @@ -206,7 +206,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSxpConnectionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sxp_connections_bulk_monitor_status.go b/ciscoise/data_source_sxp_connections_bulk_monitor_status.go index 151a7c24..68ce1e19 100644 --- a/ciscoise/data_source_sxp_connections_bulk_monitor_status.go +++ b/ciscoise/data_source_sxp_connections_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSxpConnectionsBulkMonitorStatus() *schema.Resource { } func dataSourceSxpConnectionsBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sxp_local_bindings.go b/ciscoise/data_source_sxp_local_bindings.go index 747212a4..8eb7824d 100644 --- a/ciscoise/data_source_sxp_local_bindings.go +++ b/ciscoise/data_source_sxp_local_bindings.go @@ -203,7 +203,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSxpLocalBindingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sxp_local_bindings_bulk_monitor_status.go b/ciscoise/data_source_sxp_local_bindings_bulk_monitor_status.go index 7c19b9a5..4e114f5f 100644 --- a/ciscoise/data_source_sxp_local_bindings_bulk_monitor_status.go +++ b/ciscoise/data_source_sxp_local_bindings_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSxpLocalBindingsBulkMonitorStatus() *schema.Resource { } func dataSourceSxpLocalBindingsBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_sxp_vpns.go b/ciscoise/data_source_sxp_vpns.go index eda54543..a23389e1 100644 --- a/ciscoise/data_source_sxp_vpns.go +++ b/ciscoise/data_source_sxp_vpns.go @@ -178,7 +178,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceSxpVpnsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_sxp_vpns_bulk_monitor_status.go b/ciscoise/data_source_sxp_vpns_bulk_monitor_status.go index 9d44dc33..1b51cac2 100644 --- a/ciscoise/data_source_sxp_vpns_bulk_monitor_status.go +++ b/ciscoise/data_source_sxp_vpns_bulk_monitor_status.go @@ -100,7 +100,8 @@ func dataSourceSxpVpnsBulkMonitorStatus() *schema.Resource { } func dataSourceSxpVpnsBulkMonitorStatusRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vBulkid := d.Get("bulkid") diff --git a/ciscoise/data_source_system_certificate.go b/ciscoise/data_source_system_certificate.go index dbb25ed6..99edba8a 100644 --- a/ciscoise/data_source_system_certificate.go +++ b/ciscoise/data_source_system_certificate.go @@ -366,7 +366,8 @@ Not Contains } func dataSourceSystemCertificateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vHostName, okHostName := d.GetOk("host_name") diff --git a/ciscoise/data_source_system_certificate_export_info.go b/ciscoise/data_source_system_certificate_export_info.go index b446aca5..3634365f 100644 --- a/ciscoise/data_source_system_certificate_export_info.go +++ b/ciscoise/data_source_system_certificate_export_info.go @@ -47,7 +47,8 @@ func dataSourceSystemCertificateExportInfo() *schema.Resource { } func dataSourceSystemCertificateExportInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_system_config_version.go b/ciscoise/data_source_system_config_version.go index d7804641..b88b93bc 100644 --- a/ciscoise/data_source_system_config_version.go +++ b/ciscoise/data_source_system_config_version.go @@ -51,7 +51,8 @@ func dataSourceSystemConfigVersion() *schema.Resource { } func dataSourceSystemConfigVersionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_tacacs_command_sets.go b/ciscoise/data_source_tacacs_command_sets.go index ff1afa7c..a9d219cb 100644 --- a/ciscoise/data_source_tacacs_command_sets.go +++ b/ciscoise/data_source_tacacs_command_sets.go @@ -245,7 +245,8 @@ func dataSourceTacacsCommandSets() *schema.Resource { } func dataSourceTacacsCommandSetsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_tacacs_external_servers.go b/ciscoise/data_source_tacacs_external_servers.go index 93c6e877..56847455 100644 --- a/ciscoise/data_source_tacacs_external_servers.go +++ b/ciscoise/data_source_tacacs_external_servers.go @@ -225,7 +225,8 @@ func dataSourceTacacsExternalServers() *schema.Resource { } func dataSourceTacacsExternalServersRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_tacacs_profile.go b/ciscoise/data_source_tacacs_profile.go index 1f2cc164..5b4d7b51 100644 --- a/ciscoise/data_source_tacacs_profile.go +++ b/ciscoise/data_source_tacacs_profile.go @@ -239,7 +239,8 @@ func dataSourceTacacsProfile() *schema.Resource { } func dataSourceTacacsProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_tacacs_server_sequence.go b/ciscoise/data_source_tacacs_server_sequence.go index 8028922b..1896484b 100644 --- a/ciscoise/data_source_tacacs_server_sequence.go +++ b/ciscoise/data_source_tacacs_server_sequence.go @@ -243,7 +243,8 @@ The order of the names in the string is the order of servers that will be used d } func dataSourceTacacsServerSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_tasks.go b/ciscoise/data_source_tasks.go index 6ee1e49a..0bafa2b8 100644 --- a/ciscoise/data_source_tasks.go +++ b/ciscoise/data_source_tasks.go @@ -120,7 +120,8 @@ func dataSourceTasks() *schema.Resource { } func dataSourceTasksRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vTaskID, okTaskID := d.GetOk("task_id") diff --git a/ciscoise/data_source_telemetry_info.go b/ciscoise/data_source_telemetry_info.go index 61d3e212..5e05ce2c 100644 --- a/ciscoise/data_source_telemetry_info.go +++ b/ciscoise/data_source_telemetry_info.go @@ -173,7 +173,8 @@ string parameter. Each resource Data model description should specify if an attr } func dataSourceTelemetryInfoRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_transport_gateway_settings.go b/ciscoise/data_source_transport_gateway_settings.go index 8ae7028f..657e3a33 100644 --- a/ciscoise/data_source_transport_gateway_settings.go +++ b/ciscoise/data_source_transport_gateway_settings.go @@ -45,7 +45,8 @@ in case of air-gapped network. } func dataSourceTransportGatewaySettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/data_source_trusted_certificate.go b/ciscoise/data_source_trusted_certificate.go index 910a35e4..07e42e25 100644 --- a/ciscoise/data_source_trusted_certificate.go +++ b/ciscoise/data_source_trusted_certificate.go @@ -551,7 +551,8 @@ Not Contains } func dataSourceTrustedCertificateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_trusted_certificate_export.go b/ciscoise/data_source_trusted_certificate_export.go index b61be74e..be9c080e 100644 --- a/ciscoise/data_source_trusted_certificate_export.go +++ b/ciscoise/data_source_trusted_certificate_export.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -35,7 +33,8 @@ func dataSourceTrustedCertificateExport() *schema.Resource { } func dataSourceTrustedCertificateExportRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("id") diff --git a/ciscoise/data_source_trustsec_nbar_app.go b/ciscoise/data_source_trustsec_nbar_app.go index 94b8b2e3..a38bd9d2 100644 --- a/ciscoise/data_source_trustsec_nbar_app.go +++ b/ciscoise/data_source_trustsec_nbar_app.go @@ -224,7 +224,8 @@ Not Contains } func dataSourceTrustsecNbarAppRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_trustsec_sg_vn_mapping.go b/ciscoise/data_source_trustsec_sg_vn_mapping.go index 7b547d89..3e1d5ea5 100644 --- a/ciscoise/data_source_trustsec_sg_vn_mapping.go +++ b/ciscoise/data_source_trustsec_sg_vn_mapping.go @@ -224,7 +224,8 @@ Not Contains } func dataSourceTrustsecSgVnMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_trustsec_vn.go b/ciscoise/data_source_trustsec_vn.go index ec7e8f6b..220a8bb6 100644 --- a/ciscoise/data_source_trustsec_vn.go +++ b/ciscoise/data_source_trustsec_vn.go @@ -204,7 +204,8 @@ Not Contains } func dataSourceTrustsecVnRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/data_source_trustsec_vn_vlan_mapping.go b/ciscoise/data_source_trustsec_vn_vlan_mapping.go index a2bc3959..55e9b72b 100644 --- a/ciscoise/data_source_trustsec_vn_vlan_mapping.go +++ b/ciscoise/data_source_trustsec_vn_vlan_mapping.go @@ -244,7 +244,8 @@ Not Contains } func dataSourceTrustsecVnVLANMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPage, okPage := d.GetOk("page") diff --git a/ciscoise/diffs.go b/ciscoise/diffs.go index 3ca13df6..8324621c 100644 --- a/ciscoise/diffs.go +++ b/ciscoise/diffs.go @@ -12,6 +12,17 @@ func diffSupressHotpatchName() schema.SchemaDiffSuppressFunc { } } +func diffSupressOptional() schema.SchemaDiffSuppressFunc { + return func(k, old, new string, d *schema.ResourceData) bool { + return compareOptional(new, old) + } +} +func diffSupressBool() schema.SchemaDiffSuppressFunc { + return func(k, old, new string, d *schema.ResourceData) bool { + return compareBoolean(new, old) + } +} + func diffSupressMacAddress() schema.SchemaDiffSuppressFunc { return func(k, old, new string, d *schema.ResourceData) bool { return compareMacAddress(old, new) diff --git a/ciscoise/provider.go b/ciscoise/provider.go index 79a54313..284e0318 100644 --- a/ciscoise/provider.go +++ b/ciscoise/provider.go @@ -70,6 +70,13 @@ func Provider() *schema.Provider { ValidateFunc: validateIntegerGeqThan(0), Description: "Timeout (in seconds) for the RESTful HTTP requests. If not set, it uses the ISE_SINGLE_REQUEST_TIMEOUT environment varible; defaults to 60.", }, + "enable_auto_import": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DefaultFunc: schema.EnvDefaultFunc("ISE_ENABLE_AUTO_IMPORT", "false"), + ValidateFunc: validateStringHasValueFunc([]string{"true", "false"}), + Description: "Flag to enable or disable terraform automatic import (Automatic import means that when Terraform attempts to create the resource, it will perform a get operation if it founds a matching resource, it will perform an import of the resource it found, this is a similar operation to the terraform import command.) in resources, this is a configuration added to the provider, it uses the ISE_ENABLE_AUTO_IMPORT environment varible; `true` to enable it, defaults to `false`.", + }, }, ResourcesMap: map[string]*schema.Resource{ "ciscoise_personas_check_standalone": resourcePersonasCheckStandalone(), diff --git a/ciscoise/resource_aci_settings.go b/ciscoise/resource_aci_settings.go index 46cba5ab..20365bd4 100644 --- a/ciscoise/resource_aci_settings.go +++ b/ciscoise/resource_aci_settings.go @@ -150,9 +150,8 @@ func resourceAciSettings() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -161,94 +160,113 @@ func resourceAciSettings() *schema.Resource { Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "aci51": &schema.Schema{ Description: `Enable 5.1 ACI Version`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "aciipaddress": &schema.Schema{ Description: `ACI Domain manager Ip Address.`, Type: schema.TypeString, Optional: true, + Computed: true, }, "acipassword": &schema.Schema{ Description: `ACI Domain manager Password.`, Type: schema.TypeString, Optional: true, Sensitive: true, + Computed: true, }, "aciuser_name": &schema.Schema{ Description: `ACI Domain manager Username.`, Type: schema.TypeString, Optional: true, + Computed: true, }, "admin_name": &schema.Schema{ Description: `ACI Cluster Admin name`, Type: schema.TypeString, Optional: true, + Computed: true, }, "admin_password": &schema.Schema{ Description: `ACI Cluster Admin password`, Type: schema.TypeString, Optional: true, + Computed: true, }, "all_sxp_domain": &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "default_sgt_name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "enable_aci": &schema.Schema{ Description: `Enable ACI Integration`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "enable_data_plane": &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "enable_elements_limit": &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "id": &schema.Schema{ Description: `Resource UUID value`, Type: schema.TypeString, - Required: true, + Optional: true, + Computed: true, }, "ip_address_host_name": &schema.Schema{ Description: `ACI Cluster IP Address / Host name`, Type: schema.TypeString, Optional: true, + Computed: true, }, "l3_route_network": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "max_num_iepg_from_aci": &schema.Schema{ Type: schema.TypeInt, Optional: true, + Computed: true, }, "max_num_sgt_to_aci": &schema.Schema{ Type: schema.TypeInt, Optional: true, + Computed: true, }, "specific_sxp_domain": &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "specifix_sxp_domain_list": &schema.Schema{ Type: schema.TypeList, Optional: true, + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -256,18 +274,22 @@ func resourceAciSettings() *schema.Resource { "suffix_to_epg": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "suffix_to_sgt": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "tenant_name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "untagged_packet_iepg_name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, }, }, @@ -279,7 +301,8 @@ func resourceAciSettings() *schema.Resource { func resourceAciSettingsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AciSettings create") log.Printf("[DEBUG] Missing AciSettings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -313,7 +336,8 @@ func resourceAciSettingsCreate(ctx context.Context, d *schema.ResourceData, m in func resourceAciSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AciSettings read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -342,7 +366,7 @@ func resourceAciSettingsRead(ctx context.Context, d *schema.ResourceData, m inte } if err := d.Set("parameters", vItem1); err != nil { diags = append(diags, diagError( - "Failure when setting GetAciSettings response to parameters", + "Failure when setting GetAciSettings response to item", err)) return diags } @@ -354,7 +378,8 @@ func resourceAciSettingsRead(ctx context.Context, d *schema.ResourceData, m inte func resourceAciSettingsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AciSettings update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_active_directory.go b/ciscoise/resource_active_directory.go index dc633b30..039a88c3 100644 --- a/ciscoise/resource_active_directory.go +++ b/ciscoise/resource_active_directory.go @@ -346,39 +346,50 @@ default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUST Schema: map[string]*schema.Schema{ "ad_attributes": &schema.Schema{ - Description: `Holds list of AD Attributes`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Holds list of AD Attributes`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attributes": &schema.Schema{ - Description: `List of Attributes`, - Type: schema.TypeList, - Optional: true, + Description: `List of Attributes`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_value": &schema.Schema{ - Description: `Required for each attribute in the attribute list. Can contain an empty string. All characters are allowed except <%"`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each attribute in the attribute list. Can contain an empty string. All characters are allowed except <%"`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "internal_name": &schema.Schema{ - Description: `Required for each attribute in the attribute list. All characters are allowed except <%"`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each attribute in the attribute list. All characters are allowed except <%"`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Required for each attribute in the attribute list with no duplication between attributes. All characters are allowed except <%"`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each attribute in the attribute list with no duplication between attributes. All characters are allowed except <%"`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "type": &schema.Schema{ - Description: `Required for each group in the group list. Allowed values: STRING, IP, BOOLEAN, INT, OCTET_STRING`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each group in the group list. Allowed values: STRING, IP, BOOLEAN, INT, OCTET_STRING`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -387,39 +398,50 @@ default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUST }, }, "ad_scopes_names": &schema.Schema{ - Description: `String that contains the names of the scopes that the active directory belongs to. Names are separated by comma. Alphanumeric, underscore (_) characters are allowed`, - Type: schema.TypeString, - Optional: true, + Description: `String that contains the names of the scopes that the active directory belongs to. Names are separated by comma. Alphanumeric, underscore (_) characters are allowed`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "adgroups": &schema.Schema{ - Description: `Holds list of AD Groups`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Holds list of AD Groups`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "groups": &schema.Schema{ - Description: `List of Groups`, - Type: schema.TypeList, - Optional: true, + Description: `List of Groups`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ - Description: `Required for each group in the group list with no duplication between groups. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each group in the group list with no duplication between groups. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sid": &schema.Schema{ - Description: `Cisco ISE uses security identifiers (SIDs) for optimization of group membership evaluation. SIDs are useful for efficiency (speed) when the groups are evaluated. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `Cisco ISE uses security identifiers (SIDs) for optimization of group membership evaluation. SIDs are useful for efficiency (speed) when the groups are evaluated. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "type": &schema.Schema{ - Description: `No character restriction`, - Type: schema.TypeString, - Optional: true, + Description: `No character restriction`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -428,204 +450,293 @@ default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUST }, }, "advanced_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aging_time": &schema.Schema{ - Description: `Range 1-8760 hours`, - Type: schema.TypeInt, - Optional: true, + Description: `Range 1-8760 hours`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "auth_protection_type": &schema.Schema{ Description: `Enable prevent AD account lockout. Allowed values: -- WIRELESS, -- WIRED, -- BOTH`, - Type: schema.TypeString, - Optional: true, + - WIRELESS, + - WIRED, + - BOTH`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "country": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "department": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "email": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_callback_for_dialin_client": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_dialin_permission_check": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_failed_auth_protection": &schema.Schema{ - Description: `Enable prevent AD account lockout due to too many bad password attempts`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Enable prevent AD account lockout due to too many bad password attempts`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_machine_access": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_machine_auth": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_pass_change": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_rewrites": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "failed_auth_threshold": &schema.Schema{ - Description: `Number of bad password attempts`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of bad password attempts`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "first_name": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_not_in_ad_behaviour": &schema.Schema{ - Description: `Allowed values: REJECT, SEARCH_JOINED_FOREST, SEARCH_ALL`, - Type: schema.TypeString, - Optional: true, + Description: `Allowed values: REJECT, SEARCH_JOINED_FOREST, SEARCH_ALL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "job_title": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "last_name": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "locality": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "organizational_unit": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "plaintext_auth": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "rewrite_rules": &schema.Schema{ Description: `Identity rewrite is an advanced feature that directs Cisco ISE to manipulate the identity -before it is passed to the external Active Directory system. You can create rules to change -the identity to a desired format that includes or excludes a domain prefix and/or suffix or -other additional markup of your choice`, - Type: schema.TypeList, - Optional: true, + before it is passed to the external Active Directory system. You can create rules to change + the identity to a desired format that includes or excludes a domain prefix and/or suffix or + other additional markup of your choice`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "rewrite_match": &schema.Schema{ - Description: `Required for each rule in the list with no duplication between rules. All characters are allowed except %"`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each rule in the list with no duplication between rules. All characters are allowed except %"`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rewrite_result": &schema.Schema{ - Description: `Required for each rule in the list. All characters are allowed except %"`, - Type: schema.TypeString, - Optional: true, + Description: `Required for each rule in the list. All characters are allowed except %"`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "row_id": &schema.Schema{ - Description: `Required for each rule in the list in serial order`, - Type: schema.TypeInt, - Optional: true, + Description: `Required for each rule in the list in serial order`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "schema": &schema.Schema{ Description: `Allowed values: ACTIVE_DIRECTORY, CUSTOM. -Choose ACTIVE_DIRECTORY schema when the AD attributes defined in AD can be copied to relevant attributes -in Cisco ISE. If customization is needed, choose CUSTOM schema. All User info attributes are always set to -default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUSTOM schema`, - Type: schema.TypeString, - Optional: true, + Choose ACTIVE_DIRECTORY schema when the AD attributes defined in AD can be copied to relevant attributes + in Cisco ISE. If customization is needed, choose CUSTOM schema. All User info attributes are always set to + default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUSTOM schema`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state_or_province": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "street_address": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "telephone": &schema.Schema{ - Description: `User info attribute. All characters are allowed except %`, - Type: schema.TypeString, - Optional: true, + Description: `User info attribute. All characters are allowed except %`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "unreachable_domains_behaviour": &schema.Schema{ - Description: `Allowed values: PROCEED, DROP`, - Type: schema.TypeString, - Optional: true, + Description: `Allowed values: PROCEED, DROP`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Description: `No character restriction`, - Type: schema.TypeString, - Optional: true, + Description: `No character restriction`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "domain": &schema.Schema{ - Description: `The AD domain. Alphanumeric, hyphen (-) and dot (.) characters are allowed`, - Type: schema.TypeString, - Optional: true, - }, - "enable_domain_white_list": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The AD domain. Alphanumeric, hyphen (-) and dot (.) characters are allowed`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_domain_allowed_list": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + Computed: true, + }, + "enable_domain_white_list": &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "id": &schema.Schema{ - Description: `Resource UUID value`, - Type: schema.TypeString, - Optional: true, + Description: `Resource UUID value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name. Maximum 32 characters allowed. Allowed characters are alphanumeric and .-_/\\ characters`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name. Maximum 32 characters allowed. Allowed characters are alphanumeric and .-_/\\ characters`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -636,8 +747,9 @@ default value if schema is ACTIVE_DIRECTORY. Values can be changed only for CUST func resourceActiveDirectoryCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ActiveDirectory create") - client := m.(*isegosdk.Client) - + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -650,24 +762,27 @@ func resourceActiveDirectoryCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.ActiveDirectory.GetActiveDirectoryByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceActiveDirectoryRead(ctx, d, m) - } - } - if okName && vvName != "" { - getResponse2, _, err := client.ActiveDirectory.GetActiveDirectoryByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceActiveDirectoryRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.ActiveDirectory.GetActiveDirectoryByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceActiveDirectoryRead(ctx, d, m) + } + } else { + if okName && vvName != "" { + getResponse2, _, err := client.ActiveDirectory.GetActiveDirectoryByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.ERSActiveDirectory.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceActiveDirectoryRead(ctx, d, m) + } + } } } restyResp1, err := client.ActiveDirectory.CreateActiveDirectory(request1) @@ -694,7 +809,8 @@ func resourceActiveDirectoryCreate(ctx context.Context, d *schema.ResourceData, func resourceActiveDirectoryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ActiveDirectory read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -732,6 +848,12 @@ func resourceActiveDirectoryRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetActiveDirectoryByName response to item", + err)) + return diags + } return diags } @@ -758,6 +880,12 @@ func resourceActiveDirectoryRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetActiveDirectoryByID response", + err)) + return diags + } return diags } @@ -766,7 +894,8 @@ func resourceActiveDirectoryRead(ctx context.Context, d *schema.ResourceData, m func resourceActiveDirectoryUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ActiveDirectory update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -840,7 +969,8 @@ func resourceActiveDirectoryUpdate(ctx context.Context, d *schema.ResourceData, func resourceActiveDirectoryDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ActiveDirectory delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_active_directory_join_domain.go b/ciscoise/resource_active_directory_join_domain.go index ff89b91f..7c71c187 100644 --- a/ciscoise/resource_active_directory_join_domain.go +++ b/ciscoise/resource_active_directory_join_domain.go @@ -76,7 +76,8 @@ func resourceActiveDirectoryJoinDomain() *schema.Resource { func resourceActiveDirectoryJoinDomainCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning JoinDomain create") log.Printf("[DEBUG] Missing JoinDomain create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client vID := d.Get("parameters.0.id") var diags diag.Diagnostics diff --git a/ciscoise/resource_active_directory_join_domain_with_all_nodes.go b/ciscoise/resource_active_directory_join_domain_with_all_nodes.go index da4559e0..0cd7fcf5 100644 --- a/ciscoise/resource_active_directory_join_domain_with_all_nodes.go +++ b/ciscoise/resource_active_directory_join_domain_with_all_nodes.go @@ -76,7 +76,8 @@ func resourceActiveDirectoryJoinDomainWithAllNodes() *schema.Resource { func resourceActiveDirectoryJoinDomainWithAllNodesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning JoinDomainWithAllNodes create") log.Printf("[DEBUG] Missing JoinDomainWithAllNodes create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_active_directory_leave_domain.go b/ciscoise/resource_active_directory_leave_domain.go index b6a4ddbc..f3fe0830 100644 --- a/ciscoise/resource_active_directory_leave_domain.go +++ b/ciscoise/resource_active_directory_leave_domain.go @@ -77,7 +77,8 @@ func resourceActiveDirectoryLeaveDomain() *schema.Resource { func resourceActiveDirectoryLeaveDomainCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LeaveDomain create") log.Printf("[DEBUG] Missing LeaveDomain create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client vID := d.Get("parameters.0.id") var diags diag.Diagnostics diff --git a/ciscoise/resource_active_directory_leave_domain_with_all_nodes.go b/ciscoise/resource_active_directory_leave_domain_with_all_nodes.go index bad98013..1f140a12 100644 --- a/ciscoise/resource_active_directory_leave_domain_with_all_nodes.go +++ b/ciscoise/resource_active_directory_leave_domain_with_all_nodes.go @@ -73,7 +73,8 @@ func resourceActiveDirectoryLeaveDomainWithAllNodes() *schema.Resource { func resourceActiveDirectoryLeaveDomainWithAllNodesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LeaveDomainWithAllNodes create") log.Printf("[DEBUG] Missing LeaveDomainWithAllNodes create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client vID := d.Get("parameters.0.id") var diags diag.Diagnostics diff --git a/ciscoise/resource_allowed_protocols.go b/ciscoise/resource_allowed_protocols.go index 9bfe349f..63ae26f0 100644 --- a/ciscoise/resource_allowed_protocols.go +++ b/ciscoise/resource_allowed_protocols.go @@ -515,501 +515,679 @@ Valid range is 0-3`, Schema: map[string]*schema.Schema{ "allow_chap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_md5": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_tls": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_ttls": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_leap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_ms_chap_v1": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_pap_ascii": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_preferred_eap_protocol": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_teap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_weak_ciphers_for_eap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast": &schema.Schema{ - Description: `The eapFast is required only if allowEapFast is true, otherwise it must be ignored. The object eapFast contains the settings for EAP FAST protocol`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The eapFast is required only if allowEapFast is true, otherwise it must be ignored. The object eapFast contains the settings for EAP FAST protocol`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_eap_fast_eap_gtc": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast_eap_gtc_pwd_change": &schema.Schema{ - Description: `The allowEapFastEapGtcPwdChange is required only if allowEapFastEapGtc is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowEapFastEapGtcPwdChange is required only if allowEapFastEapGtc is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast_eap_gtc_pwd_change_retries": &schema.Schema{ Description: `The allowEapFastEapGtcPwdChangeRetries is required only if allowEapFastEapGtc is true, -otherwise it must be ignored. Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored. Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_eap_fast_eap_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast_eap_ms_chap_v2_pwd_change": &schema.Schema{ - Description: `The allowEapFastEapMsChapV2PwdChange is required only if allowEapFastEapMsChapV2 is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowEapFastEapMsChapV2PwdChange is required only if allowEapFastEapMsChapV2 is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast_eap_ms_chap_v2_pwd_change_retries": &schema.Schema{ - Description: `The allowEapFastEapMsChapV2PwdChangeRetries is required only if eapTtlsEapMsChapV2 is true, otherwise it must be ignored. Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + Description: `The allowEapFastEapMsChapV2PwdChangeRetries is required only if eapTtlsEapMsChapV2 is true, otherwise it must be ignored. Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_eap_fast_eap_tls": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_eap_fast_eap_tls_auth_of_expired_certs": &schema.Schema{ - Description: `The allowEapFastEapTlsAuthOfExpiredCerts is required only if allowEapFastEapTls is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowEapFastEapTlsAuthOfExpiredCerts is required only if allowEapFastEapTls is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_dont_use_pacs_accept_client_cert": &schema.Schema{ - Description: `The eapFastDontUsePacsAcceptClientCert is required only if eapFastUsePacs is FALSE, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The eapFastDontUsePacsAcceptClientCert is required only if eapFastUsePacs is FALSE, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_dont_use_pacs_allow_machine_authentication": &schema.Schema{ - Description: `The eapFastDontUsePacsAllowMachineAuthentication is required only if eapFastUsePacs is FALSE, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The eapFastDontUsePacsAllowMachineAuthentication is required only if eapFastUsePacs is FALSE, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_enable_eap_chaining": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_accept_client_cert": &schema.Schema{ Description: `The eapFastUsePacsAcceptClientCert is required only if eapFastUsePacsAllowAuthenProvisioning is true, -otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_allow_anonym_provisioning": &schema.Schema{ Description: `The eapFastUsePacsAllowAnonymProvisioning is required only if eapFastUsePacs is true, -otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_allow_authen_provisioning": &schema.Schema{ Description: `The eapFastUsePacsAllowAuthenProvisioning is required only if eapFastUsePacs is true, -otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_allow_machine_authentication": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_authorization_pac_ttl": &schema.Schema{ Description: `The eapFastUsePacsAuthorizationPacTtl is required only if eapFastUsePacsStatelessSessionResume is true, -otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_authorization_pac_ttl_units": &schema.Schema{ Description: `The eapFastUsePacsAuthorizationPacTtlUnits is required only if eapFastUsePacsStatelessSessionResume is true, -otherwise it must be ignored. -Allowed Values: -- SECONDS, -- MINUTES, -- HOURS, -- DAYS, -- WEEKS`, - Type: schema.TypeString, - Optional: true, + otherwise it must be ignored. + Allowed Values: + - SECONDS, + - MINUTES, + - HOURS, + - DAYS, + - WEEKS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_machine_pac_ttl": &schema.Schema{ Description: `The eapFastUsePacsMachinePacTtl is required only if eapFastUsePacsAllowMachineAuthentication is true, -otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_machine_pac_ttl_units": &schema.Schema{ Description: `The eapFastUsePacsMachinePacTtlUnits is required only if eapFastUsePacsAllowMachineAuthentication is true, -otherwise it must be ignored. -Allowed Values: -- SECONDS, -- MINUTES, -- HOURS, -- DAYS, -- WEEKS`, - Type: schema.TypeString, - Optional: true, + otherwise it must be ignored. + Allowed Values: + - SECONDS, + - MINUTES, + - HOURS, + - DAYS, + - WEEKS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_return_access_accept_after_authenticated_provisioning": &schema.Schema{ Description: `The eapFastUsePacsReturnAccessAcceptAfterAuthenticatedProvisioning -is required only if eapFastUsePacsAllowAuthenProvisioning is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + is required only if eapFastUsePacsAllowAuthenProvisioning is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_stateless_session_resume": &schema.Schema{ - Description: `The eapFastUsePacsStatelessSessionResume is required only if eapFastUsePacs is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The eapFastUsePacsStatelessSessionResume is required only if eapFastUsePacs is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_fast_use_pacs_tunnel_pac_ttl": &schema.Schema{ - Description: `The eapFastUsePacsTunnelPacTtl is required only if eapFastUsePacs is true, otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + Description: `The eapFastUsePacsTunnelPacTtl is required only if eapFastUsePacs is true, otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_tunnel_pac_ttl_units": &schema.Schema{ Description: `The eapFastUsePacsTunnelPacTtlUnits is required only if eapFastUsePacs is true, otherwise it must be ignored. -Allowed Values: -- SECONDS, -- MINUTES, -- HOURS, -- DAYS, -- WEEKS`, - Type: schema.TypeString, - Optional: true, + Allowed Values: + - SECONDS, + - MINUTES, + - HOURS, + - DAYS, + - WEEKS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_fast_use_pacs_use_proactive_pac_update_precentage": &schema.Schema{ Description: `The eapFastUsePacsUseProactivePacUpdatePrecentage is required only if eapFastUsePacs is true, -otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "eap_tls": &schema.Schema{ - Description: `The eapTls is required only if allowEapTls is true, otherwise it must be ignored. The object eapTls contains the settings for EAP TLS protocol`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The eapTls is required only if allowEapTls is true, otherwise it must be ignored. The object eapTls contains the settings for EAP TLS protocol`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_eap_tls_auth_of_expired_certs": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_tls_enable_stateless_session_resume": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_tls_session_ticket_precentage": &schema.Schema{ Description: `The eapTlsSessionTicketPrecentage is required only if eapTlsEnableStatelessSessionResume is true, -otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_tls_session_ticket_ttl": &schema.Schema{ - Description: `Time to live. The eapTlsSessionTicketTtl is required only if eapTlsEnableStatelessSessionResume is true, otherwise it must be ignored`, - Type: schema.TypeInt, - Optional: true, + Description: `Time to live. The eapTlsSessionTicketTtl is required only if eapTlsEnableStatelessSessionResume is true, otherwise it must be ignored`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_tls_session_ticket_ttl_units": &schema.Schema{ Description: `Time to live time units. The eapTlsSessionTicketTtlUnits is required only if eapTlsEnableStatelessSessionResume is true, -otherwise it must be ignored. Allowed Values: -- SECONDS, -- MINUTES, -- HOURS, -- DAYS, -- WEEKS`, - Type: schema.TypeString, - Optional: true, + otherwise it must be ignored. Allowed Values: + - SECONDS, + - MINUTES, + - HOURS, + - DAYS, + - WEEKS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "eap_tls_l_bit": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls": &schema.Schema{ Description: `The eapTtls is required only if allowEapTtls is true, otherwise it must be ignored. -The object eapTtls contains the settings for EAP TTLS protocol`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + The object eapTtls contains the settings for EAP TTLS protocol`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "eap_ttls_chap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_eap_md5": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_eap_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_eap_ms_chap_v2_pwd_change": &schema.Schema{ - Description: `The eapTtlsEapMsChapV2PwdChange is required only if eapTtlsEapMsChapV2 is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The eapTtlsEapMsChapV2PwdChange is required only if eapTtlsEapMsChapV2 is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_eap_ms_chap_v2_pwd_change_retries": &schema.Schema{ Description: `The eapTtlsEapMsChapV2PwdChangeRetries is required only if eapTtlsEapMsChapV2 is true, -otherwise it must be ignored. Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored. Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap_ttls_ms_chap_v1": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "eap_ttls_pap_ascii": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Description: `Resource UUID, Mandatory for update`, - Type: schema.TypeString, - Optional: true, + Description: `Resource UUID, Mandatory for update`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "peap": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_peap_eap_gtc": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_eap_gtc_pwd_change": &schema.Schema{ - Description: `The allowPeapEapGtcPwdChange is required only if allowPeapEapGtc is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowPeapEapGtcPwdChange is required only if allowPeapEapGtc is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_eap_gtc_pwd_change_retries": &schema.Schema{ Description: `The allowPeapEapGtcPwdChangeRetries is required only if allowPeapEapGtc is true, -otherwise it must be ignored. Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored. Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_peap_eap_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_eap_ms_chap_v2_pwd_change": &schema.Schema{ Description: `The allowPeapEapMsChapV2PwdChange is required only if allowPeapEapMsChapV2 is true, -otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_eap_ms_chap_v2_pwd_change_retries": &schema.Schema{ Description: `The allowPeapEapMsChapV2PwdChangeRetries is required only if allowPeapEapMsChapV2 is true, -otherwise it must be ignored. Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored. Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_peap_eap_tls": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_eap_tls_auth_of_expired_certs": &schema.Schema{ - Description: `The allowPeapEapTlsAuthOfExpiredCerts is required only if allowPeapEapTls is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowPeapEapTlsAuthOfExpiredCerts is required only if allowPeapEapTls is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_peap_v0": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_cryptobinding": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "preferred_eap_protocol": &schema.Schema{ Description: `The preferredEapProtocol is required only if allowPreferredEapProtocol is true, otherwise it must be ignored. -Allowed Values: -- EAP_FAST, -- PEAP, -- LEAP, -- EAP_MD5, -- EAP_TLS, -- EAP_TTLS, -- TEAP`, - Type: schema.TypeString, - Optional: true, + Allowed Values: + - EAP_FAST, + - PEAP, + - LEAP, + - EAP_MD5, + - EAP_TLS, + - EAP_TTLS, + - TEAP`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "process_host_lookup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_message_auth": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "teap": &schema.Schema{ Description: `The teap is required only if allowTeap is true, otherwise it must be ignored. -The object teap contains the settings for TEAP protocol`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + The object teap contains the settings for TEAP protocol`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "accept_client_cert_during_tunnel_est": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_downgrade_msk": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_teap_eap_ms_chap_v2": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_teap_eap_ms_chap_v2_pwd_change": &schema.Schema{ - Description: `The allowTeapEapMsChapV2PwdChange is required only if allowTeapEapMsChapV2 is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowTeapEapMsChapV2PwdChange is required only if allowTeapEapMsChapV2 is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_teap_eap_ms_chap_v2_pwd_change_retries": &schema.Schema{ Description: `The allowTeapEapMsChapV2PwdChangeRetries is required only if allowTeapEapMsChapV2 is true, -otherwise it must be ignored. -Valid range is 0-3`, - Type: schema.TypeInt, - Optional: true, + otherwise it must be ignored. + Valid range is 0-3`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_teap_eap_tls": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_teap_eap_tls_auth_of_expired_certs": &schema.Schema{ - Description: `The allowTeapEapTlsAuthOfExpiredCerts is required only if allowTeapEapTls is true, otherwise it must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The allowTeapEapTlsAuthOfExpiredCerts is required only if allowTeapEapTls is true, otherwise it must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_eap_chaining": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1023,8 +1201,9 @@ Valid range is 0-3`, func resourceAllowedProtocolsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AllowedProtocols create") - client := m.(*isegosdk.Client) - + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -1037,24 +1216,26 @@ func resourceAllowedProtocolsCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.AllowedProtocols.GetAllowedProtocolByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAllowedProtocolsRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.AllowedProtocols.GetAllowedProtocolByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAllowedProtocolsRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.AllowedProtocols.GetAllowedProtocolByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAllowedProtocolsRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.AllowedProtocols.GetAllowedProtocolByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.AllowedProtocols.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAllowedProtocolsRead(ctx, d, m) + } } } restyResp1, err := client.AllowedProtocols.CreateAllowedProtocol(request1) @@ -1081,7 +1262,8 @@ func resourceAllowedProtocolsCreate(ctx context.Context, d *schema.ResourceData, func resourceAllowedProtocolsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AllowedProtocols read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1119,6 +1301,12 @@ func resourceAllowedProtocolsRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAllowedProtocolByName response", + err)) + return diags + } return diags } @@ -1145,6 +1333,12 @@ func resourceAllowedProtocolsRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAllowedProtocolByID response", + err)) + return diags + } return diags } @@ -1153,7 +1347,8 @@ func resourceAllowedProtocolsRead(ctx context.Context, d *schema.ResourceData, m func resourceAllowedProtocolsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AllowedProtocols update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1215,7 +1410,8 @@ func resourceAllowedProtocolsUpdate(ctx context.Context, d *schema.ResourceData, func resourceAllowedProtocolsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AllowedProtocols delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_anc_endpoint.go b/ciscoise/resource_anc_endpoint.go index 09ee79c6..f68ab435 100644 --- a/ciscoise/resource_anc_endpoint.go +++ b/ciscoise/resource_anc_endpoint.go @@ -58,9 +58,31 @@ func resourceAncEndpoint() *schema.Resource { DiffSuppressFunc: diffSupressMacAddress(), }, "policy_name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + ForceNew: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, @@ -113,8 +135,10 @@ func resourceAncEndpoint() *schema.Resource { func resourceAncEndpointCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncEndpoint create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -138,39 +162,41 @@ func resourceAncEndpointCreate(ctx context.Context, d *schema.ResourceData, m in if okPolicyName { vvPolicyName = vPolicyName.(string) } - if okID && vvID != "" { - response2, _, err := client.AncEndpoint.GetAncEndpointByID(vvID) - if err == nil && response2 != nil && response2.ErsAncEndpoint != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - if vvMacAddress == "" { - vvMacAddress = response2.ErsAncEndpoint.MacAddress - } - if vvPolicyName == "" { - vvPolicyName = response2.ErsAncEndpoint.PolicyName - } - resourceMap["ip_address"] = vvIpAddress - resourceMap["mac_address"] = vvMacAddress - resourceMap["policy_name"] = vvPolicyName - d.SetId(joinResourceID(resourceMap)) - return resourceAncEndpointRead(ctx, d, m) - } - } else { - queryParams1 := isegosdk.GetAncEndpointQueryParams{} - queryParams1.Filter = []string{fmt.Sprintf("name.EQ.%s", vvPolicyName)} - response1, _, err := client.AncEndpoint.GetAncEndpoint(&queryParams1) - if err == nil && response1 != nil { - items1 := getAllItemsAncEndpointGetAncEndpoint(m, response1, &queryParams1) - item1, err := searchAncEndpointGetAncEndpoint(m, items1, vvPolicyName, vvMacAddress, vvID) - if err == nil && item1 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + response2, _, err := client.AncEndpoint.GetAncEndpointByID(vvID) + if err == nil && response2 != nil && response2.ErsAncEndpoint != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID + if vvMacAddress == "" { + vvMacAddress = response2.ErsAncEndpoint.MacAddress + } + if vvPolicyName == "" { + vvPolicyName = response2.ErsAncEndpoint.PolicyName + } resourceMap["ip_address"] = vvIpAddress resourceMap["mac_address"] = vvMacAddress resourceMap["policy_name"] = vvPolicyName d.SetId(joinResourceID(resourceMap)) return resourceAncEndpointRead(ctx, d, m) } + } else { + queryParams1 := isegosdk.GetAncEndpointQueryParams{} + queryParams1.Filter = []string{fmt.Sprintf("name.EQ.%s", vvPolicyName)} + response1, _, err := client.AncEndpoint.GetAncEndpoint(&queryParams1) + if err == nil && response1 != nil { + items1 := getAllItemsAncEndpointGetAncEndpoint(m, response1, &queryParams1) + item1, err := searchAncEndpointGetAncEndpoint(m, items1, vvPolicyName, vvMacAddress, vvID) + if err == nil && item1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item1.ID + resourceMap["ip_address"] = vvIpAddress + resourceMap["mac_address"] = vvMacAddress + resourceMap["policy_name"] = vvPolicyName + d.SetId(joinResourceID(resourceMap)) + return resourceAncEndpointRead(ctx, d, m) + } + } } } additional_data := []isegosdk.RequestAncEndpointApplyAncEndpointOperationAdditionalDataAdditionalData{} @@ -197,6 +223,7 @@ func resourceAncEndpointCreate(ctx context.Context, d *schema.ResourceData, m in } operational_data := isegosdk.RequestAncEndpointApplyAncEndpointOperationAdditionalData{AdditionalData: &additional_data} request1 := &isegosdk.RequestAncEndpointApplyAncEndpoint{} + request1.OperationAdditionalData = &operational_data response1, err := client.AncEndpoint.ApplyAncEndpoint(request1) @@ -232,7 +259,8 @@ func resourceAncEndpointCreate(ctx context.Context, d *schema.ResourceData, m in func resourceAncEndpointRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncEndpoint read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -270,6 +298,12 @@ func resourceAncEndpointRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAncEndpoint response", + err)) + return diags + } return diags } if okID && vvID != "" { @@ -294,6 +328,12 @@ func resourceAncEndpointRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAncEndpointByID response", + err)) + return diags + } return diags } return diags @@ -308,7 +348,8 @@ func resourceAncEndpointUpdate(ctx context.Context, d *schema.ResourceData, m in func resourceAncEndpointDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncEndpoint delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -399,7 +440,8 @@ func resourceAncEndpointDelete(ctx context.Context, d *schema.ResourceData, m in } func getAllItemsAncEndpointGetAncEndpoint(m interface{}, response *isegosdk.ResponseAncEndpointGetAncEndpoint, queryParams *isegosdk.GetAncEndpointQueryParams) []isegosdk.ResponseAncEndpointGetAncEndpointSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseAncEndpointGetAncEndpointSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -425,7 +467,8 @@ func getAllItemsAncEndpointGetAncEndpoint(m interface{}, response *isegosdk.Resp } func searchAncEndpointGetAncEndpoint(m interface{}, items []isegosdk.ResponseAncEndpointGetAncEndpointSearchResultResources, name string, mac_address string, id string) (*isegosdk.ResponseAncEndpointGetAncEndpointByIDErsAncEndpoint, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseAncEndpointGetAncEndpointByIDErsAncEndpoint for _, item := range items { diff --git a/ciscoise/resource_anc_endpoint_bulk_request.go b/ciscoise/resource_anc_endpoint_bulk_request.go index e59209ac..d5c7a486 100644 --- a/ciscoise/resource_anc_endpoint_bulk_request.go +++ b/ciscoise/resource_anc_endpoint_bulk_request.go @@ -60,7 +60,8 @@ func resourceAncEndpointBulkRequest() *schema.Resource { func resourceAncEndpointBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForAncEndpoint create") log.Printf("[DEBUG] Missing BulkRequestForAncEndpoint create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestAncEndpointBulkRequestBulkRequestForAncEndpoint(ctx, "parameters.0", d) diff --git a/ciscoise/resource_anc_policy.go b/ciscoise/resource_anc_policy.go index 8e1f1187..eb3b0a0f 100644 --- a/ciscoise/resource_anc_policy.go +++ b/ciscoise/resource_anc_policy.go @@ -96,22 +96,49 @@ func resourceAncPolicy() *schema.Resource { "actions": &schema.Schema{ Description: `- QUARANTINE: Allows you to use Exception policies (authorization policies) to limit or deny an endpoint access to the network. -- PORTBOUNCE: Resets the port on the network device to which the endpoint is connected. -- SHUTDOWN : Shuts down the port on the network device to which the endpoint is connected. -- RE_AUTHENTICATE: Re-authenticates the session from the endpoint.`, - Type: schema.TypeList, - Optional: true, + - PORTBOUNCE: Resets the port on the network device to which the endpoint is connected. + - SHUTDOWN : Shuts down the port on the network device to which the endpoint is connected. + - RE_AUTHENTICATE: Re-authenticates the session from the endpoint.`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -122,8 +149,9 @@ func resourceAncPolicy() *schema.Resource { func resourceAncPolicyCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncPolicy create") - client := m.(*isegosdk.Client) - + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -136,24 +164,26 @@ func resourceAncPolicyCreate(ctx context.Context, d *schema.ResourceData, m inte vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.AncPolicy.GetAncPolicyByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAncPolicyRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.AncPolicy.GetAncPolicyByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAncPolicyRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.AncPolicy.GetAncPolicyByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAncPolicyRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.AncPolicy.GetAncPolicyByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.ErsAncPolicy.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAncPolicyRead(ctx, d, m) + } } } restyResp1, err := client.AncPolicy.CreateAncPolicy(request1) @@ -180,7 +210,8 @@ func resourceAncPolicyCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceAncPolicyRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncPolicy read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -218,6 +249,12 @@ func resourceAncPolicyRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAncPolicyByName response", + err)) + return diags + } return diags } @@ -244,6 +281,12 @@ func resourceAncPolicyRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAncPolicyByID response", + err)) + return diags + } return diags } @@ -252,7 +295,8 @@ func resourceAncPolicyRead(ctx context.Context, d *schema.ResourceData, m interf func resourceAncPolicyUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncPolicy update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -314,7 +358,8 @@ func resourceAncPolicyUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceAncPolicyDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AncPolicy delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_anc_policy_bulk_request.go b/ciscoise/resource_anc_policy_bulk_request.go index eb01d1ce..70d22382 100644 --- a/ciscoise/resource_anc_policy_bulk_request.go +++ b/ciscoise/resource_anc_policy_bulk_request.go @@ -60,7 +60,8 @@ func resourceAncPolicyBulkRequest() *schema.Resource { func resourceAncPolicyBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForAncPolicy create") log.Printf("[DEBUG] Missing BulkRequestForAncPolicy create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestAncPolicyBulkRequestBulkRequestForAncPolicy(ctx, "parameters.0", d) diff --git a/ciscoise/resource_authorization_profile.go b/ciscoise/resource_authorization_profile.go index bbc11323..b3b8079d 100644 --- a/ciscoise/resource_authorization_profile.go +++ b/ciscoise/resource_authorization_profile.go @@ -323,72 +323,96 @@ For all other 'WebRedirectionType' values the field must be ignored`, "access_type": &schema.Schema{ Description: `Allowed Values: -- ACCESS_ACCEPT, -- ACCESS_REJECT`, - Type: schema.TypeString, - Optional: true, + - ACCESS_ACCEPT, + - ACCESS_REJECT`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "acl": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "advanced_attributes": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "left_hand_side_dictionary_attribue": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "advanced_attribute_value_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "right_hand_side_attribue_value": &schema.Schema{ Description: `Attribute value can be of type AttributeValue or AdvancedDictionaryAttribute. -For AttributeValue the value is String, -For AdvancedDictionaryAttribute the value is dictionaryName and attributeName properties`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + For AttributeValue the value is String, + For AdvancedDictionaryAttribute the value is dictionaryName and attributeName properties`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "advanced_attribute_value_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -397,184 +421,270 @@ For AdvancedDictionaryAttribute the value is dictionaryName and attributeName pr }, }, "agentless_posture": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "airespace_acl": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "airespace_ipv6_acl": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "asa_vpn": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authz_profile_type": &schema.Schema{ Description: `Allowed Values: -- SWITCH, -- TRUSTSEC, -- TACACS -SWITCH is used for Standard Authorization Profiles`, - Type: schema.TypeString, - Optional: true, + - SWITCH, + - TRUSTSEC, + - TACACS + SWITCH is used for Standard Authorization Profiles`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "auto_smart_port": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "avc_profile": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dacl_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "easywired_session_candidate": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "id": &schema.Schema{ - Description: `Resource UUID value`, - Type: schema.TypeString, - Optional: true, + Description: `Resource UUID value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "interface_template": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ipv6_acl_filter": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ipv6_dacl_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "mac_sec_policy": &schema.Schema{ Description: `Allowed Values: -- MUST_SECURE, -- MUST_NOT_SECURE, -- SHOULD_SECURE`, - Type: schema.TypeString, - Optional: true, + - MUST_SECURE, + - MUST_NOT_SECURE, + - SHOULD_SECURE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Resource Name`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "neat": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "profile_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "reauth": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "connectivity": &schema.Schema{ Description: `Allowed Values: -- DEFAULT, -- RADIUS_REQUEST`, - Type: schema.TypeString, - Optional: true, + - DEFAULT, + - RADIUS_REQUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "timer": &schema.Schema{ - Description: `Valid range is 1-65535`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid range is 1-65535`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "service_template": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "track_movement": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "vlan": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "tag_id": &schema.Schema{ - Description: `Valid range is 0-31`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid range is 0-31`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "voice_domain_permission": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "web_auth": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "web_redirection": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "web_redirection_type": &schema.Schema{ Description: `Value MUST be one of the following:CentralizedWebAuth, HotSpot, NativeSupplicanProvisioning, ClientProvisioning. -The WebRedirectionType must fit the portalName`, - Type: schema.TypeString, - Optional: true, + The WebRedirectionType must fit the portalName`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "acl": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_certificates_renewal_messages": &schema.Schema{ Description: `The displayCertificatesRenewalMessages is mandatory when 'WebRedirectionType' value is 'CentralizedWebAuth'. -For all other 'WebRedirectionType' values the field must be ignored`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + For all other 'WebRedirectionType' values the field must be ignored`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "portal_name": &schema.Schema{ - Description: `A portal that exist in the DB and fits the WebRedirectionType`, - Type: schema.TypeString, - Optional: true, + Description: `A portal that exist in the DB and fits the WebRedirectionType`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "static_iphost_name_fqd_n": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -588,7 +698,9 @@ For all other 'WebRedirectionType' values the field must be ignored`, func resourceAuthorizationProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AuthorizationProfile create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -602,24 +714,27 @@ func resourceAuthorizationProfileCreate(ctx context.Context, d *schema.ResourceD vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.AuthorizationProfile.GetAuthorizationProfileByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAuthorizationProfileRead(ctx, d, m) + + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.AuthorizationProfile.GetAuthorizationProfileByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAuthorizationProfileRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.AuthorizationProfile.GetAuthorizationProfileByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceAuthorizationProfileRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.AuthorizationProfile.GetAuthorizationProfileByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.AuthorizationProfile.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceAuthorizationProfileRead(ctx, d, m) + } } } restyResp1, err := client.AuthorizationProfile.CreateAuthorizationProfile(request1) @@ -646,7 +761,8 @@ func resourceAuthorizationProfileCreate(ctx context.Context, d *schema.ResourceD func resourceAuthorizationProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AuthorizationProfile read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -684,6 +800,12 @@ func resourceAuthorizationProfileRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAuthorizationProfileByName response", + err)) + return diags + } return diags } @@ -710,6 +832,12 @@ func resourceAuthorizationProfileRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetAuthorizationProfileByID response", + err)) + return diags + } return diags } @@ -718,7 +846,8 @@ func resourceAuthorizationProfileRead(ctx context.Context, d *schema.ResourceDat func resourceAuthorizationProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AuthorizationProfile update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -780,7 +909,8 @@ func resourceAuthorizationProfileUpdate(ctx context.Context, d *schema.ResourceD func resourceAuthorizationProfileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AuthorizationProfile delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_backup_restore.go b/ciscoise/resource_backup_restore.go index 271a94fd..5c146130 100644 --- a/ciscoise/resource_backup_restore.go +++ b/ciscoise/resource_backup_restore.go @@ -110,7 +110,8 @@ to get the status of the backup job func resourceBackupRestoreCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RestoreConfigBackup create") log.Printf("[DEBUG] Missing RestoreConfigBackup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_backup_schedule_config.go b/ciscoise/resource_backup_schedule_config.go index 2964dbba..31e0babb 100644 --- a/ciscoise/resource_backup_schedule_config.go +++ b/ciscoise/resource_backup_schedule_config.go @@ -145,7 +145,8 @@ creating the schedule for the first time. func resourceBackupScheduleConfigCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CreateScheduledConfigBackup create") log.Printf("[DEBUG] Missing CreateScheduledConfigBackup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_backup_schedule_config_update.go b/ciscoise/resource_backup_schedule_config_update.go index 56e34cac..3a2ebef0 100644 --- a/ciscoise/resource_backup_schedule_config_update.go +++ b/ciscoise/resource_backup_schedule_config_update.go @@ -145,7 +145,8 @@ only helps in editing the schedule. func resourceBackupScheduleConfigUpdateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning UpdateScheduledConfigBackup create") log.Printf("[DEBUG] Missing UpdateScheduledConfigBackup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_bind_signed_certificate.go b/ciscoise/resource_bind_signed_certificate.go index 8fa818dd..dd228ff7 100644 --- a/ciscoise/resource_bind_signed_certificate.go +++ b/ciscoise/resource_bind_signed_certificate.go @@ -187,7 +187,8 @@ Request parameters accepting True and False as input can be replaced by 1 and 0 func resourceBindSignedCertificateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BindCsr create") log.Printf("[DEBUG] Missing BindCsr create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_byod_portal.go b/ciscoise/resource_byod_portal.go index ac473eab..bda80878 100644 --- a/ciscoise/resource_byod_portal.go +++ b/ciscoise/resource_byod_portal.go @@ -500,89 +500,109 @@ Allowed values: Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Description: `Defines all of the Portal Customizations available for a BYOD`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the Portal Customizations available for a BYOD`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Description: `Represent the portal Global customizations`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Represent the portal Global customizations`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -592,42 +612,52 @@ Allowed values: }, "language": &schema.Schema{ Description: `This property is supported only for Read operation and it allows to show the customizations in English. -Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Description: `Represent the entire page customization as a giant dictionary`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Represent the entire page customization as a giant dictionary`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `The Dictionary will be exposed here as key value pair`, - Type: schema.TypeList, - Optional: true, + Description: `The Dictionary will be exposed here as key value pair`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -636,57 +666,73 @@ Other languages are not supported`, }, }, "portal_theme": &schema.Schema{ - Description: `Defines the configuration for portal theme`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines the configuration for portal theme`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `The unique internal identifier of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The unique internal identifier of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -695,137 +741,195 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `Resource UUID, mandatory for update`, - Type: schema.TypeString, - Optional: true, + Description: `Resource UUID, mandatory for update`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a BYOD`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a BYOD`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "byod_settings": &schema.Schema{ - Description: `Configuration of BYOD Device Welcome, Registration and Success steps`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD Device Welcome, Registration and Success steps`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "byod_registration_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_point_identity_group_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "show_device_id": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "byod_registration_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Description: `Target URL for redirection, used when successRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Description: `Target URL for redirection, used when successRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ - Description: `After an Authentication Success where should device be redirected. Allowed values:`, - Type: schema.TypeString, - Optional: true, + Description: `After an Authentication Success where should device be redirected. Allowed values:`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "byod_welcome_settings": &schema.Schema{ - Description: `Configuration of BYOD endpoint welcome step configuration`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD endpoint welcome step configuration`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_byo_d": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_guest_access": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_mdm": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Description: `Require BYOD devices to scroll down to the bottom of the AUP, Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require BYOD devices to scroll down to the bottom of the AUP, Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -834,117 +938,149 @@ Allowed values: }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0, -- eth1, -- eth2, -- eth3, -- eth4, -- eth5, -- bond0, -- bond1, -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0, + - eth1, + - eth2, + - eth3, + - eth4, + - eth5, + - bond0, + - bond1, + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "always_used_language": &schema.Schema{ - Description: `Used when displayLang = ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "endpoint_identity_group": &schema.Schema{ - Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ - Description: `The port number that the allowed interfaces will listen on. Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Description: `The port number that the allowed interfaces will listen on. Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. -Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -961,7 +1097,9 @@ Allowed values: func resourceByodPortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ByodPortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -975,29 +1113,31 @@ func resourceByodPortalCreate(ctx context.Context, d *schema.ResourceData, m int vName, _ := resourceItem["name"] vvID := interfaceToString(vID) vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.ByodPortal.GetByodPortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceByodPortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetByodPortalQueryParams{} - - response2, _, err := client.ByodPortal.GetByodPortal(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsByodPortalGetByodPortal(m, response2, &queryParams2) - item2, err := searchByodPortalGetByodPortal(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.ByodPortal.GetByodPortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceByodPortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetByodPortalQueryParams{} + + response2, _, err := client.ByodPortal.GetByodPortal(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsByodPortalGetByodPortal(m, response2, &queryParams2) + item2, err := searchByodPortalGetByodPortal(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceByodPortalRead(ctx, d, m) + } + } } } restyResp1, err := client.ByodPortal.CreateByodPortal(request1) @@ -1024,7 +1164,8 @@ func resourceByodPortalCreate(ctx context.Context, d *schema.ResourceData, m int func resourceByodPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ByodPortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1070,6 +1211,18 @@ func resourceByodPortalRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetByodPortal search response", + err)) + return diags + } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetByodPortal search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -1095,6 +1248,12 @@ func resourceByodPortalRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetByodPortalByID response", + err)) + return diags + } return diags } @@ -1103,7 +1262,8 @@ func resourceByodPortalRead(ctx context.Context, d *schema.ResourceData, m inter func resourceByodPortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ByodPortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1167,7 +1327,8 @@ func resourceByodPortalUpdate(ctx context.Context, d *schema.ResourceData, m int func resourceByodPortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ByodPortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1998,7 +2159,8 @@ func expandRequestByodPortalUpdateByodPortalByIDByodPortalCustomizationsPageCust } func getAllItemsByodPortalGetByodPortal(m interface{}, response *isegosdk.ResponseByodPortalGetByodPortal, queryParams *isegosdk.GetByodPortalQueryParams) []isegosdk.ResponseByodPortalGetByodPortalSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseByodPortalGetByodPortalSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -2026,7 +2188,8 @@ func getAllItemsByodPortalGetByodPortal(m interface{}, response *isegosdk.Respon } func searchByodPortalGetByodPortal(m interface{}, items []isegosdk.ResponseByodPortalGetByodPortalSearchResultResources, name string, id string) (*isegosdk.ResponseByodPortalGetByodPortalByIDByodPortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseByodPortalGetByodPortalByIDByodPortal for _, item := range items { diff --git a/ciscoise/resource_certificate_profile.go b/ciscoise/resource_certificate_profile.go index e195a325..6f4a54de 100644 --- a/ciscoise/resource_certificate_profile.go +++ b/ciscoise/resource_certificate_profile.go @@ -106,57 +106,94 @@ func resourceCertificateProfile() *schema.Resource { Schema: map[string]*schema.Schema{ "allowed_as_user_name": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "certificate_attribute_name": &schema.Schema{ Description: `Attribute name of the Certificate Profile - used only when CERTIFICATE is chosen in usernameFrom. -Allowed values: -- SUBJECT_COMMON_NAME -- SUBJECT_ALTERNATIVE_NAME -- SUBJECT_SERIAL_NUMBER -- SUBJECT -- SUBJECT_ALTERNATIVE_NAME_OTHER_NAME -- SUBJECT_ALTERNATIVE_NAME_EMAIL -- SUBJECT_ALTERNATIVE_NAME_DNS. -- Additional internal value ALL_SUBJECT_AND_ALTERNATIVE_NAMES is used automatically when usernameFrom=UPN`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - SUBJECT_COMMON_NAME + - SUBJECT_ALTERNATIVE_NAME + - SUBJECT_SERIAL_NUMBER + - SUBJECT + - SUBJECT_ALTERNATIVE_NAME_OTHER_NAME + - SUBJECT_ALTERNATIVE_NAME_EMAIL + - SUBJECT_ALTERNATIVE_NAME_DNS. + - Additional internal value ALL_SUBJECT_AND_ALTERNATIVE_NAMES is used automatically when usernameFrom=UPN`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "external_identity_store_name": &schema.Schema{ - Description: `Referred IDStore name for the Certificate Profile or [not applicable] in case no identity store is chosen`, - Type: schema.TypeString, - Optional: true, + Description: `Referred IDStore name for the Certificate Profile or [not applicable] in case no identity store is chosen`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "match_mode": &schema.Schema{ Description: `Match mode of the Certificate Profile. -Allowed values: -- NEVER -- RESOLVE_IDENTITY_AMBIGUITY -- BINARY_COMPARISON`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - NEVER + - RESOLVE_IDENTITY_AMBIGUITY + - BINARY_COMPARISON`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "username_from": &schema.Schema{ Description: `The attribute in the certificate where the user name should be taken from. -Allowed values: -- CERTIFICATE (for a specific attribute as defined in certificateAttributeName) -- UPN (for using any Subject or Alternative Name Attributes in the Certificate - an option only in AD)`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - CERTIFICATE (for a specific attribute as defined in certificateAttributeName) + - UPN (for using any Subject or Alternative Name Attributes in the Certificate - an option only in AD)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -167,7 +204,9 @@ Allowed values: func resourceCertificateProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CertificateProfile create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -181,24 +220,26 @@ func resourceCertificateProfileCreate(ctx context.Context, d *schema.ResourceDat vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.CertificateProfile.GetCertificateProfileByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceCertificateProfileRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.CertificateProfile.GetCertificateProfileByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceCertificateProfileRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.CertificateProfile.GetCertificateProfileByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceCertificateProfileRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.CertificateProfile.GetCertificateProfileByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.CertificateProfile.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceCertificateProfileRead(ctx, d, m) + } } } restyResp1, err := client.CertificateProfile.CreateCertificateProfile(request1) @@ -225,7 +266,8 @@ func resourceCertificateProfileCreate(ctx context.Context, d *schema.ResourceDat func resourceCertificateProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CertificateProfile read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -263,6 +305,12 @@ func resourceCertificateProfileRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetCertificateProfileByName response", + err)) + return diags + } return diags } @@ -289,6 +337,12 @@ func resourceCertificateProfileRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetCertificateProfileByID response", + err)) + return diags + } return diags } @@ -297,7 +351,8 @@ func resourceCertificateProfileRead(ctx context.Context, d *schema.ResourceData, func resourceCertificateProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CertificateProfile update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_device_administration_authentication_reset_hitcount.go b/ciscoise/resource_device_administration_authentication_reset_hitcount.go index 004cc8e0..6b38291b 100644 --- a/ciscoise/resource_device_administration_authentication_reset_hitcount.go +++ b/ciscoise/resource_device_administration_authentication_reset_hitcount.go @@ -64,7 +64,8 @@ func resourceDeviceAdministrationAuthenticationResetHitcount() *schema.Resource func resourceDeviceAdministrationAuthenticationResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsDeviceAdminAuthenticationRules create") log.Printf("[DEBUG] Missing ResetHitCountsDeviceAdminAuthenticationRules create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_device_administration_authentication_rules.go b/ciscoise/resource_device_administration_authentication_rules.go index afd4eec5..2578065e 100644 --- a/ciscoise/resource_device_administration_authentication_rules.go +++ b/ciscoise/resource_device_administration_authentication_rules.go @@ -364,247 +364,266 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "identity_source_id": &schema.Schema{ + Description: `Identity source id from the identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_source_name": &schema.Schema{ - Description: `Identity source name from the identity stores`, - Type: schema.TypeString, - Optional: true, + Description: `Identity source name from the identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_auth_fail": &schema.Schema{ - Description: `Action to perform when authentication fails such as Bad credentials, disabled user and so on`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when authentication fails such as Bad credentials, disabled user and so on`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_process_fail": &schema.Schema{ - Description: `Action to perform when ISE is uanble to access the identity database`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when ISE is uanble to access the identity database`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_user_not_found": &schema.Schema{ - Description: `Action to perform when user is not found in any of identity stores`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when user is not found in any of identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, + Description: `policyId path parameter. Policy id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -618,7 +637,9 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceDeviceAdministrationAuthenticationRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthenticationRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -631,8 +652,9 @@ func resourceDeviceAdministrationAuthenticationRulesCreate(ctx context.Context, vPolicyID, okPolicyID := resourceItem["policy_id"] vvPolicyID := interfaceToString(vPolicyID) vID, okID := resourceItem["id"] - + var vvID string var vvName string + if !okID || vID == "" { if _, ok := d.GetOk("parameters.0.rule"); ok { if v, ok2 := d.GetOk("parameters.0.rule.0.id"); ok2 { @@ -641,28 +663,16 @@ func resourceDeviceAdministrationAuthenticationRulesCreate(ctx context.Context, } } } - vvID := interfaceToString(vID) + vvID = interfaceToString(vID) if _, ok := d.GetOk("parameters.0.rule"); ok { if v, ok2 := d.GetOk("parameters.0.rule.0.name"); ok2 { vvName = interfaceToString(v) } } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationAuthenticationRules.GetDeviceAdminAuthenticationRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationAuthenticationRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationAuthenticationRules.GetDeviceAdminAuthenticationRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRules(m, response2, vvPolicyID) - item2, err := searchDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationAuthenticationRules.GetDeviceAdminAuthenticationRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -670,6 +680,20 @@ func resourceDeviceAdministrationAuthenticationRulesCreate(ctx context.Context, d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationAuthenticationRulesRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationAuthenticationRules.GetDeviceAdminAuthenticationRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRules(m, response2, vvPolicyID) + item2, err := searchDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationAuthenticationRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationAuthenticationRules.CreateDeviceAdminAuthenticationRule(vvPolicyID, request1) @@ -698,7 +722,8 @@ func resourceDeviceAdministrationAuthenticationRulesCreate(ctx context.Context, func resourceDeviceAdministrationAuthenticationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthenticationRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -759,6 +784,12 @@ func resourceDeviceAdministrationAuthenticationRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminAuthenticationRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -782,6 +813,12 @@ func resourceDeviceAdministrationAuthenticationRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminAuthenticationRuleByID response", + err)) + return diags + } return diags } @@ -790,7 +827,8 @@ func resourceDeviceAdministrationAuthenticationRulesRead(ctx context.Context, d func resourceDeviceAdministrationAuthenticationRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthenticationRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -868,7 +906,8 @@ func resourceDeviceAdministrationAuthenticationRulesUpdate(ctx context.Context, func resourceDeviceAdministrationAuthenticationRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthenticationRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1474,7 +1513,8 @@ func getAllItemsDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticat } func searchDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRules(m interface{}, items []isegosdk.ResponseDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationAuthenticationRulesGetDeviceAdminAuthenticationRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_authorization_reset_hitcount.go b/ciscoise/resource_device_administration_authorization_reset_hitcount.go index c7961d63..34d61b27 100644 --- a/ciscoise/resource_device_administration_authorization_reset_hitcount.go +++ b/ciscoise/resource_device_administration_authorization_reset_hitcount.go @@ -63,7 +63,8 @@ func resourceDeviceAdministrationAuthorizationResetHitcount() *schema.Resource { func resourceDeviceAdministrationAuthorizationResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsDeviceAdminAuthorizationRules create") log.Printf("[DEBUG] Missing ResetHitCountsDeviceAdminAuthorizationRules create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_device_administration_authorization_rules.go b/ciscoise/resource_device_administration_authorization_rules.go index 0be90e62..c4ffabba 100644 --- a/ciscoise/resource_device_administration_authorization_rules.go +++ b/ciscoise/resource_device_administration_authorization_rules.go @@ -356,240 +356,249 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "commands": &schema.Schema{ - Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, - Type: schema.TypeList, - Optional: true, + Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, - "profile": &schema.Schema{ - Description: `Device admin profiles control the initial login session of the device administrator`, - Type: schema.TypeString, - Optional: true, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, + Description: `policyId path parameter. Policy id`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "profile": &schema.Schema{ + Description: `Device admin profiles control the initial login session of the device administrator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -603,7 +612,9 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceDeviceAdministrationAuthorizationRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthorizationRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -616,7 +627,9 @@ func resourceDeviceAdministrationAuthorizationRulesCreate(ctx context.Context, d vPolicyID, okPolicyID := resourceItem["policy_id"] vvPolicyID := interfaceToString(vPolicyID) vID, okID := resourceItem["id"] + var vvID string var vvName string + if !okID || vID == "" { if _, ok := d.GetOk("parameters.0.rule"); ok { if v, ok2 := d.GetOkExists("parameters.0.rule.0.id"); ok2 { @@ -625,28 +638,17 @@ func resourceDeviceAdministrationAuthorizationRulesCreate(ctx context.Context, d } } } - vvID := interfaceToString(vID) + vvID = interfaceToString(vID) if _, ok := d.GetOk("parameters.0.rule"); ok { if v, ok2 := d.GetOkExists("parameters.0.rule.0.name"); ok2 { vvName = interfaceToString(v) } } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationAuthorizationRules.GetDeviceAdminAuthorizationRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationAuthorizationRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationAuthorizationRules.GetDeviceAdminAuthorizationRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRules(m, response2, vvPolicyID) - item2, err := searchDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + + if isEnableAutoImport { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationAuthorizationRules.GetDeviceAdminAuthorizationRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -654,6 +656,20 @@ func resourceDeviceAdministrationAuthorizationRulesCreate(ctx context.Context, d d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationAuthorizationRulesRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationAuthorizationRules.GetDeviceAdminAuthorizationRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRules(m, response2, vvPolicyID) + item2, err := searchDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationAuthorizationRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationAuthorizationRules.CreateDeviceAdminAuthorizationRule(vvPolicyID, request1) @@ -682,7 +698,8 @@ func resourceDeviceAdministrationAuthorizationRulesCreate(ctx context.Context, d func resourceDeviceAdministrationAuthorizationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthorizationRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -743,6 +760,12 @@ func resourceDeviceAdministrationAuthorizationRulesRead(ctx context.Context, d * err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminAuthorizationRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -769,6 +792,12 @@ func resourceDeviceAdministrationAuthorizationRulesRead(ctx context.Context, d * err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminAuthorizationRuleByID response", + err)) + return diags + } return diags } @@ -777,7 +806,8 @@ func resourceDeviceAdministrationAuthorizationRulesRead(ctx context.Context, d * func resourceDeviceAdministrationAuthorizationRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthorizationRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -856,7 +886,8 @@ func resourceDeviceAdministrationAuthorizationRulesUpdate(ctx context.Context, d func resourceDeviceAdministrationAuthorizationRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationAuthorizationRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1445,7 +1476,8 @@ func getAllItemsDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizatio } func searchDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRules(m interface{}, items []isegosdk.ResponseDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationAuthorizationRulesGetDeviceAdminAuthorizationRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_conditions.go b/ciscoise/resource_device_administration_conditions.go index e4e9b4cc..b8ef4e65 100644 --- a/ciscoise/resource_device_administration_conditions.go +++ b/ciscoise/resource_device_administration_conditions.go @@ -298,169 +298,148 @@ TimeAndDate Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "id": &schema.Schema{ + Description: `id path parameter. Condition id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + Description: `name path parameter. Condition name`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, }, }, @@ -471,8 +450,9 @@ TimeAndDate func resourceDeviceAdministrationConditionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationConditions create") - client := m.(*isegosdk.Client) - + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -485,24 +465,26 @@ func resourceDeviceAdministrationConditionsCreate(ctx context.Context, d *schema vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.DeviceAdministrationConditions.GetDeviceAdminConditionByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationConditionsRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.DeviceAdministrationConditions.GetDeviceAdminConditionByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationConditionsRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.DeviceAdministrationConditions.GetDeviceAdminConditionByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationConditionsRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.DeviceAdministrationConditions.GetDeviceAdminConditionByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.Response.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationConditionsRead(ctx, d, m) + } } } resp1, restyResp1, err := client.DeviceAdministrationConditions.CreateDeviceAdminCondition(request1) @@ -531,7 +513,8 @@ func resourceDeviceAdministrationConditionsCreate(ctx context.Context, d *schema func resourceDeviceAdministrationConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationConditions read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -569,6 +552,12 @@ func resourceDeviceAdministrationConditionsRead(ctx context.Context, d *schema.R err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminConditionByName response", + err)) + return diags + } return diags } @@ -595,6 +584,12 @@ func resourceDeviceAdministrationConditionsRead(ctx context.Context, d *schema.R err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminConditionByID response", + err)) + return diags + } return diags } @@ -603,7 +598,8 @@ func resourceDeviceAdministrationConditionsRead(ctx context.Context, d *schema.R func resourceDeviceAdministrationConditionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationConditions update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -665,7 +661,8 @@ func resourceDeviceAdministrationConditionsUpdate(ctx context.Context, d *schema func resourceDeviceAdministrationConditionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationConditions delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_device_administration_global_exception_rules.go b/ciscoise/resource_device_administration_global_exception_rules.go index b110ea5c..638cd93f 100644 --- a/ciscoise/resource_device_administration_global_exception_rules.go +++ b/ciscoise/resource_device_administration_global_exception_rules.go @@ -352,235 +352,242 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "commands": &schema.Schema{ - Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, - Type: schema.TypeList, - Optional: true, + Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "profile": &schema.Schema{ - Description: `Device admin profiles control the initial login session of the device administrator`, - Type: schema.TypeString, - Optional: true, + Description: `Device admin profiles control the initial login session of the device administrator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -594,7 +601,9 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceDeviceAdministrationGlobalExceptionRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationGlobalExceptionRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -606,6 +615,8 @@ func resourceDeviceAdministrationGlobalExceptionRulesCreate(ctx context.Context, vID, okID := resourceItem["id"] var vvName string + var vvID string + if !okID || vID == "" { if _, ok := d.GetOkExists("parameters.0.rule"); ok { if v, ok2 := d.GetOkExists("parameters.0.rule.0.id"); ok2 { @@ -614,33 +625,35 @@ func resourceDeviceAdministrationGlobalExceptionRulesCreate(ctx context.Context, } } } - vvID := interfaceToString(vID) + vvID = interfaceToString(vID) if _, ok := d.GetOkExists("parameters.0.rule"); ok { if v, ok2 := d.GetOkExists("parameters.0.rule.0.name"); ok2 { vvName = interfaceToString(v) } } - if okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationAuthorizationGlobalExceptionRules.GetDeviceAdminPolicySetGlobalExceptionByRuleID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationGlobalExceptionRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationAuthorizationGlobalExceptionRules.GetDeviceAdminPolicySetGlobalExceptionRules() - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRules(m, response2) - item2, err := searchDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRules(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationAuthorizationGlobalExceptionRules.GetDeviceAdminPolicySetGlobalExceptionByRuleID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationGlobalExceptionRulesRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationAuthorizationGlobalExceptionRules.GetDeviceAdminPolicySetGlobalExceptionRules() + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRules(m, response2) + item2, err := searchDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRules(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.Rule.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationGlobalExceptionRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationAuthorizationGlobalExceptionRules.CreateDeviceAdminPolicySetGlobalException(request1) @@ -669,7 +682,8 @@ func resourceDeviceAdministrationGlobalExceptionRulesCreate(ctx context.Context, func resourceDeviceAdministrationGlobalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationGlobalExceptionRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -728,6 +742,12 @@ func resourceDeviceAdministrationGlobalExceptionRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminPolicySetGlobalExceptionRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -751,6 +771,12 @@ func resourceDeviceAdministrationGlobalExceptionRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminPolicySetGlobalExceptionByRuleID response", + err)) + return diags + } return diags } @@ -759,7 +785,8 @@ func resourceDeviceAdministrationGlobalExceptionRulesRead(ctx context.Context, d func resourceDeviceAdministrationGlobalExceptionRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationGlobalExceptionRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -836,7 +863,8 @@ func resourceDeviceAdministrationGlobalExceptionRulesUpdate(ctx context.Context, func resourceDeviceAdministrationGlobalExceptionRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationGlobalExceptionRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1423,7 +1451,8 @@ func getAllItemsDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAd } func searchDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRules(m interface{}, items []isegosdk.ResponseDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionRulesResponse, name string, id string) (*isegosdk.ResponseDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionByRuleIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationAuthorizationGlobalExceptionRulesGetDeviceAdminPolicySetGlobalExceptionByRuleIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_global_exception_rules_reset_hitcount.go b/ciscoise/resource_device_administration_global_exception_rules_reset_hitcount.go index 0084c810..4eb0c1a8 100644 --- a/ciscoise/resource_device_administration_global_exception_rules_reset_hitcount.go +++ b/ciscoise/resource_device_administration_global_exception_rules_reset_hitcount.go @@ -56,7 +56,8 @@ func resourceDeviceAdministrationGlobalExceptionRulesResetHitcount() *schema.Res func resourceDeviceAdministrationGlobalExceptionRulesResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsDeviceAdminGlobalExceptions create") log.Printf("[DEBUG] Missing ResetHitCountsDeviceAdminGlobalExceptions create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics d.Set("parameters", nil) diff --git a/ciscoise/resource_device_administration_local_exception_rules.go b/ciscoise/resource_device_administration_local_exception_rules.go index 6869e9bf..526e9b84 100644 --- a/ciscoise/resource_device_administration_local_exception_rules.go +++ b/ciscoise/resource_device_administration_local_exception_rules.go @@ -357,241 +357,242 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "commands": &schema.Schema{ - Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, - Type: schema.TypeList, - Optional: true, + Description: `Command sets enforce the specified list of commands that can be executed by a device administrator`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ - "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "profile": &schema.Schema{ - Description: `Device admin profiles control the initial login session of the device administrator`, - Type: schema.TypeString, - Optional: true, + Description: `Device admin profiles control the initial login session of the device administrator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -605,7 +606,9 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceDeviceAdministrationLocalExceptionRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationLocalExceptionRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -619,37 +622,26 @@ func resourceDeviceAdministrationLocalExceptionRulesCreate(ctx context.Context, vvPolicyID := interfaceToString(vPolicyID) vID, okID := resourceItem["id"] var vvName string - if !okID || vID == "" { - if _, ok := d.GetOkExists("parameters.0.rule"); ok { - if v, ok2 := d.GetOkExists("parameters.0.rule.0.id"); ok2 { - vID = interfaceToString(v) - okID = ok2 + var vvID string + if isEnableAutoImport { + if !okID || vID == "" { + if _, ok := d.GetOkExists("parameters.0.rule"); ok { + if v, ok2 := d.GetOkExists("parameters.0.rule.0.id"); ok2 { + vID = interfaceToString(v) + okID = ok2 + } } } - } - vvID := interfaceToString(vID) - if _, ok := d.GetOkExists("parameters.0.rule"); ok { - if v, ok2 := d.GetOkExists("parameters.0.rule.0.name"); ok2 { - vvName = interfaceToString(v) + vvID = interfaceToString(vID) + if _, ok := d.GetOkExists("parameters.0.rule"); ok { + if v, ok2 := d.GetOkExists("parameters.0.rule.0.name"); ok2 { + vvName = interfaceToString(v) + } } - } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationAuthorizationExceptionRules.GetDeviceAdminLocalExceptionRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationLocalExceptionRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationAuthorizationExceptionRules.GetDeviceAdminLocalExceptionRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRules(m, response2, vvPolicyID) - item2, err := searchDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationAuthorizationExceptionRules.GetDeviceAdminLocalExceptionRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -657,6 +649,20 @@ func resourceDeviceAdministrationLocalExceptionRulesCreate(ctx context.Context, d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationLocalExceptionRulesRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationAuthorizationExceptionRules.GetDeviceAdminLocalExceptionRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRules(m, response2, vvPolicyID) + item2, err := searchDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationLocalExceptionRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationAuthorizationExceptionRules.CreateDeviceAdminLocalExceptionRule(vvPolicyID, request1) @@ -686,7 +692,8 @@ func resourceDeviceAdministrationLocalExceptionRulesCreate(ctx context.Context, func resourceDeviceAdministrationLocalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationLocalExceptionRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -747,6 +754,12 @@ func resourceDeviceAdministrationLocalExceptionRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminLocalExceptionRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -770,6 +783,12 @@ func resourceDeviceAdministrationLocalExceptionRulesRead(ctx context.Context, d err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminLocalExceptionRuleByID response", + err)) + return diags + } return diags } @@ -778,7 +797,8 @@ func resourceDeviceAdministrationLocalExceptionRulesRead(ctx context.Context, d func resourceDeviceAdministrationLocalExceptionRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationLocalExceptionRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -857,7 +877,8 @@ func resourceDeviceAdministrationLocalExceptionRulesUpdate(ctx context.Context, func resourceDeviceAdministrationLocalExceptionRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationLocalExceptionRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1446,7 +1467,8 @@ func getAllItemsDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLoc } func searchDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRules(m interface{}, items []isegosdk.ResponseDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationAuthorizationExceptionRulesGetDeviceAdminLocalExceptionRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_local_exception_rules_reset_hitcount.go b/ciscoise/resource_device_administration_local_exception_rules_reset_hitcount.go index 8fe3933d..176a4939 100644 --- a/ciscoise/resource_device_administration_local_exception_rules_reset_hitcount.go +++ b/ciscoise/resource_device_administration_local_exception_rules_reset_hitcount.go @@ -63,7 +63,8 @@ func resourceDeviceAdministrationLocalExceptionRulesResetHitcount() *schema.Reso func resourceDeviceAdministrationLocalExceptionRulesResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsDeviceAdminLocalExceptions create") log.Printf("[DEBUG] Missing ResetHitCountsDeviceAdminLocalExceptions create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_device_administration_network_conditions.go b/ciscoise/resource_device_administration_network_conditions.go index 1472fb38..6071f583 100644 --- a/ciscoise/resource_device_administration_network_conditions.go +++ b/ciscoise/resource_device_administration_network_conditions.go @@ -183,91 +183,133 @@ func resourceDeviceAdministrationNetworkConditions() *schema.Resource { Schema: map[string]*schema.Schema{ "condition_type": &schema.Schema{ - Description: `This field determines the content of the conditions field`, - Type: schema.TypeString, - Optional: true, + Description: `This field determines the content of the conditions field`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "conditions": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cli_dnis_list": &schema.Schema{ - Description: `

This field should contain a Caller ID (CLI), comma, and Called ID (DNIS).
Line format - Caller ID (CLI), Called ID (DNIS)

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain a Caller ID (CLI), comma, and Called ID (DNIS).
Line format - Caller ID (CLI), Called ID (DNIS)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "condition_type": &schema.Schema{ - Description: `This field determines the content of the conditions field`, - Type: schema.TypeString, - Optional: true, - }, - "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, "device_group_list": &schema.Schema{ - Description: `

This field should contain a tuple with NDG Root, comma, and an NDG (that it under the root).
Line format - NDG Root Name, NDG, Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain a tuple with NDG Root, comma, and an NDG (that it under the root).
Line format - NDG Root Name, NDG, Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "device_list": &schema.Schema{ - Description: `

This field should contain Device-Name,port-number. The device name must be the same as the name field in a Network Device object.
Line format - Device Name,Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain Device-Name,port-number. The device name must be the same as the name field in a Network Device object.
Line format - Device Name,Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, "ip_addr_list": &schema.Schema{ - Description: `

This field should contain IP-address-or-subnet,port number
IP address can be IPV4 format (n.n.n.n) or IPV6 format (n:n:n:n:n:n:n:n).
IP subnet can be IPV4 format (n.n.n.n/m) or IPV6 format (n:n:n:n:n:n:n:n/m).
Line format - IP Address or subnet,Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain IP-address-or-subnet,port number
IP address can be IPV4 format (n.n.n.n) or IPV6 format (n:n:n:n:n:n:n:n).
IP subnet can be IPV4 format (n.n.n.n/m) or IPV6 format (n:n:n:n:n:n:n:n/m).
Line format - IP Address or subnet,Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "mac_addr_list": &schema.Schema{ - Description: `

This field should contain Endstation MAC address, comma, and Destination MAC addresses.
Each Max address must include twelve hexadecimal digits using formats nn:nn:nn:nn:nn:nn or nn-nn-nn-nn-nn-nn or nnnn.nnnn.nnnn or nnnnnnnnnnnn.
Line format - Endstation MAC,Destination MAC

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain Endstation MAC address, comma, and Destination MAC addresses.
Each Max address must include twelve hexadecimal digits using formats nn:nn:nn:nn:nn:nn or nn-nn-nn-nn-nn-nn or nnnn.nnnn.nnnn or nnnnnnnnnnnn.
Line format - Endstation MAC,Destination MAC

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "name": &schema.Schema{ - Description: `Network Condition name`, - Type: schema.TypeString, - Optional: true, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "name": &schema.Schema{ - Description: `Network Condition name`, - Type: schema.TypeString, - Optional: true, + Description: `Network Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -278,7 +320,9 @@ func resourceDeviceAdministrationNetworkConditions() *schema.Resource { func resourceDeviceAdministrationNetworkConditionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationNetworkConditions create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -292,28 +336,29 @@ func resourceDeviceAdministrationNetworkConditionsCreate(ctx context.Context, d vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - - if okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationNetworkConditions.GetDeviceAdminNetworkConditionByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationNetworkConditionsRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationNetworkConditions.GetDeviceAdminNetworkConditions() - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditions(m, response2) - item2, err := searchDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditions(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationNetworkConditions.GetDeviceAdminNetworkConditionByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationNetworkConditionsRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationNetworkConditions.GetDeviceAdminNetworkConditions() + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditions(m, response2) + item2, err := searchDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditions(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationNetworkConditionsRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationNetworkConditions.CreateDeviceAdminNetworkCondition(request1) @@ -342,7 +387,8 @@ func resourceDeviceAdministrationNetworkConditionsCreate(ctx context.Context, d func resourceDeviceAdministrationNetworkConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationNetworkConditions read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -386,6 +432,12 @@ func resourceDeviceAdministrationNetworkConditionsRead(ctx context.Context, d *s err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminNetworkConditions search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -411,6 +463,12 @@ func resourceDeviceAdministrationNetworkConditionsRead(ctx context.Context, d *s err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminNetworkConditionByID response", + err)) + return diags + } return diags } @@ -419,7 +477,8 @@ func resourceDeviceAdministrationNetworkConditionsRead(ctx context.Context, d *s func resourceDeviceAdministrationNetworkConditionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationNetworkConditions update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -481,7 +540,8 @@ func resourceDeviceAdministrationNetworkConditionsUpdate(ctx context.Context, d func resourceDeviceAdministrationNetworkConditionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationNetworkConditions delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -785,7 +845,8 @@ func getAllItemsDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkCondit } func searchDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditions(m interface{}, items []isegosdk.ResponseDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditionsResponse, name string, id string) (*isegosdk.ResponseDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditionByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationNetworkConditionsGetDeviceAdminNetworkConditionByIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_policy_set.go b/ciscoise/resource_device_administration_policy_set.go index 6a72c70e..fa21fe5b 100644 --- a/ciscoise/resource_device_administration_policy_set.go +++ b/ciscoise/resource_device_administration_policy_set.go @@ -342,226 +342,231 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }}, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Flag which indicates if this policy set is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Flag which indicates if this policy set is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Description: `The description for the policy set`, - Type: schema.TypeString, - Optional: true, + Description: `The description for the policy set`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the policy was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the policy was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `Identifier for the policy set`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the policy set`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_proxy": &schema.Schema{ - Description: `Flag which indicates if the policy set service is of type 'Proxy Sequence' or 'Allowed Protocols'`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Flag which indicates if the policy set service is of type 'Proxy Sequence' or 'Allowed Protocols'`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "name": &schema.Schema{ - Description: `Given name for the policy set, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Given name for the policy set, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other policy set. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other policy set. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "service_name": &schema.Schema{ - Description: `Policy set service identifier - Allowed Protocols,Server Sequence..`, - Type: schema.TypeString, - Optional: true, + Description: `Policy set service identifier - Allowed Protocols,Server Sequence..`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the policy set is in. A disabled policy set cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the policy set is in. A disabled policy set cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -572,8 +577,9 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceDeviceAdministrationPolicySetCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationPolicySet create") - client := m.(*isegosdk.Client) - + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -586,27 +592,29 @@ func resourceDeviceAdministrationPolicySetCreate(ctx context.Context, d *schema. vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationPolicySet.GetDeviceAdminPolicySetByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationPolicySetRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationPolicySet.GetDeviceAdminPolicySets() - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m, response2) - item2, err := searchDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationPolicySet.GetDeviceAdminPolicySetByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationPolicySetRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationPolicySet.GetDeviceAdminPolicySets() + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m, response2) + item2, err := searchDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationPolicySetRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationPolicySet.CreateDeviceAdminPolicySet(request1) @@ -635,7 +643,8 @@ func resourceDeviceAdministrationPolicySetCreate(ctx context.Context, d *schema. func resourceDeviceAdministrationPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationPolicySet read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -679,6 +688,12 @@ func resourceDeviceAdministrationPolicySetRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminPolicySets search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -703,6 +718,12 @@ func resourceDeviceAdministrationPolicySetRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminPolicySetByID response", + err)) + return diags + } return diags } @@ -711,7 +732,8 @@ func resourceDeviceAdministrationPolicySetRead(ctx context.Context, d *schema.Re func resourceDeviceAdministrationPolicySetUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationPolicySet update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -773,7 +795,8 @@ func resourceDeviceAdministrationPolicySetUpdate(ctx context.Context, d *schema. func resourceDeviceAdministrationPolicySetDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationPolicySet delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1328,7 +1351,8 @@ func getAllItemsDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m interfac } func searchDeviceAdministrationPolicySetGetDeviceAdminPolicySets(m interface{}, items []isegosdk.ResponseDeviceAdministrationPolicySetGetDeviceAdminPolicySetsResponse, name string, id string) (*isegosdk.ResponseDeviceAdministrationPolicySetGetDeviceAdminPolicySetByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationPolicySetGetDeviceAdminPolicySetByIDResponse for _, item := range items { diff --git a/ciscoise/resource_device_administration_policy_set_reset_hitcount.go b/ciscoise/resource_device_administration_policy_set_reset_hitcount.go index e0d7362f..de40a9f5 100644 --- a/ciscoise/resource_device_administration_policy_set_reset_hitcount.go +++ b/ciscoise/resource_device_administration_policy_set_reset_hitcount.go @@ -55,7 +55,8 @@ func resourceDeviceAdministrationPolicySetResetHitcount() *schema.Resource { func resourceDeviceAdministrationPolicySetResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsDeviceAdminPolicySets create") log.Printf("[DEBUG] Missing ResetHitCountsDeviceAdminPolicySets create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics d.Set("parameters", nil) diff --git a/ciscoise/resource_device_administration_time_date_conditions.go b/ciscoise/resource_device_administration_time_date_conditions.go index 5042f206..6009844d 100644 --- a/ciscoise/resource_device_administration_time_date_conditions.go +++ b/ciscoise/resource_device_administration_time_date_conditions.go @@ -254,166 +254,269 @@ func resourceDeviceAdministrationTimeDateConditions() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_date": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + Description: `Condition description`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, + "name": &schema.Schema{ + Description: `Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -427,7 +530,9 @@ func resourceDeviceAdministrationTimeDateConditions() *schema.Resource { func resourceDeviceAdministrationTimeDateConditionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationTimeDateConditions create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -441,27 +546,29 @@ func resourceDeviceAdministrationTimeDateConditionsCreate(ctx context.Context, d vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.DeviceAdministrationTimeDateConditions.GetDeviceAdminTimeConditionByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDeviceAdministrationTimeDateConditionsRead(ctx, d, m) - } - } else { - response2, _, err := client.DeviceAdministrationTimeDateConditions.GetDeviceAdminTimeConditions() - if response2 != nil && err == nil { - items2 := getAllItemsDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditions(m, response2) - item2, err := searchDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditions(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.DeviceAdministrationTimeDateConditions.GetDeviceAdminTimeConditionByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceDeviceAdministrationTimeDateConditionsRead(ctx, d, m) } + } else { + response2, _, err := client.DeviceAdministrationTimeDateConditions.GetDeviceAdminTimeConditions() + if response2 != nil && err == nil { + items2 := getAllItemsDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditions(m, response2) + item2, err := searchDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditions(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDeviceAdministrationTimeDateConditionsRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.DeviceAdministrationTimeDateConditions.CreateDeviceAdminTimeCondition(request1) @@ -490,7 +597,8 @@ func resourceDeviceAdministrationTimeDateConditionsCreate(ctx context.Context, d func resourceDeviceAdministrationTimeDateConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationTimeDateConditions read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -534,6 +642,12 @@ func resourceDeviceAdministrationTimeDateConditionsRead(ctx context.Context, d * err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminTimeConditions search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -558,6 +672,12 @@ func resourceDeviceAdministrationTimeDateConditionsRead(ctx context.Context, d * err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeviceAdminTimeConditionByID response", + err)) + return diags + } return diags } @@ -566,7 +686,8 @@ func resourceDeviceAdministrationTimeDateConditionsRead(ctx context.Context, d * func resourceDeviceAdministrationTimeDateConditionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationTimeDateConditions update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -628,7 +749,8 @@ func resourceDeviceAdministrationTimeDateConditionsUpdate(ctx context.Context, d func resourceDeviceAdministrationTimeDateConditionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeviceAdministrationTimeDateConditions delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1073,7 +1195,8 @@ func getAllItemsDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditio } func searchDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditions(m interface{}, items []isegosdk.ResponseDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditionsResponse, name string, id string) (*isegosdk.ResponseDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditionByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDeviceAdministrationTimeDateConditionsGetDeviceAdminTimeConditionByIDResponse for _, item := range items { diff --git a/ciscoise/resource_downloadable_acl.go b/ciscoise/resource_downloadable_acl.go index e0bbd3da..b4c80bcd 100644 --- a/ciscoise/resource_downloadable_acl.go +++ b/ciscoise/resource_downloadable_acl.go @@ -103,32 +103,251 @@ func resourceDownloadableACL() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "dacl": &schema.Schema{ - Description: `The DACL Content. Use the string \\n for a newline`, - Type: schema.TypeString, - Optional: true, + "children": &schema.Schema{ + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_date": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, }, - "dacl_type": &schema.Schema{ - Description: `Allowed values: -- IPV4, -- IPV6, -- IP_AGNOSTIC`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dates_range": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, + }, + "dates_range_exception": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, }, "description": &schema.Schema{ - Description: `Use the string \\n for a newline`, - Type: schema.TypeString, - Optional: true, + Description: `Condition description`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "hours_range": &schema.Schema{ + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "end_time": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_time": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, + }, + "hours_range_exception": &schema.Schema{ + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "end_time": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_time": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name. Name may contain alphanumeric or any of the following characters [_.-]`, - Type: schema.TypeString, - Optional: true, + Description: `Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "week_days": &schema.Schema{ + Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "week_days_exception": &schema.Schema{ + Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, }, }, @@ -139,7 +358,9 @@ func resourceDownloadableACL() *schema.Resource { func resourceDownloadableACLCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DownloadableACL create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -153,31 +374,35 @@ func resourceDownloadableACLCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.DownloadableACL.GetDownloadableACLByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceDownloadableACLRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetDownloadableACLQueryParams{} - - response2, _, err := client.DownloadableACL.GetDownloadableACL(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsDownloadableACLGetDownloadableACL(m, response2, &queryParams2) - item2, err := searchDownloadableACLGetDownloadableACL(m, items2, vvName, vvID) - if err == nil && item2 != nil { + + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.DownloadableACL.GetDownloadableACLByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceDownloadableACLRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetDownloadableACLQueryParams{} + + response2, _, err := client.DownloadableACL.GetDownloadableACL(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsDownloadableACLGetDownloadableACL(m, response2, &queryParams2) + item2, err := searchDownloadableACLGetDownloadableACL(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceDownloadableACLRead(ctx, d, m) + } + } } } + restyResp1, err := client.DownloadableACL.CreateDownloadableACL(request1) if err != nil { if restyResp1 != nil { @@ -202,7 +427,8 @@ func resourceDownloadableACLCreate(ctx context.Context, d *schema.ResourceData, func resourceDownloadableACLRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DownloadableACL read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -248,6 +474,12 @@ func resourceDownloadableACLRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDownloadableACL search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -273,6 +505,12 @@ func resourceDownloadableACLRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDownloadableACLByID response", + err)) + return diags + } return diags } @@ -281,7 +519,8 @@ func resourceDownloadableACLRead(ctx context.Context, d *schema.ResourceData, m func resourceDownloadableACLUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DownloadableACL update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -345,7 +584,8 @@ func resourceDownloadableACLUpdate(ctx context.Context, d *schema.ResourceData, func resourceDownloadableACLDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DownloadableACL delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -473,7 +713,8 @@ func expandRequestDownloadableACLUpdateDownloadableACLByIDDownloadableACL(ctx co } func getAllItemsDownloadableACLGetDownloadableACL(m interface{}, response *isegosdk.ResponseDownloadableACLGetDownloadableACL, queryParams *isegosdk.GetDownloadableACLQueryParams) []isegosdk.ResponseDownloadableACLGetDownloadableACLSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseDownloadableACLGetDownloadableACLSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -501,7 +742,8 @@ func getAllItemsDownloadableACLGetDownloadableACL(m interface{}, response *isego } func searchDownloadableACLGetDownloadableACL(m interface{}, items []isegosdk.ResponseDownloadableACLGetDownloadableACLSearchResultResources, name string, id string) (*isegosdk.ResponseDownloadableACLGetDownloadableACLByIDDownloadableACL, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseDownloadableACLGetDownloadableACLByIDDownloadableACL for _, item := range items { diff --git a/ciscoise/resource_egress_matrix_cell.go b/ciscoise/resource_egress_matrix_cell.go index 1b85f720..4f8e6447 100644 --- a/ciscoise/resource_egress_matrix_cell.go +++ b/ciscoise/resource_egress_matrix_cell.go @@ -121,46 +121,83 @@ func resourceEgressMatrixCell() *schema.Resource { "default_rule": &schema.Schema{ Description: `Allowed values: -- NONE, -- DENY_IP, -- PERMIT_IP`, - Type: schema.TypeString, - Optional: true, + - NONE, + - DENY_IP, + - PERMIT_IP`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "destination_sgt_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "matrix_cell_status": &schema.Schema{ Description: `Allowed values: -- DISABLED, -- ENABLED, -- MONITOR`, - Type: schema.TypeString, - Optional: true, + - DISABLED, + - ENABLED, + - MONITOR`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sgacls": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "source_sgt_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -171,7 +208,9 @@ func resourceEgressMatrixCell() *schema.Resource { func resourceEgressMatrixCellCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EgressMatrixCell create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -185,31 +224,35 @@ func resourceEgressMatrixCellCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.EgressMatrixCell.GetEgressMatrixCellByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceEgressMatrixCellRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetEgressMatrixCellQueryParams{} - - response2, _, err := client.EgressMatrixCell.GetEgressMatrixCell(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsEgressMatrixCellGetEgressMatrixCell(m, response2, &queryParams2) - item2, err := searchEgressMatrixCellGetEgressMatrixCell(m, items2, vvName, vvID) - if err == nil && item2 != nil { + + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.EgressMatrixCell.GetEgressMatrixCellByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceEgressMatrixCellRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetEgressMatrixCellQueryParams{} + + response2, _, err := client.EgressMatrixCell.GetEgressMatrixCell(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsEgressMatrixCellGetEgressMatrixCell(m, response2, &queryParams2) + item2, err := searchEgressMatrixCellGetEgressMatrixCell(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceEgressMatrixCellRead(ctx, d, m) + } + } } } + restyResp1, err := client.EgressMatrixCell.CreateEgressMatrixCell(request1) if err != nil { if restyResp1 != nil { @@ -234,7 +277,8 @@ func resourceEgressMatrixCellCreate(ctx context.Context, d *schema.ResourceData, func resourceEgressMatrixCellRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EgressMatrixCell read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -281,6 +325,12 @@ func resourceEgressMatrixCellRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEgressMatrixCell search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -305,6 +355,12 @@ func resourceEgressMatrixCellRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEgressMatrixCellByID response", + err)) + return diags + } return diags } @@ -313,7 +369,8 @@ func resourceEgressMatrixCellRead(ctx context.Context, d *schema.ResourceData, m func resourceEgressMatrixCellUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EgressMatrixCell update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -378,7 +435,8 @@ func resourceEgressMatrixCellUpdate(ctx context.Context, d *schema.ResourceData, func resourceEgressMatrixCellDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EgressMatrixCell delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -525,7 +583,8 @@ func expandRequestEgressMatrixCellUpdateEgressMatrixCellByIDEgressMatrixCell(ctx } func getAllItemsEgressMatrixCellGetEgressMatrixCell(m interface{}, response *isegosdk.ResponseEgressMatrixCellGetEgressMatrixCell, queryParams *isegosdk.GetEgressMatrixCellQueryParams) []isegosdk.ResponseEgressMatrixCellGetEgressMatrixCellSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseEgressMatrixCellGetEgressMatrixCellSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -553,7 +612,8 @@ func getAllItemsEgressMatrixCellGetEgressMatrixCell(m interface{}, response *ise } func searchEgressMatrixCellGetEgressMatrixCell(m interface{}, items []isegosdk.ResponseEgressMatrixCellGetEgressMatrixCellSearchResultResources, name string, id string) (*isegosdk.ResponseEgressMatrixCellGetEgressMatrixCellByIDEgressMatrixCell, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseEgressMatrixCellGetEgressMatrixCellByIDEgressMatrixCell for _, item := range items { diff --git a/ciscoise/resource_egress_matrix_cell_bulk_request.go b/ciscoise/resource_egress_matrix_cell_bulk_request.go index 67d27299..1ad0db73 100644 --- a/ciscoise/resource_egress_matrix_cell_bulk_request.go +++ b/ciscoise/resource_egress_matrix_cell_bulk_request.go @@ -60,7 +60,8 @@ func resourceEgressMatrixCellBulkRequest() *schema.Resource { func resourceEgressMatrixCellBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForEgressMatrixCell create") log.Printf("[DEBUG] Missing BulkRequestForEgressMatrixCell create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestEgressMatrixCellBulkRequestBulkRequestForEgressMatrixCell(ctx, "parameters.0", d) diff --git a/ciscoise/resource_egress_matrix_cell_clear_all.go b/ciscoise/resource_egress_matrix_cell_clear_all.go index 9fa86f3c..4cd71454 100644 --- a/ciscoise/resource_egress_matrix_cell_clear_all.go +++ b/ciscoise/resource_egress_matrix_cell_clear_all.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -48,7 +46,8 @@ func resourceEgressMatrixCellClearAll() *schema.Resource { func resourceEgressMatrixCellClearAllCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ClearAllMatrixCells create") log.Printf("[DEBUG] Missing ClearAllMatrixCells create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics diff --git a/ciscoise/resource_egress_matrix_cell_clone.go b/ciscoise/resource_egress_matrix_cell_clone.go index fc0b8705..a675a9fd 100644 --- a/ciscoise/resource_egress_matrix_cell_clone.go +++ b/ciscoise/resource_egress_matrix_cell_clone.go @@ -89,7 +89,8 @@ func resourceEgressMatrixCellClone() *schema.Resource { func resourceEgressMatrixCellCloneCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CloneMatrixCell create") log.Printf("[DEBUG] Missing CloneMatrixCell create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client vID := d.Get("parameters.0.id") vSrcSgtID := d.Get("parameters.0.src_sgt_id") diff --git a/ciscoise/resource_egress_matrix_cell_set_all_status.go b/ciscoise/resource_egress_matrix_cell_set_all_status.go index 2b110207..6b646240 100644 --- a/ciscoise/resource_egress_matrix_cell_set_all_status.go +++ b/ciscoise/resource_egress_matrix_cell_set_all_status.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -55,7 +53,8 @@ func resourceEgressMatrixCellSetAllStatus() *schema.Resource { func resourceEgressMatrixCellSetAllStatusCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SetAllCellsStatus create") log.Printf("[DEBUG] Missing SetAllCellsStatus create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vStatus := d.Get("parameters.0.status") diff --git a/ciscoise/resource_endpoint.go b/ciscoise/resource_endpoint.go index 50412d57..9ed84488 100644 --- a/ciscoise/resource_endpoint.go +++ b/ciscoise/resource_endpoint.go @@ -195,133 +195,208 @@ func resourceEndpoint() *schema.Resource { Schema: map[string]*schema.Schema{ "custom_attributes": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "custom_attributes": &schema.Schema{ Description: `Key value map`, - Type: schema.TypeMap, - Optional: true, + // CHECK: The type of this param + // Replaced List to Map + Type: schema.TypeString, //TEST, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "group_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_store": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_store_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "mac": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressMacAddress(), + Computed: true, }, "mdm_attributes": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "mdm_compliance_status": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_encrypted": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_enrolled": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_ime_i": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_jail_broken": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_manufacturer": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_model": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_os": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_phone_number": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_pinlock": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_reachable": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mdm_serial": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mdm_server_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_user": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "profile_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "static_group_assignment": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "static_profile_assignment": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -332,7 +407,9 @@ func resourceEndpoint() *schema.Resource { func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Endpoint create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -346,26 +423,30 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, m inter vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.Endpoint.GetEndpointByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceEndpointRead(ctx, d, m) + + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.Endpoint.GetEndpointByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceEndpointRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.Endpoint.GetEndpointByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceEndpointRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.Endpoint.GetEndpointByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.ERSEndPoint.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceEndpointRead(ctx, d, m) + } } } + restyResp1, err := client.Endpoint.CreateEndpoint(request1) if err != nil { if restyResp1 != nil { @@ -390,7 +471,8 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, m inter func resourceEndpointRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Endpoint read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -428,6 +510,12 @@ func resourceEndpointRead(ctx context.Context, d *schema.ResourceData, m interfa err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEndpointByName response", + err)) + return diags + } return diags } @@ -454,6 +542,12 @@ func resourceEndpointRead(ctx context.Context, d *schema.ResourceData, m interfa err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEndpointByID response", + err)) + return diags + } return diags } @@ -462,7 +556,8 @@ func resourceEndpointRead(ctx context.Context, d *schema.ResourceData, m interfa func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Endpoint update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -524,7 +619,8 @@ func resourceEndpointUpdate(ctx context.Context, d *schema.ResourceData, m inter func resourceEndpointDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Endpoint delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_endpoint_bulk_request.go b/ciscoise/resource_endpoint_bulk_request.go index 19d11879..f28501aa 100644 --- a/ciscoise/resource_endpoint_bulk_request.go +++ b/ciscoise/resource_endpoint_bulk_request.go @@ -60,7 +60,8 @@ func resourceEndpointBulkRequest() *schema.Resource { func resourceEndpointBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForEndpoint create") log.Printf("[DEBUG] Missing BulkRequestForEndpoint create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestEndpointBulkRequestBulkRequestForEndpoint(ctx, "parameters.0", d) diff --git a/ciscoise/resource_endpoint_certificate.go b/ciscoise/resource_endpoint_certificate.go index 2d4a0bf8..62db0097 100644 --- a/ciscoise/resource_endpoint_certificate.go +++ b/ciscoise/resource_endpoint_certificate.go @@ -105,7 +105,8 @@ func resourceEndpointCertificate() *schema.Resource { func resourceEndpointCertificateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CreateEndpointCertificate create") log.Printf("[DEBUG] Missing CreateEndpointCertificate create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics log.Printf("[DEBUG] Selected method: CreateEndpointCertificate") diff --git a/ciscoise/resource_endpoint_deregister.go b/ciscoise/resource_endpoint_deregister.go index f6b6cc20..0d6f056b 100644 --- a/ciscoise/resource_endpoint_deregister.go +++ b/ciscoise/resource_endpoint_deregister.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -55,7 +53,8 @@ func resourceEndpointDeregister() *schema.Resource { func resourceEndpointDeregisterCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeregisterEndpoint create") log.Printf("[DEBUG] Missing DeregisterEndpoint create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("parameters.0.id") diff --git a/ciscoise/resource_endpoint_group.go b/ciscoise/resource_endpoint_group.go index 28c64677..b2dd8b35 100644 --- a/ciscoise/resource_endpoint_group.go +++ b/ciscoise/resource_endpoint_group.go @@ -92,21 +92,50 @@ func resourceEndpointGroup() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "system_defined": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -117,7 +146,9 @@ func resourceEndpointGroup() *schema.Resource { func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EndpointGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -131,24 +162,26 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.EndpointIDentityGroup.GetEndpointGroupByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceEndpointGroupRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.EndpointIDentityGroup.GetEndpointGroupByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceEndpointGroupRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.EndpointIDentityGroup.GetEndpointGroupByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceEndpointGroupRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.EndpointIDentityGroup.GetEndpointGroupByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.EndPointGroup.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceEndpointGroupRead(ctx, d, m) + } } } restyResp1, err := client.EndpointIDentityGroup.CreateEndpointGroup(request1) @@ -175,7 +208,8 @@ func resourceEndpointGroupCreate(ctx context.Context, d *schema.ResourceData, m func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EndpointGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -213,6 +247,12 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEndpointGroupByName response", + err)) + return diags + } return diags } @@ -239,6 +279,12 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetEndpointGroupByID response", + err)) + return diags + } return diags } @@ -247,7 +293,8 @@ func resourceEndpointGroupRead(ctx context.Context, d *schema.ResourceData, m in func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EndpointGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -309,7 +356,8 @@ func resourceEndpointGroupUpdate(ctx context.Context, d *schema.ResourceData, m func resourceEndpointGroupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning EndpointGroup delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_endpoint_register.go b/ciscoise/resource_endpoint_register.go index b10e81ee..e8b8898f 100644 --- a/ciscoise/resource_endpoint_register.go +++ b/ciscoise/resource_endpoint_register.go @@ -204,7 +204,8 @@ func resourceEndpointRegister() *schema.Resource { func resourceEndpointRegisterCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RegisterEndpoint create") log.Printf("[DEBUG] Missing RegisterEndpoint create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestEndpointRegisterRegisterEndpoint(ctx, "parameters.0", d) diff --git a/ciscoise/resource_external_radius_server.go b/ciscoise/resource_external_radius_server.go index 295cd840..c13688ad 100644 --- a/ciscoise/resource_external_radius_server.go +++ b/ciscoise/resource_external_radius_server.go @@ -150,79 +150,128 @@ Allowed Values: Schema: map[string]*schema.Schema{ "accounting_port": &schema.Schema{ - Description: `Valid Range 1 to 65535`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid Range 1 to 65535`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authentication_port": &schema.Schema{ - Description: `Valid Range 1 to 65535`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid Range 1 to 65535`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authenticator_key": &schema.Schema{ Description: `The authenticatorKey is required only if enableKeyWrap is true, otherwise it must be ignored or empty. -The maximum length is 20 ASCII characters or 40 HEXADECIMAL characters (depend on selection in field 'keyInputFormat')`, - Type: schema.TypeString, - Optional: true, + The maximum length is 20 ASCII characters or 40 HEXADECIMAL characters (depend on selection in field 'keyInputFormat')`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_key_wrap": &schema.Schema{ Description: `KeyWrap may only be enabled if it is supported on the device. -When running in FIPS mode this option should be enabled for such devices`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + When running in FIPS mode this option should be enabled for such devices`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "encryption_key": &schema.Schema{ Description: `The encryptionKey is required only if enableKeyWrap is true, otherwise it must be ignored or empty. -The maximum length is 16 ASCII characters or 32 HEXADECIMAL characters (depend on selection in field 'keyInputFormat')`, - Type: schema.TypeString, - Optional: true, + The maximum length is 16 ASCII characters or 32 HEXADECIMAL characters (depend on selection in field 'keyInputFormat')`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "host_ip": &schema.Schema{ - Description: `The IP of the host - must be a valid IPV4 address`, - Type: schema.TypeString, - Optional: true, + Description: `The IP of the host - must be a valid IPV4 address`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "key_input_format": &schema.Schema{ Description: `Specifies the format of the input for fields 'encryptionKey' and 'authenticatorKey'. -Allowed Values: -- ASCII -- HEXADECIMAL`, - Type: schema.TypeString, - Optional: true, + Allowed Values: + - ASCII + - HEXADECIMAL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name. Allowed charactera are alphanumeric and _ (underscore).`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name. Allowed charactera are alphanumeric and _ (underscore).`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "proxy_timeout": &schema.Schema{ - Description: `Valid Range 1 to 600`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid Range 1 to 600`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "retries": &schema.Schema{ - Description: `Valid Range 1 to 9`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid Range 1 to 9`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "shared_secret": &schema.Schema{ - Description: `Shared secret maximum length is 128 characters`, - Type: schema.TypeString, - Optional: true, + Description: `Shared secret maximum length is 128 characters`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "timeout": &schema.Schema{ - Description: `Valid Range 1 to 120`, - Type: schema.TypeInt, - Optional: true, + Description: `Valid Range 1 to 120`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -233,7 +282,9 @@ Allowed Values: func resourceExternalRadiusServerCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ExternalRadiusServer create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -247,24 +298,26 @@ func resourceExternalRadiusServerCreate(ctx context.Context, d *schema.ResourceD vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.ExternalRadiusServer.GetExternalRadiusServerByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceExternalRadiusServerRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.ExternalRadiusServer.GetExternalRadiusServerByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceExternalRadiusServerRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.ExternalRadiusServer.GetExternalRadiusServerByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceExternalRadiusServerRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.ExternalRadiusServer.GetExternalRadiusServerByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.ExternalRadiusServer.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceExternalRadiusServerRead(ctx, d, m) + } } } restyResp1, err := client.ExternalRadiusServer.CreateExternalRadiusServer(request1) @@ -291,7 +344,8 @@ func resourceExternalRadiusServerCreate(ctx context.Context, d *schema.ResourceD func resourceExternalRadiusServerRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ExternalRadiusServer read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -329,6 +383,12 @@ func resourceExternalRadiusServerRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetExternalRadiusServerByName response", + err)) + return diags + } return diags } @@ -355,6 +415,12 @@ func resourceExternalRadiusServerRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetExternalRadiusServerByID response", + err)) + return diags + } return diags } @@ -363,7 +429,8 @@ func resourceExternalRadiusServerRead(ctx context.Context, d *schema.ResourceDat func resourceExternalRadiusServerUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ExternalRadiusServer update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -425,7 +492,8 @@ func resourceExternalRadiusServerUpdate(ctx context.Context, d *schema.ResourceD func resourceExternalRadiusServerDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ExternalRadiusServer delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_filter_policy.go b/ciscoise/resource_filter_policy.go index af50d87c..b655ba2c 100644 --- a/ciscoise/resource_filter_policy.go +++ b/ciscoise/resource_filter_policy.go @@ -78,32 +78,40 @@ At least one of subnet or sgt or vn should be defined`, Schema: map[string]*schema.Schema{ "domains": &schema.Schema{ - Description: `List of SXP Domains, separated with comma`, - Type: schema.TypeString, - Optional: true, + Description: `List of SXP Domains, separated with comma`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `id path parameter.`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), }, "sgt": &schema.Schema{ Description: `SGT name or ID. At least one of subnet or sgt or vn should be defined`, Type: schema.TypeString, Optional: true, - DiffSuppressFunc: diffSuppressSgt(), + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "subnet": &schema.Schema{ Description: `Subnet for filter policy (hostname is not supported). -At least one of subnet or sgt or vn should be defined`, - Type: schema.TypeString, - Optional: true, + At least one of subnet or sgt or vn should be defined`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vn": &schema.Schema{ Description: `Virtual Network. -At least one of subnet or sgt or vn should be defined`, - Type: schema.TypeString, - Optional: true, + At least one of subnet or sgt or vn should be defined`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -114,7 +122,9 @@ At least one of subnet or sgt or vn should be defined`, func resourceFilterPolicyCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning FilterPolicy create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics @@ -132,36 +142,38 @@ func resourceFilterPolicyCreate(ctx context.Context, d *schema.ResourceData, m i vvSgt := interfaceToString(vSgt) vvSubnet := interfaceToString(vSubnet) vvVn := interfaceToString(vVn) - if okID && vvID != "" { - getResponse2, _, err := client.FilterPolicy.GetFilterPolicyByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["sgt"] = vvSgt - resourceMap["subnet"] = vvSubnet - resourceMap["vn"] = vvVn - d.SetId(joinResourceID(resourceMap)) - return diags - } - } else { - queryParams2 := isegosdk.GetFilterPolicyQueryParams{} - - response2, _, err := client.FilterPolicy.GetFilterPolicy(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsFilterPolicyGetFilterPolicy(m, response2, &queryParams2) - item2, nID, err := searchFilterPolicyGetFilterPolicy(m, items2, vvSgt, vvSubnet, vvVn, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.FilterPolicy.GetFilterPolicyByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID - if nID != "" && nID != vvID { - resourceMap["id"] = nID - } resourceMap["sgt"] = vvSgt resourceMap["subnet"] = vvSubnet resourceMap["vn"] = vvVn d.SetId(joinResourceID(resourceMap)) return diags } + } else { + queryParams2 := isegosdk.GetFilterPolicyQueryParams{} + + response2, _, err := client.FilterPolicy.GetFilterPolicy(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsFilterPolicyGetFilterPolicy(m, response2, &queryParams2) + item2, nID, err := searchFilterPolicyGetFilterPolicy(m, items2, vvSgt, vvSubnet, vvVn, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.Sgt + if nID != "" && nID != vvID { + resourceMap["id"] = nID + } + resourceMap["sgt"] = vvSgt + resourceMap["subnet"] = vvSubnet + resourceMap["vn"] = vvVn + d.SetId(joinResourceID(resourceMap)) + return diags + } + } } } restyResp1, err := client.FilterPolicy.CreateFilterPolicy(request1) @@ -190,7 +202,8 @@ func resourceFilterPolicyCreate(ctx context.Context, d *schema.ResourceData, m i func resourceFilterPolicyRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning FilterPolicy read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -239,6 +252,12 @@ func resourceFilterPolicyRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetFilterPolicy search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -263,6 +282,12 @@ func resourceFilterPolicyRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetFilterPolicyByID response", + err)) + return diags + } return diags } @@ -271,7 +296,8 @@ func resourceFilterPolicyRead(ctx context.Context, d *schema.ResourceData, m int func resourceFilterPolicyUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning FilterPolicy update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -335,7 +361,8 @@ func resourceFilterPolicyUpdate(ctx context.Context, d *schema.ResourceData, m i func resourceFilterPolicyDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning FilterPolicy delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -460,7 +487,8 @@ func expandRequestFilterPolicyUpdateFilterPolicyByIDERSFilterPolicy(ctx context. } func getAllItemsFilterPolicyGetFilterPolicy(m interface{}, response *isegosdk.ResponseFilterPolicyGetFilterPolicy, queryParams *isegosdk.GetFilterPolicyQueryParams) []isegosdk.ResponseFilterPolicyGetFilterPolicySearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseFilterPolicyGetFilterPolicySearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -488,7 +516,8 @@ func getAllItemsFilterPolicyGetFilterPolicy(m interface{}, response *isegosdk.Re } func searchFilterPolicyGetFilterPolicy(m interface{}, items []isegosdk.ResponseFilterPolicyGetFilterPolicySearchResultResources, sgt string, subnet string, vn string, id string) (*isegosdk.ResponseFilterPolicyGetFilterPolicyByIDERSFilterPolicy, string, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundID string var foundItem *isegosdk.ResponseFilterPolicyGetFilterPolicyByIDERSFilterPolicy diff --git a/ciscoise/resource_guest_smtp_notification_settings.go b/ciscoise/resource_guest_smtp_notification_settings.go index 37a0e5f9..d435544f 100644 --- a/ciscoise/resource_guest_smtp_notification_settings.go +++ b/ciscoise/resource_guest_smtp_notification_settings.go @@ -130,63 +130,106 @@ func resourceGuestSmtpNotificationSettings() *schema.Resource { Schema: map[string]*schema.Schema{ "connection_timeout": &schema.Schema{ - Description: `Interval in seconds for all the SMTP client connections`, - Type: schema.TypeString, - Optional: true, + Description: `Interval in seconds for all the SMTP client connections`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "default_from_address": &schema.Schema{ - Description: `The default from email address to be used to send emails from`, - Type: schema.TypeString, - Optional: true, + Description: `The default from email address to be used to send emails from`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "notification_enabled": &schema.Schema{ - Description: `Indicates if the email notification service is to be enabled`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if the email notification service is to be enabled`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "password": &schema.Schema{ - Description: `Password of Secure SMTP server`, - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Description: `Password of Secure SMTP server`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Sensitive: true, + Computed: true, }, "smtp_port": &schema.Schema{ - Description: `Port at which SMTP Secure Server is listening`, - Type: schema.TypeString, - Optional: true, + Description: `Port at which SMTP Secure Server is listening`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "smtp_server": &schema.Schema{ - Description: `The SMTP server ip address or fqdn such as outbound.mycompany.com`, - Type: schema.TypeString, - Optional: true, + Description: `The SMTP server ip address or fqdn such as outbound.mycompany.com`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "use_default_from_address": &schema.Schema{ - Description: `If the default from address should be used rather than using a sponsor user email address`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `If the default from address should be used rather than using a sponsor user email address`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "use_password_authentication": &schema.Schema{ - Description: `If configured to true, SMTP server authentication will happen using username/password`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `If configured to true, SMTP server authentication will happen using username/password`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "use_tlsor_ssl_encryption": &schema.Schema{ - Description: `If configured to true, SMTP server authentication will happen using TLS/SSL`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `If configured to true, SMTP server authentication will happen using TLS/SSL`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "user_name": &schema.Schema{ - Description: `Username of Secure SMTP server`, - Type: schema.TypeString, - Optional: true, + Description: `Username of Secure SMTP server`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -197,8 +240,10 @@ func resourceGuestSmtpNotificationSettings() *schema.Resource { func resourceGuestSmtpNotificationSettingsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSmtpNotificationSettings create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -209,27 +254,29 @@ func resourceGuestSmtpNotificationSettingsCreate(ctx context.Context, d *schema. vID, okID := resourceItem["id"] vvID := interfaceToString(vID) - if okID && vvID != "" { - getResponse2, _, err := client.GuestSmtpNotificationConfiguration.GetGuestSmtpNotificationSettingsByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - d.SetId(joinResourceID(resourceMap)) - return resourceGuestSmtpNotificationSettingsRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetGuestSmtpNotificationSettingsQueryParams{} - - response2, _, err := client.GuestSmtpNotificationConfiguration.GetGuestSmtpNotificationSettings(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m, response2, &queryParams2) - item2, err := searchGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m, items2, "", vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.GuestSmtpNotificationConfiguration.GetGuestSmtpNotificationSettingsByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID d.SetId(joinResourceID(resourceMap)) return resourceGuestSmtpNotificationSettingsRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetGuestSmtpNotificationSettingsQueryParams{} + + response2, _, err := client.GuestSmtpNotificationConfiguration.GetGuestSmtpNotificationSettings(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m, response2, &queryParams2) + item2, err := searchGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m, items2, "", vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + d.SetId(joinResourceID(resourceMap)) + return resourceGuestSmtpNotificationSettingsRead(ctx, d, m) + } + } } } restyResp1, err := client.GuestSmtpNotificationConfiguration.CreateGuestSmtpNotificationSettings(request1) @@ -255,7 +302,8 @@ func resourceGuestSmtpNotificationSettingsCreate(ctx context.Context, d *schema. func resourceGuestSmtpNotificationSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSmtpNotificationSettings read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -299,6 +347,12 @@ func resourceGuestSmtpNotificationSettingsRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestSmtpNotificationSettings search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -324,6 +378,12 @@ func resourceGuestSmtpNotificationSettingsRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestSmtpNotificationSettingsByID response", + err)) + return diags + } return diags } @@ -332,7 +392,8 @@ func resourceGuestSmtpNotificationSettingsRead(ctx context.Context, d *schema.Re func resourceGuestSmtpNotificationSettingsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSmtpNotificationSettings update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -481,7 +542,8 @@ func expandRequestGuestSmtpNotificationSettingsUpdateGuestSmtpNotificationSettin } func getAllItemsGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m interface{}, response *isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings, queryParams *isegosdk.GetGuestSmtpNotificationSettingsQueryParams) []isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettingsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettingsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -509,7 +571,8 @@ func getAllItemsGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettin } func searchGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettings(m interface{}, items []isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettingsSearchResultResources, name string, id string) (*isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettingsByIDERSGuestSmtpNotificationSettings, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseGuestSmtpNotificationConfigurationGetGuestSmtpNotificationSettingsByIDERSGuestSmtpNotificationSettings for _, item := range items { diff --git a/ciscoise/resource_guest_ssid.go b/ciscoise/resource_guest_ssid.go index cba8373c..92f59576 100644 --- a/ciscoise/resource_guest_ssid.go +++ b/ciscoise/resource_guest_ssid.go @@ -86,13 +86,38 @@ func resourceGuestSSID() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Description: `Resource Name. Name may contain alphanumeric or any of the following characters [_.-]`, - Type: schema.TypeString, - Optional: true, + Description: `Resource Name. Name may contain alphanumeric or any of the following characters [_.-]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -103,8 +128,10 @@ func resourceGuestSSID() *schema.Resource { func resourceGuestSSIDCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSSID create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -117,29 +144,31 @@ func resourceGuestSSIDCreate(ctx context.Context, d *schema.ResourceData, m inte vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.GuestSSID.GetGuestSSIDByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceGuestSSIDRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetGuestSSIDQueryParams{} - - response2, _, err := client.GuestSSID.GetGuestSSID(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsGuestSSIDGetGuestSSID(m, response2, &queryParams2) - item2, err := searchGuestSSIDGetGuestSSID(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.GuestSSID.GetGuestSSIDByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceGuestSSIDRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetGuestSSIDQueryParams{} + + response2, _, err := client.GuestSSID.GetGuestSSID(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsGuestSSIDGetGuestSSID(m, response2, &queryParams2) + item2, err := searchGuestSSIDGetGuestSSID(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceGuestSSIDRead(ctx, d, m) + } + } } } restyResp1, err := client.GuestSSID.CreateGuestSSID(request1) @@ -166,7 +195,8 @@ func resourceGuestSSIDCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestSSIDRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSSID read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -213,6 +243,12 @@ func resourceGuestSSIDRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestSSID search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -238,6 +274,12 @@ func resourceGuestSSIDRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestSSIDByID response", + err)) + return diags + } return diags } @@ -246,7 +288,8 @@ func resourceGuestSSIDRead(ctx context.Context, d *schema.ResourceData, m interf func resourceGuestSSIDUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSSID update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -311,7 +354,8 @@ func resourceGuestSSIDUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestSSIDDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestSSID delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -421,7 +465,8 @@ func expandRequestGuestSSIDUpdateGuestSSIDByIDGuestSSID(ctx context.Context, key } func getAllItemsGuestSSIDGetGuestSSID(m interface{}, response *isegosdk.ResponseGuestSSIDGetGuestSSID, queryParams *isegosdk.GetGuestSSIDQueryParams) []isegosdk.ResponseGuestSSIDGetGuestSSIDSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseGuestSSIDGetGuestSSIDSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -449,7 +494,8 @@ func getAllItemsGuestSSIDGetGuestSSID(m interface{}, response *isegosdk.Response } func searchGuestSSIDGetGuestSSID(m interface{}, items []isegosdk.ResponseGuestSSIDGetGuestSSIDSearchResultResources, name string, id string) (*isegosdk.ResponseGuestSSIDGetGuestSSIDByIDGuestSSID, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseGuestSSIDGetGuestSSIDByIDGuestSSID for _, item := range items { diff --git a/ciscoise/resource_guest_type.go b/ciscoise/resource_guest_type.go index 017cd828..84c933db 100644 --- a/ciscoise/resource_guest_type.go +++ b/ciscoise/resource_guest_type.go @@ -258,193 +258,271 @@ Allowed values are: Schema: map[string]*schema.Schema{ "access_time": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_access_on_specific_days_times": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "day_time_limits": &schema.Schema{ - Description: `List of Time Ranges for account access`, - Type: schema.TypeList, - Optional: true, + Description: `List of Time Ranges for account access`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "days": &schema.Schema{ Description: `List of Days -Values should be one of Week day. -Allowed values are: -- Sunday, -- Monday, -- Tuesday, -- Wednesday, -- Thursday, -- Friday, -- Saturday`, - Type: schema.TypeList, - Optional: true, + Values should be one of Week day. + Allowed values are: + - Sunday, + - Monday, + - Tuesday, + - Wednesday, + - Thursday, + - Friday, + - Saturday`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "end_time": &schema.Schema{ - Description: `End time in HH:mm format`, - Type: schema.TypeString, - Optional: true, + Description: `End time in HH:mm format`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Description: `Start time in HH:mm format`, - Type: schema.TypeString, - Optional: true, + Description: `Start time in HH:mm format`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "default_duration": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "duration_time_unit": &schema.Schema{ Description: `Allowed values are: -- DAYS, -- HOURS, -- MINUTES`, - Type: schema.TypeString, - Optional: true, + - DAYS, + - HOURS, + - MINUTES`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "from_first_login": &schema.Schema{ - Description: `When Account Duration starts from first login or specified date`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `When Account Duration starts from first login or specified date`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_account_duration": &schema.Schema{ - Description: `Maximum value of Account Duration`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum value of Account Duration`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "expiration_notification": &schema.Schema{ - Description: `Expiration Notification Settings`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Expiration Notification Settings`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "advance_notification_duration": &schema.Schema{ - Description: `Send Account Expiration Notification Duration before ( Days, Hours, Minutes )`, - Type: schema.TypeInt, - Optional: true, + Description: `Send Account Expiration Notification Duration before ( Days, Hours, Minutes )`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "advance_notification_units": &schema.Schema{ Description: `Allowed values are: -- DAYS, -- HOURS, -- MINUTES`, - Type: schema.TypeString, - Optional: true, + - DAYS, + - HOURS, + - MINUTES`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "email_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_notification": &schema.Schema{ - Description: `Enable Notification settings`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Enable Notification settings`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "send_email_notification": &schema.Schema{ - Description: `Enable Email Notification`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Enable Email Notification`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "send_sms_notification": &schema.Schema{ - Description: `Maximum devices guests can register`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Maximum devices guests can register`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "sms_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_default_type": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "login_options": &schema.Schema{ + "link": &schema.Schema{ Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "login_options": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_guest_portal_bypass": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "failure_action": &schema.Schema{ Description: `When Guest Exceeds limit this action will be invoked. -Allowed values are: -- Disconnect_Oldest_Connection, -- Disconnect_Newest_Connection`, - Type: schema.TypeString, - Optional: true, + Allowed values are: + - Disconnect_Oldest_Connection, + - Disconnect_Newest_Connection`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_group_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "limit_simultaneous_logins": &schema.Schema{ - Description: `Enable Simultaneous Logins`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Enable Simultaneous Logins`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_registered_devices": &schema.Schema{ - Description: `Maximum devices guests can register`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum devices guests can register`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "max_simultaneous_logins": &schema.Schema{ - Description: `Number of Simultaneous Logins`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of Simultaneous Logins`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sponsor_groups": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -458,8 +536,10 @@ Allowed values are: func resourceGuestTypeCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestType create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -472,29 +552,31 @@ func resourceGuestTypeCreate(ctx context.Context, d *schema.ResourceData, m inte vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.GuestType.GetGuestTypeByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceGuestTypeRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetGuestTypeQueryParams{} - - response2, _, err := client.GuestType.GetGuestType(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsGuestTypeGetGuestType(m, response2, &queryParams2) - item2, err := searchGuestTypeGetGuestType(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.GuestType.GetGuestTypeByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceGuestTypeRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetGuestTypeQueryParams{} + + response2, _, err := client.GuestType.GetGuestType(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsGuestTypeGetGuestType(m, response2, &queryParams2) + item2, err := searchGuestTypeGetGuestType(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceGuestTypeRead(ctx, d, m) + } + } } } restyResp1, err := client.GuestType.CreateGuestType(request1) @@ -521,7 +603,8 @@ func resourceGuestTypeCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestTypeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestType read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -567,6 +650,12 @@ func resourceGuestTypeRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestType search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -592,6 +681,12 @@ func resourceGuestTypeRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestTypeByID response", + err)) + return diags + } return diags } @@ -600,7 +695,8 @@ func resourceGuestTypeRead(ctx context.Context, d *schema.ResourceData, m interf func resourceGuestTypeUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestType update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -663,7 +759,8 @@ func resourceGuestTypeUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestTypeDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestType delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1051,7 +1148,8 @@ func expandRequestGuestTypeUpdateGuestTypeByIDGuestTypeExpirationNotification(ct } func getAllItemsGuestTypeGetGuestType(m interface{}, response *isegosdk.ResponseGuestTypeGetGuestType, queryParams *isegosdk.GetGuestTypeQueryParams) []isegosdk.ResponseGuestTypeGetGuestTypeSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseGuestTypeGetGuestTypeSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -1079,7 +1177,8 @@ func getAllItemsGuestTypeGetGuestType(m interface{}, response *isegosdk.Response } func searchGuestTypeGetGuestType(m interface{}, items []isegosdk.ResponseGuestTypeGetGuestTypeSearchResultResources, name string, id string) (*isegosdk.ResponseGuestTypeGetGuestTypeByIDGuestType, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseGuestTypeGetGuestTypeByIDGuestType for _, item := range items { diff --git a/ciscoise/resource_guest_user.go b/ciscoise/resource_guest_user.go index 709ece56..629fe1f2 100644 --- a/ciscoise/resource_guest_user.go +++ b/ciscoise/resource_guest_user.go @@ -215,143 +215,225 @@ func resourceGuestUser() *schema.Resource { MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "custom_fields": &schema.Schema{ Description: `Key value map`, - Type: schema.TypeMap, - Optional: true, + // CHECK: The type of this param + // Replaced List to Map + Type: schema.TypeString, //TEST, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "guest_access_info": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "from_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "group_tag": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "location": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ssid": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "to_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "valid_days": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "guest_info": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "company": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "creation_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "email_address": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enabled": &schema.Schema{ - Description: `This field is only for Get operation not applicable for Create, Update operations`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `This field is only for Get operation not applicable for Create, Update operations`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "first_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "last_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "notification_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Sensitive: true, + Computed: true, }, "phone_number": &schema.Schema{ - Description: `Phone number should be E.164 format`, - Type: schema.TypeString, - Optional: true, + Description: `Phone number should be E.164 format`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sms_service_provider": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "user_name": &schema.Schema{ - Description: `If account needs be created with mobile number, please provide mobile number here`, - Type: schema.TypeString, - Optional: true, + Description: `If account needs be created with mobile number, please provide mobile number here`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "guest_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "reason_for_visit": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sponsor_user_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sponsor_user_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "status": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "status_reason": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -362,8 +444,10 @@ func resourceGuestUser() *schema.Resource { func resourceGuestUserCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestUser create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -376,24 +460,26 @@ func resourceGuestUserCreate(ctx context.Context, d *schema.ResourceData, m inte vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.GuestUser.GetGuestUserByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceGuestUserRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.GuestUser.GetGuestUserByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceGuestUserRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.GuestUser.GetGuestUserByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceGuestUserRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.GuestUser.GetGuestUserByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.GuestUser.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceGuestUserRead(ctx, d, m) + } } } restyResp1, err := client.GuestUser.CreateGuestUser(request1) @@ -420,7 +506,8 @@ func resourceGuestUserCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestUser read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -458,6 +545,12 @@ func resourceGuestUserRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestUserByName response", + err)) + return diags + } return diags } @@ -484,6 +577,12 @@ func resourceGuestUserRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetGuestUserByID response", + err)) + return diags + } return diags } @@ -492,7 +591,8 @@ func resourceGuestUserRead(ctx context.Context, d *schema.ResourceData, m interf func resourceGuestUserUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestUser update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -583,7 +683,8 @@ func resourceGuestUserUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceGuestUserDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GuestUser delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_guest_user_approve.go b/ciscoise/resource_guest_user_approve.go index bc9a18b2..96708ce3 100644 --- a/ciscoise/resource_guest_user_approve.go +++ b/ciscoise/resource_guest_user_approve.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -55,7 +53,8 @@ func resourceGuestUserApprove() *schema.Resource { func resourceGuestUserApproveCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ApproveGuestUserByID create") log.Printf("[DEBUG] Missing ApproveGuestUserByID create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("parameters.0.id") diff --git a/ciscoise/resource_guest_user_bulk_request.go b/ciscoise/resource_guest_user_bulk_request.go index c18c334b..e2456786 100644 --- a/ciscoise/resource_guest_user_bulk_request.go +++ b/ciscoise/resource_guest_user_bulk_request.go @@ -60,7 +60,8 @@ func resourceGuestUserBulkRequest() *schema.Resource { func resourceGuestUserBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForGuestUser create") log.Printf("[DEBUG] Missing BulkRequestForGuestUser create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestGuestUserBulkRequestBulkRequestForGuestUser(ctx, "parameters.0", d) diff --git a/ciscoise/resource_guest_user_deny.go b/ciscoise/resource_guest_user_deny.go index dce0d389..8c89c0bf 100644 --- a/ciscoise/resource_guest_user_deny.go +++ b/ciscoise/resource_guest_user_deny.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -55,7 +53,8 @@ func resourceGuestUserDeny() *schema.Resource { func resourceGuestUserDenyCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DenyGuestUserByID create") log.Printf("[DEBUG] Missing DenyGuestUserByID create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("parameters.0.id") diff --git a/ciscoise/resource_guest_user_reinstate.go b/ciscoise/resource_guest_user_reinstate.go index 62c9e4e8..d06fb114 100644 --- a/ciscoise/resource_guest_user_reinstate.go +++ b/ciscoise/resource_guest_user_reinstate.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -62,7 +60,8 @@ func resourceGuestUserReinstate() *schema.Resource { func resourceGuestUserReinstateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ReinstateGuestUserByName create") log.Printf("[DEBUG] Missing ReinstateGuestUserByName create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vName, okName := d.GetOk("parameters.0.name") diff --git a/ciscoise/resource_guest_user_reset_password.go b/ciscoise/resource_guest_user_reset_password.go index 89aafcfa..2deee709 100644 --- a/ciscoise/resource_guest_user_reset_password.go +++ b/ciscoise/resource_guest_user_reset_password.go @@ -76,7 +76,8 @@ func resourceGuestUserResetPassword() *schema.Resource { func resourceGuestUserResetPasswordCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetGuestUserPasswordByID create") log.Printf("[DEBUG] Missing ResetGuestUserPasswordByID create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_guest_user_suspend.go b/ciscoise/resource_guest_user_suspend.go index 780279ad..49e907f1 100644 --- a/ciscoise/resource_guest_user_suspend.go +++ b/ciscoise/resource_guest_user_suspend.go @@ -84,7 +84,8 @@ func resourceGuestUserSuspend() *schema.Resource { func resourceGuestUserSuspendCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SuspendGuestUserByName create") log.Printf("[DEBUG] Missing SuspendGuestUserByName create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vName, okName := d.GetOk("parameters.0.name") diff --git a/ciscoise/resource_hotpatch.go b/ciscoise/resource_hotpatch.go index 92cbef03..5014044b 100644 --- a/ciscoise/resource_hotpatch.go +++ b/ciscoise/resource_hotpatch.go @@ -86,7 +86,8 @@ unavailable for a certain period of time. func resourceHotpatchCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Hotpatch create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -173,7 +174,8 @@ func resourceHotpatchCreate(ctx context.Context, d *schema.ResourceData, m inter func resourceHotpatchRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Hotpatch read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -221,7 +223,8 @@ func resourceHotpatchUpdate(ctx context.Context, d *schema.ResourceData, m inter func resourceHotpatchDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Hotpatch delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_hotspot_portal.go b/ciscoise/resource_hotspot_portal.go index c409f519..1f9ed895 100644 --- a/ciscoise/resource_hotspot_portal.go +++ b/ciscoise/resource_hotspot_portal.go @@ -494,88 +494,108 @@ Allowed values: Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Description: `Defines all of the Portal Customizations available`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the Portal Customizations available`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -585,40 +605,50 @@ Allowed values: }, "language": &schema.Schema{ Description: `This property is supported only for Read operation and it allows to show the customizations in English. -Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -627,57 +657,73 @@ Other languages are not supported`, }, }, "portal_theme": &schema.Schema{ - Description: `Defines the configuration for portal theme`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines the configuration for portal theme`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `The unique internal identifier of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The unique internal identifier of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -686,251 +732,337 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a BYOD`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a BYOD`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_settings": &schema.Schema{ - Description: `Configuration of the Acceptable Use Policy (AUP) for a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of the Acceptable Use Policy (AUP) for a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "access_code": &schema.Schema{ - Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, - Type: schema.TypeString, - Optional: true, + Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Require the portal user to read and accept an AUP`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to read and accept an AUP`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_access_code": &schema.Schema{ Description: `Require the portal user to enter an access code. -Only used in Hotspot portal`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only used in Hotspot portal`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "auth_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Description: `Target URL for redirection, used when successRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Description: `Target URL for redirection, used when successRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ Description: `After an Authentication Success where should device be redirected. Allowed values: -- AUTHSUCCESSPAGE, -- ORIGINATINGURL, -- URL`, - Type: schema.TypeString, - Optional: true, + - AUTHSUCCESSPAGE, + - ORIGINATINGURL, + - URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0 -- eth1 -- eth2 -- eth3 -- eth4 -- eth5 -- bond0 -- bond1 -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0 + - eth1 + - eth2 + - eth3 + - eth4 + - eth5 + - bond0 + - bond1 + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "always_used_language": &schema.Schema{ - Description: `Used when displayLang = ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "coa_type": &schema.Schema{ Description: `Allowed Values: -- COAREAUTHENTICATE, -- COATERMINATE`, - Type: schema.TypeString, - Optional: true, + - COAREAUTHENTICATE, + - COATERMINATE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "endpoint_identity_group": &schema.Schema{ - Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ Description: `The port number that the allowed interfaces will listen on. -Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "post_access_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "post_login_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Description: `Include a Post-Login Banner page`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include a Post-Login Banner page`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Description: `Portal Support Information Settings`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Portal Support Information Settings`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. -Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -947,8 +1079,10 @@ Allowed values: func resourceHotspotPortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning HotspotPortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -961,29 +1095,31 @@ func resourceHotspotPortalCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.HotspotPortal.GetHotspotPortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceHotspotPortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetHotspotPortalQueryParams{} - - response2, _, err := client.HotspotPortal.GetHotspotPortal(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsHotspotPortalGetHotspotPortal(m, response2, &queryParams2) - item2, err := searchHotspotPortalGetHotspotPortal(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.HotspotPortal.GetHotspotPortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceHotspotPortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetHotspotPortalQueryParams{} + + response2, _, err := client.HotspotPortal.GetHotspotPortal(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsHotspotPortalGetHotspotPortal(m, response2, &queryParams2) + item2, err := searchHotspotPortalGetHotspotPortal(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceHotspotPortalRead(ctx, d, m) + } + } } } restyResp1, err := client.HotspotPortal.CreateHotspotPortal(request1) @@ -1010,7 +1146,8 @@ func resourceHotspotPortalCreate(ctx context.Context, d *schema.ResourceData, m func resourceHotspotPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning HotspotPortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1057,6 +1194,12 @@ func resourceHotspotPortalRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetHotspotPortal search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -1082,6 +1225,12 @@ func resourceHotspotPortalRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetHotspotPortalByID response", + err)) + return diags + } return diags } @@ -1090,7 +1239,8 @@ func resourceHotspotPortalRead(ctx context.Context, d *schema.ResourceData, m in func resourceHotspotPortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning HotspotPortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1153,7 +1303,8 @@ func resourceHotspotPortalUpdate(ctx context.Context, d *schema.ResourceData, m func resourceHotspotPortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning HotspotPortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1969,7 +2120,8 @@ func expandRequestHotspotPortalUpdateHotspotPortalByIDHotspotPortalCustomization } func getAllItemsHotspotPortalGetHotspotPortal(m interface{}, response *isegosdk.ResponseHotspotPortalGetHotspotPortal, queryParams *isegosdk.GetHotspotPortalQueryParams) []isegosdk.ResponseHotspotPortalGetHotspotPortalSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseHotspotPortalGetHotspotPortalSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -1997,7 +2149,8 @@ func getAllItemsHotspotPortalGetHotspotPortal(m interface{}, response *isegosdk. } func searchHotspotPortalGetHotspotPortal(m interface{}, items []isegosdk.ResponseHotspotPortalGetHotspotPortalSearchResultResources, name string, id string) (*isegosdk.ResponseHotspotPortalGetHotspotPortalByIDHotspotPortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseHotspotPortalGetHotspotPortalByIDHotspotPortal for _, item := range items { diff --git a/ciscoise/resource_id_store_sequence.go b/ciscoise/resource_id_store_sequence.go index c1bb466e..bf6170d0 100644 --- a/ciscoise/resource_id_store_sequence.go +++ b/ciscoise/resource_id_store_sequence.go @@ -119,46 +119,85 @@ Partial update is not supported Schema: map[string]*schema.Schema{ "break_on_store_fail": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "certificate_authentication_profile": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id_seq_item": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "idstore": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "order": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + }, + }, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, }, }, }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "parent": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -169,8 +208,10 @@ Partial update is not supported func resourceIDStoreSequenceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDStoreSequence create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -183,24 +224,26 @@ func resourceIDStoreSequenceCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.IDentitySequence.GetIDentitySequenceByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceIDStoreSequenceRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.IDentitySequence.GetIDentitySequenceByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceIDStoreSequenceRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.IDentitySequence.GetIDentitySequenceByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceIDStoreSequenceRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.IDentitySequence.GetIDentitySequenceByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.IDStoreSequence.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceIDStoreSequenceRead(ctx, d, m) + } } } restyResp1, err := client.IDentitySequence.CreateIDentitySequence(request1) @@ -227,7 +270,8 @@ func resourceIDStoreSequenceCreate(ctx context.Context, d *schema.ResourceData, func resourceIDStoreSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDStoreSequence read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -265,6 +309,12 @@ func resourceIDStoreSequenceRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIDentitySequenceByName response", + err)) + return diags + } return diags } @@ -291,6 +341,12 @@ func resourceIDStoreSequenceRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIDentitySequenceByID response", + err)) + return diags + } return diags } @@ -299,7 +355,8 @@ func resourceIDStoreSequenceRead(ctx context.Context, d *schema.ResourceData, m func resourceIDStoreSequenceUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDStoreSequence update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -361,7 +418,8 @@ func resourceIDStoreSequenceUpdate(ctx context.Context, d *schema.ResourceData, func resourceIDStoreSequenceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDStoreSequence delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_identity_group.go b/ciscoise/resource_identity_group.go index b12474e5..6d1b8208 100644 --- a/ciscoise/resource_identity_group.go +++ b/ciscoise/resource_identity_group.go @@ -90,20 +90,49 @@ func resourceIDentityGroup() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "parent": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -114,8 +143,10 @@ func resourceIDentityGroup() *schema.Resource { func resourceIDentityGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDentityGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -128,24 +159,26 @@ func resourceIDentityGroupCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.IDentityGroups.GetIDentityGroupByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceIDentityGroupRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.IDentityGroups.GetIDentityGroupByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceIDentityGroupRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.IDentityGroups.GetIDentityGroupByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceIDentityGroupRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.IDentityGroups.GetIDentityGroupByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.IDentityGroup.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceIDentityGroupRead(ctx, d, m) + } } } restyResp1, err := client.IDentityGroups.CreateIDentityGroup(request1) @@ -172,7 +205,8 @@ func resourceIDentityGroupCreate(ctx context.Context, d *schema.ResourceData, m func resourceIDentityGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDentityGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -210,6 +244,12 @@ func resourceIDentityGroupRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIDentityGroupByName response", + err)) + return diags + } return diags } @@ -236,6 +276,12 @@ func resourceIDentityGroupRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIDentityGroupByID response", + err)) + return diags + } return diags } @@ -244,7 +290,8 @@ func resourceIDentityGroupRead(ctx context.Context, d *schema.ResourceData, m in func resourceIDentityGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning IDentityGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_internal_user.go b/ciscoise/resource_internal_user.go index 97c02820..20e0a145 100644 --- a/ciscoise/resource_internal_user.go +++ b/ciscoise/resource_internal_user.go @@ -148,105 +148,128 @@ The values are case sensitive. For example, '[ERSObjectURL]?filter=enabled.EQ.En Schema: map[string]*schema.Schema{ "change_password": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "custom_attributes": &schema.Schema{ Description: `Key value map`, - Type: schema.TypeMap, - Optional: true, + // CHECK: The type of this param + // Replaced List to Map + Type: schema.TypeString, //TEST, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "email": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - log.Printf("[DEBUG] Performing comparison to see if key %s requires diff suppression", k) - vChangePassword, okChangePassword := d.GetOk("parameters.0.change_password") - vvChangePassword := interfaceToBoolPtr(vChangePassword) - hasDiff := old != new - if hasDiff { - // Do not suppress diff if it has change_password set - if okChangePassword && vvChangePassword != nil && *vvChangePassword { - log.Printf("[DEBUG] key %s does not require suppresion", k) - return false - } - return true - } - return true - }, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enabled": &schema.Schema{ Description: `Whether the user is enabled/disabled. To use it as filter, the values should be 'Enabled' or 'Disabled'. -The values are case sensitive. For example, '[ERSObjectURL]?filter=enabled.EQ.Enabled'`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + The values are case sensitive. For example, '[ERSObjectURL]?filter=enabled.EQ.Enabled'`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "expiry_date": &schema.Schema{ - Description: `To store the internal user's expiry date information. It's format is = 'YYYY-MM-DD'`, - Type: schema.TypeString, - Optional: true, + Description: `To store the internal user's expiry date information. It's format is = 'YYYY-MM-DD'`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "expiry_date_enabled": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "first_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_groups": &schema.Schema{ - Description: `CSV of identity group IDs`, - Type: schema.TypeString, - Optional: true, + Description: `CSV of identity group IDs`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "last_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Sensitive: true, - DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { - log.Printf("[DEBUG] Performing comparison to see if key %s requires diff suppression", k) - vChangePassword, okChangePassword := d.GetOk("parameters.0.change_password") - vvChangePassword := interfaceToBoolPtr(vChangePassword) - hasDiff := old != new - if hasDiff { - // Do not suppress diff if it has change_password set - if okChangePassword && vvChangePassword != nil && *vvChangePassword { - log.Printf("[DEBUG] key %s does not require suppresion", k) - return false - } - return true - } - return true - }, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Sensitive: true, + Computed: true, }, "password_idstore": &schema.Schema{ - Description: `The id store where the internal user's password is kept`, - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Description: `The id store where the internal user's password is kept`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Sensitive: true, + Computed: true, }, }, }, @@ -257,8 +280,10 @@ The values are case sensitive. For example, '[ERSObjectURL]?filter=enabled.EQ.En func resourceInternalUserCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning InternalUser create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -271,24 +296,26 @@ func resourceInternalUserCreate(ctx context.Context, d *schema.ResourceData, m i vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.InternalUser.GetInternalUserByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceInternalUserRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.InternalUser.GetInternalUserByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceInternalUserRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.InternalUser.GetInternalUserByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceInternalUserRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.InternalUser.GetInternalUserByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.InternalUser.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceInternalUserRead(ctx, d, m) + } } } restyResp1, err := client.InternalUser.CreateInternalUser(request1) @@ -315,7 +342,8 @@ func resourceInternalUserCreate(ctx context.Context, d *schema.ResourceData, m i func resourceInternalUserRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning InternalUser read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -353,6 +381,12 @@ func resourceInternalUserRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetInternalUserByName response", + err)) + return diags + } return diags } @@ -379,6 +413,12 @@ func resourceInternalUserRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetInternalUserByID response", + err)) + return diags + } return diags } @@ -387,7 +427,8 @@ func resourceInternalUserRead(ctx context.Context, d *schema.ResourceData, m int func resourceInternalUserUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning InternalUser update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -449,7 +490,8 @@ func resourceInternalUserUpdate(ctx context.Context, d *schema.ResourceData, m i func resourceInternalUserDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning InternalUser delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_ise_root_ca_regenerate.go b/ciscoise/resource_ise_root_ca_regenerate.go index 970baf2a..8d97f306 100644 --- a/ciscoise/resource_ise_root_ca_regenerate.go +++ b/ciscoise/resource_ise_root_ca_regenerate.go @@ -94,7 +94,8 @@ be used to track the status. func resourceIseRootCaRegenerateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RegenerateIseRootCa create") log.Printf("[DEBUG] Missing RegenerateIseRootCa create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_licensing_registration.go b/ciscoise/resource_licensing_registration.go index a3a21aa4..c9233df7 100644 --- a/ciscoise/resource_licensing_registration.go +++ b/ciscoise/resource_licensing_registration.go @@ -70,32 +70,42 @@ func resourceLicensingRegistration() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "connection_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateStringHasValueFunc([]string{"", "HTTP_DIRECT", "PROXY", "SSM_ONPREM_SERVER", "TRANSPORT_GATEWAY"}), + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + ValidateFunc: validateStringHasValueFunc([]string{"", "HTTP_DIRECT", "PROXY", "SSM_ONPREM_SERVER", "TRANSPORT_GATEWAY"}), }, "registration_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateStringHasValueFunc([]string{"", "DEREGISTER", "REGISTER", "RENEW", "UPDATE"}), + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + ValidateFunc: validateStringHasValueFunc([]string{"", "DEREGISTER", "REGISTER", "RENEW", "UPDATE"}), }, "ssm_on_prem_server": &schema.Schema{ - Description: `If connection type is selected as SSM_ONPREM_SERVER, then IP address or the hostname (or FQDN) of the SSM On-Prem server Host.`, - Type: schema.TypeString, - Optional: true, + Description: `If connection type is selected as SSM_ONPREM_SERVER, then IP address or the hostname (or FQDN) of the SSM On-Prem server Host.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "tier": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "ADVANTAGE", "DEVICEADMIN", "ESSENTIAL", "PREMIER", "VM"}), }, }, "token": &schema.Schema{ - Description: `token`, - Type: schema.TypeString, - Optional: true, + Description: `token`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -106,7 +116,8 @@ func resourceLicensingRegistration() *schema.Resource { func resourceLicensingRegistrationCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LicenseRegistration create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -138,7 +149,8 @@ func resourceLicensingRegistrationCreate(ctx context.Context, d *schema.Resource func resourceLicensingRegistrationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LicenseRegistration read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -161,12 +173,19 @@ func resourceLicensingRegistrationRead(ctx context.Context, d *schema.ResourceDa err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRegistrationInfo response", + err)) + return diags + } return diags } func resourceLicensingRegistrationUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LicenseRegistration update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_licensing_tier_state.go b/ciscoise/resource_licensing_tier_state.go index ebd653ab..649e51f4 100644 --- a/ciscoise/resource_licensing_tier_state.go +++ b/ciscoise/resource_licensing_tier_state.go @@ -82,15 +82,39 @@ func resourceLicensingTierState() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + ForceNew: true, ValidateFunc: validateStringHasValueFunc([]string{"", "ESSENTIAL", "ADVANTAGE", "PREMIER", "DEVICEADMIN"}), }, "status": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - ValidateFunc: validateStringHasValueFunc([]string{"", "ENABLED", "DISABLED"}), + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + ValidateFunc: validateStringHasValueFunc([]string{"", "ENABLED", "DISABLED"}), + }, + "compliance": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "consumption_counter": &schema.Schema{ + Description: `Compliance counter for tier`, + Type: schema.TypeInt, + Computed: true, + }, + "days_out_of_compliance": &schema.Schema{ + Description: `Number of days tier is out of compliance`, + Type: schema.TypeString, + Computed: true, + }, + "last_authorization": &schema.Schema{ + Description: `Last date of authorization`, + Type: schema.TypeString, + Computed: true, }, }, }, @@ -101,7 +125,8 @@ func resourceLicensingTierState() *schema.Resource { func resourceLicensingTierStateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TierState create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -130,7 +155,8 @@ func resourceLicensingTierStateCreate(ctx context.Context, d *schema.ResourceDat func resourceLicensingTierStateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TierState read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -168,7 +194,8 @@ func resourceLicensingTierStateRead(ctx context.Context, d *schema.ResourceData, func resourceLicensingTierStateUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TierState update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_mnt_session_delete_all.go b/ciscoise/resource_mnt_session_delete_all.go index cc99996b..e703958c 100644 --- a/ciscoise/resource_mnt_session_delete_all.go +++ b/ciscoise/resource_mnt_session_delete_all.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -48,7 +46,8 @@ func resourceMntSessionDeleteAll() *schema.Resource { func resourceMntSessionDeleteAllCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeleteAllSessions create") log.Printf("[DEBUG] Missing DeleteAllSessions create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, err := client.Misc.DeleteAllSessions() diff --git a/ciscoise/resource_my_device_portal.go b/ciscoise/resource_my_device_portal.go index e925a72c..0aa2f169 100644 --- a/ciscoise/resource_my_device_portal.go +++ b/ciscoise/resource_my_device_portal.go @@ -527,88 +527,108 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Description: `Defines all of the Portal Customizations available`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the Portal Customizations available`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -617,42 +637,52 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "language": &schema.Schema{ - Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Description: `Represent the entire page customization as a giant dictionary`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Represent the entire page customization as a giant dictionary`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `The Dictionary will be exposed here as key value pair`, - Type: schema.TypeList, - Optional: true, + Description: `The Dictionary will be exposed here as key value pair`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -661,55 +691,71 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "portal_theme": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -718,289 +764,386 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a Mydevice portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a Mydevice portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_settings": &schema.Schema{ - Description: `Configuration of the Acceptable Use Policy (AUP) for a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of the Acceptable Use Policy (AUP) for a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_frequency": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. Only valid if includeAup = true. -Allowed Values: -- FIRSTLOGIN, -- EVERYLOGIN, -- RECURRING`, - Type: schema.TypeString, - Optional: true, + Allowed Values: + - FIRSTLOGIN, + - EVERYLOGIN, + - RECURRING`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_frequency_interval_days": &schema.Schema{ - Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Require the portal user to read and accept an AUP`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to read and accept an AUP`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "employee_change_password_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_employee_to_change_pwd": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "login_page_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_failed_attempts_before_rate_limit": &schema.Schema{ - Description: `Maximum failed login attempts before rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum failed login attempts before rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ Description: `Require the portal user to accept the AUP. -Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "social_configs": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "time_between_logins_during_rate_limit": &schema.Schema{ - Description: `Time between login attempts when rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Time between login attempts when rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0, -- eth1, -- eth2, -- eth3, -- eth4, -- eth5, -- bond0, -- bond1, -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0, + - eth1, + - eth2, + - eth3, + - eth4, + - eth5, + - bond0, + - bond1, + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "always_used_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "endpoint_identity_group": &schema.Schema{ - Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the endpoint identity group where user's devices will be added. Used only in Hotspot Portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ - Description: `The port number that the allowed interfaces will listen on. Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Description: `The port number that the allowed interfaces will listen on. Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "post_access_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "post_login_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Description: `Include a Post-Login Banner page`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include a Post-Login Banner page`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1017,8 +1160,10 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, func resourceMyDevicePortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning MyDevicePortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -1031,29 +1176,31 @@ func resourceMyDevicePortalCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.MyDevicePortal.GetMyDevicePortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceMyDevicePortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetMyDevicePortalQueryParams{} - - response2, _, err := client.MyDevicePortal.GetMyDevicePortal(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsMyDevicePortalGetMyDevicePortal(m, response2, &queryParams2) - item2, err := searchMyDevicePortalGetMyDevicePortal(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.MyDevicePortal.GetMyDevicePortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceMyDevicePortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetMyDevicePortalQueryParams{} + + response2, _, err := client.MyDevicePortal.GetMyDevicePortal(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsMyDevicePortalGetMyDevicePortal(m, response2, &queryParams2) + item2, err := searchMyDevicePortalGetMyDevicePortal(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceMyDevicePortalRead(ctx, d, m) + } + } } } restyResp1, err := client.MyDevicePortal.CreateMyDevicePortal(request1) @@ -1080,7 +1227,8 @@ func resourceMyDevicePortalCreate(ctx context.Context, d *schema.ResourceData, m func resourceMyDevicePortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning MyDevicePortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1127,6 +1275,12 @@ func resourceMyDevicePortalRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetMyDevicePortal search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -1152,6 +1306,12 @@ func resourceMyDevicePortalRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetMyDevicePortalByID response", + err)) + return diags + } return diags } @@ -1160,7 +1320,8 @@ func resourceMyDevicePortalRead(ctx context.Context, d *schema.ResourceData, m i func resourceMyDevicePortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning MyDevicePortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1225,7 +1386,8 @@ func resourceMyDevicePortalUpdate(ctx context.Context, d *schema.ResourceData, m func resourceMyDevicePortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning MyDevicePortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -2154,7 +2316,8 @@ func expandRequestMyDevicePortalUpdateMyDevicePortalByIDMyDevicePortalCustomizat } func getAllItemsMyDevicePortalGetMyDevicePortal(m interface{}, response *isegosdk.ResponseMyDevicePortalGetMyDevicePortal, queryParams *isegosdk.GetMyDevicePortalQueryParams) []isegosdk.ResponseMyDevicePortalGetMyDevicePortalSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseMyDevicePortalGetMyDevicePortalSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -2182,7 +2345,8 @@ func getAllItemsMyDevicePortalGetMyDevicePortal(m interface{}, response *isegosd } func searchMyDevicePortalGetMyDevicePortal(m interface{}, items []isegosdk.ResponseMyDevicePortalGetMyDevicePortalSearchResultResources, name string, id string) (*isegosdk.ResponseMyDevicePortalGetMyDevicePortalByIDMyDevicePortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseMyDevicePortalGetMyDevicePortalByIDMyDevicePortal for _, item := range items { diff --git a/ciscoise/resource_native_supplicant_profile.go b/ciscoise/resource_native_supplicant_profile.go index c6cb2a7d..20ff0d4c 100644 --- a/ciscoise/resource_native_supplicant_profile.go +++ b/ciscoise/resource_native_supplicant_profile.go @@ -116,56 +116,94 @@ Allowed values: }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "wireless_profiles": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "action_type": &schema.Schema{ Description: `Action type for WifiProfile. -Allowed values: -- ADD, -- UPDATE, -- DELETE -(required for updating existing WirelessProfile)`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - ADD, + - UPDATE, + - DELETE + (required for updating existing WirelessProfile)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allowed_protocol": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_template_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "previous_ssid": &schema.Schema{ - Description: `Previous ssid for WifiProfile (required for updating existing WirelessProfile)`, - Type: schema.TypeString, - Optional: true, + Description: `Previous ssid for WifiProfile (required for updating existing WirelessProfile)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ssid": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -180,7 +218,8 @@ Allowed values: func resourceNativeSupplicantProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NativeSupplicantProfile create") log.Printf("[DEBUG] Missing NativeSupplicantProfile create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -214,7 +253,8 @@ func resourceNativeSupplicantProfileCreate(ctx context.Context, d *schema.Resour func resourceNativeSupplicantProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NativeSupplicantProfile read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -260,6 +300,12 @@ func resourceNativeSupplicantProfileRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNativeSupplicantProfile search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -285,6 +331,12 @@ func resourceNativeSupplicantProfileRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNativeSupplicantProfileByID response", + err)) + return diags + } return diags } @@ -293,7 +345,8 @@ func resourceNativeSupplicantProfileRead(ctx context.Context, d *schema.Resource func resourceNativeSupplicantProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NativeSupplicantProfile update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -357,7 +410,8 @@ func resourceNativeSupplicantProfileUpdate(ctx context.Context, d *schema.Resour func resourceNativeSupplicantProfileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NativeSupplicantProfile delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -499,7 +553,8 @@ func expandRequestNativeSupplicantProfileUpdateNativeSupplicantProfileByIDERSNSp } func getAllItemsNativeSupplicantProfileGetNativeSupplicantProfile(m interface{}, response *isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfile, queryParams *isegosdk.GetNativeSupplicantProfileQueryParams) []isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfileSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfileSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -527,7 +582,8 @@ func getAllItemsNativeSupplicantProfileGetNativeSupplicantProfile(m interface{}, } func searchNativeSupplicantProfileGetNativeSupplicantProfile(m interface{}, items []isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfileSearchResultResources, name string, id string) (*isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfileByIDERSNSpProfile, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNativeSupplicantProfileGetNativeSupplicantProfileByIDERSNSpProfile for _, item := range items { diff --git a/ciscoise/resource_network_access_authentication_rules.go b/ciscoise/resource_network_access_authentication_rules.go index 91890023..160e6016 100644 --- a/ciscoise/resource_network_access_authentication_rules.go +++ b/ciscoise/resource_network_access_authentication_rules.go @@ -363,248 +363,266 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "identity_source_id": &schema.Schema{ + Description: `Identity source id from the identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "identity_source_name": &schema.Schema{ - Description: `Identity source name from the identity stores`, - Type: schema.TypeString, - Optional: true, + Description: `Identity source name from the identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_auth_fail": &schema.Schema{ - Description: `Action to perform when authentication fails such as Bad credentials, disabled user and so on`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when authentication fails such as Bad credentials, disabled user and so on`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_process_fail": &schema.Schema{ - Description: `Action to perform when ISE is uanble to access the identity database`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when ISE is uanble to access the identity database`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "if_user_not_found": &schema.Schema{ - Description: `Action to perform when user is not found in any of identity stores`, - Type: schema.TypeString, - Optional: true, + Description: `Action to perform when user is not found in any of identity stores`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, + Description: `policyId path parameter. Policy id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -618,8 +636,10 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceNetworkAccessAuthenticationRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthenticationRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -646,22 +666,10 @@ func resourceNetworkAccessAuthenticationRulesCreate(ctx context.Context, d *sche vvName = interfaceToString(v) } } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessAuthenticationRules.GetNetworkAccessAuthenticationRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessAuthenticationRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessAuthenticationRules.GetNetworkAccessAuthenticationRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRules(m, response2, vvPolicyID) - item2, err := searchNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessAuthenticationRules.GetNetworkAccessAuthenticationRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -669,6 +677,20 @@ func resourceNetworkAccessAuthenticationRulesCreate(ctx context.Context, d *sche d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessAuthenticationRulesRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessAuthenticationRules.GetNetworkAccessAuthenticationRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRules(m, response2, vvPolicyID) + item2, err := searchNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessAuthenticationRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessAuthenticationRules.CreateNetworkAccessAuthenticationRule(vvPolicyID, request1) @@ -698,7 +720,8 @@ func resourceNetworkAccessAuthenticationRulesCreate(ctx context.Context, d *sche func resourceNetworkAccessAuthenticationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthenticationRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -756,6 +779,12 @@ func resourceNetworkAccessAuthenticationRulesRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessAuthenticationRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -779,6 +808,12 @@ func resourceNetworkAccessAuthenticationRulesRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessAuthenticationRuleByID response", + err)) + return diags + } return diags } @@ -787,7 +822,8 @@ func resourceNetworkAccessAuthenticationRulesRead(ctx context.Context, d *schema func resourceNetworkAccessAuthenticationRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthenticationRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -864,7 +900,8 @@ func resourceNetworkAccessAuthenticationRulesUpdate(ctx context.Context, d *sche func resourceNetworkAccessAuthenticationRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthenticationRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1463,7 +1500,8 @@ func getAllItemsNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRu } func searchNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRules(m interface{}, items []isegosdk.ResponseNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessAuthenticationRulesGetNetworkAccessAuthenticationRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_authentication_rules_reset_hitcount.go b/ciscoise/resource_network_access_authentication_rules_reset_hitcount.go index a204a47d..41588743 100644 --- a/ciscoise/resource_network_access_authentication_rules_reset_hitcount.go +++ b/ciscoise/resource_network_access_authentication_rules_reset_hitcount.go @@ -64,7 +64,8 @@ func resourceNetworkAccessAuthenticationRulesResetHitcount() *schema.Resource { func resourceNetworkAccessAuthenticationRulesResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsNetworkAccessAuthenticationRules create") log.Printf("[DEBUG] Missing ResetHitCountsNetworkAccessAuthenticationRules create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID := d.Get("parameters.0.policy_id") diff --git a/ciscoise/resource_network_access_authorization_rules.go b/ciscoise/resource_network_access_authorization_rules.go index 6760931f..1cc32b4e 100644 --- a/ciscoise/resource_network_access_authorization_rules.go +++ b/ciscoise/resource_network_access_authorization_rules.go @@ -355,244 +355,127 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, - }, - "profile": &schema.Schema{ - Description: `The authorization profile/s`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, - }, - "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "children": &schema.Schema{ + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, - }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - }, - }, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + "start_date": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, - "security_group": &schema.Schema{ - Description: `Security group used in authorization policies`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "id": &schema.Schema{ + Description: `id path parameter. Condition id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "name": &schema.Schema{ + Description: `name path parameter. Condition name`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, }, }, @@ -603,8 +486,10 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceNetworkAccessAuthorizationRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthorizationRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -632,22 +517,10 @@ func resourceNetworkAccessAuthorizationRulesCreate(ctx context.Context, d *schem } } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessAuthorizationRules.GetNetworkAccessAuthorizationRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessAuthorizationRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessAuthorizationRules.GetNetworkAccessAuthorizationRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRules(m, response2, vvPolicyID) - item2, err := searchNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessAuthorizationRules.GetNetworkAccessAuthorizationRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -655,6 +528,20 @@ func resourceNetworkAccessAuthorizationRulesCreate(ctx context.Context, d *schem d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessAuthorizationRulesRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessAuthorizationRules.GetNetworkAccessAuthorizationRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRules(m, response2, vvPolicyID) + item2, err := searchNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessAuthorizationRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessAuthorizationRules.CreateNetworkAccessAuthorizationRule(vvPolicyID, request1) @@ -684,7 +571,8 @@ func resourceNetworkAccessAuthorizationRulesCreate(ctx context.Context, d *schem func resourceNetworkAccessAuthorizationRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthorizationRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -745,6 +633,12 @@ func resourceNetworkAccessAuthorizationRulesRead(ctx context.Context, d *schema. err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessAuthorizationRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -769,6 +663,12 @@ func resourceNetworkAccessAuthorizationRulesRead(ctx context.Context, d *schema. err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessAuthorizationRuleByID response", + err)) + return diags + } return diags } @@ -777,7 +677,8 @@ func resourceNetworkAccessAuthorizationRulesRead(ctx context.Context, d *schema. func resourceNetworkAccessAuthorizationRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthorizationRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -856,7 +757,8 @@ func resourceNetworkAccessAuthorizationRulesUpdate(ctx context.Context, d *schem func resourceNetworkAccessAuthorizationRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessAuthorizationRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1445,7 +1347,8 @@ func getAllItemsNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRule } func searchNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRules(m interface{}, items []isegosdk.ResponseNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessAuthorizationRulesGetNetworkAccessAuthorizationRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_authorization_rules_reset_hitcount.go b/ciscoise/resource_network_access_authorization_rules_reset_hitcount.go index 8a5dd9a5..f4b08e2a 100644 --- a/ciscoise/resource_network_access_authorization_rules_reset_hitcount.go +++ b/ciscoise/resource_network_access_authorization_rules_reset_hitcount.go @@ -64,7 +64,8 @@ func resourceNetworkAccessAuthorizationRulesResetHitcount() *schema.Resource { func resourceNetworkAccessAuthorizationRulesResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsNetworkAccessAuthorizationRules create") log.Printf("[DEBUG] Missing ResetHitCountsNetworkAccessAuthorizationRules create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vPolicyID := d.Get("parameters.0.policy_id") diff --git a/ciscoise/resource_network_access_conditions.go b/ciscoise/resource_network_access_conditions.go index c042363f..b0567fae 100644 --- a/ciscoise/resource_network_access_conditions.go +++ b/ciscoise/resource_network_access_conditions.go @@ -297,28 +297,56 @@ TimeAndDate MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_negate": &schema.Schema{ Description: `Indicates whereas this condition is in negate mode`, @@ -326,108 +354,163 @@ TimeAndDate ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, }, }, }, "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, + Description: `Condition description`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_negate": &schema.Schema{ Description: `Indicates whereas this condition is in negate mode`, @@ -437,27 +520,35 @@ TimeAndDate }, "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, + Description: `Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -471,8 +562,10 @@ TimeAndDate func resourceNetworkAccessConditionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessConditions create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -485,24 +578,26 @@ func resourceNetworkAccessConditionsCreate(ctx context.Context, d *schema.Resour vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.NetworkAccessConditions.GetNetworkAccessConditionByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessConditionsRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.NetworkAccessConditions.GetNetworkAccessConditionByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessConditionsRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.NetworkAccessConditions.GetNetworkAccessConditionByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessConditionsRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.NetworkAccessConditions.GetNetworkAccessConditionByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.Response.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessConditionsRead(ctx, d, m) + } } } resp1, restyResp1, err := client.NetworkAccessConditions.CreateNetworkAccessCondition(request1) @@ -531,7 +626,8 @@ func resourceNetworkAccessConditionsCreate(ctx context.Context, d *schema.Resour func resourceNetworkAccessConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessConditions read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -569,6 +665,12 @@ func resourceNetworkAccessConditionsRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessConditionByName response", + err)) + return diags + } return diags } @@ -595,6 +697,12 @@ func resourceNetworkAccessConditionsRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessConditionByID response", + err)) + return diags + } return diags } @@ -603,7 +711,8 @@ func resourceNetworkAccessConditionsRead(ctx context.Context, d *schema.Resource func resourceNetworkAccessConditionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessConditions update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -665,7 +774,8 @@ func resourceNetworkAccessConditionsUpdate(ctx context.Context, d *schema.Resour func resourceNetworkAccessConditionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessConditions delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_network_access_dictionary.go b/ciscoise/resource_network_access_dictionary.go index aa686d3d..836b9d8d 100644 --- a/ciscoise/resource_network_access_dictionary.go +++ b/ciscoise/resource_network_access_dictionary.go @@ -95,37 +95,66 @@ func resourceNetworkAccessDictionary() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Description: `The description of the Dictionary`, - Type: schema.TypeString, - Optional: true, + Description: `The description of the Dictionary`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_attr_type": &schema.Schema{ - Description: `The dictionary attribute type`, - Type: schema.TypeString, - Optional: true, + Description: `The dictionary attribute type`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `Identifier for the dictionary`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the dictionary`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "name": &schema.Schema{ - Description: `The dictionary name`, - Type: schema.TypeString, - Optional: true, + Description: `The dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "version": &schema.Schema{ - Description: `The dictionary version`, - Type: schema.TypeString, - Optional: true, + Description: `The dictionary version`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -136,7 +165,8 @@ func resourceNetworkAccessDictionary() *schema.Resource { func resourceNetworkAccessDictionaryCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionary create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -199,7 +229,8 @@ func resourceNetworkAccessDictionaryCreate(ctx context.Context, d *schema.Resour func resourceNetworkAccessDictionaryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionary read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -244,6 +275,12 @@ func resourceNetworkAccessDictionaryRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessDictionaries search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -269,6 +306,12 @@ func resourceNetworkAccessDictionaryRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessDictionaryByName response", + err)) + return diags + } return diags } @@ -277,7 +320,8 @@ func resourceNetworkAccessDictionaryRead(ctx context.Context, d *schema.Resource func resourceNetworkAccessDictionaryUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionary update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -339,7 +383,8 @@ func resourceNetworkAccessDictionaryUpdate(ctx context.Context, d *schema.Resour func resourceNetworkAccessDictionaryDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionary delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -493,7 +538,8 @@ func getAllItemsNetworkAccessDictionaryGetNetworkAccessDictionaries(m interface{ } func searchNetworkAccessDictionaryGetNetworkAccessDictionaries(m interface{}, items []isegosdk.ResponseNetworkAccessDictionaryGetNetworkAccessDictionariesResponse, name string, id string) (*isegosdk.ResponseNetworkAccessDictionaryGetNetworkAccessDictionaryByNameResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessDictionaryGetNetworkAccessDictionaryByNameResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_dictionary_attribute.go b/ciscoise/resource_network_access_dictionary_attribute.go index 01b501f3..bd20a82f 100644 --- a/ciscoise/resource_network_access_dictionary_attribute.go +++ b/ciscoise/resource_network_access_dictionary_attribute.go @@ -107,70 +107,91 @@ func resourceNetworkAccessDictionaryAttribute() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_values": &schema.Schema{ - Description: `all of the allowed values for the dictionary attribute`, - Type: schema.TypeList, - Optional: true, + Description: `all of the allowed values for the dictionary attribute`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "is_default": &schema.Schema{ - Description: `true if this key value is the default between the allowed values of the dictionary attribute`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `true if this key value is the default between the allowed values of the dictionary attribute`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "data_type": &schema.Schema{ - Description: `the data type for the dictionary attribute`, - Type: schema.TypeString, - Optional: true, + Description: `the data type for the dictionary attribute`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Description: `The description of the Dictionary attribute`, - Type: schema.TypeString, - Optional: true, + Description: `The description of the Dictionary attribute`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Description: `the name of the dictionary which the dictionary attribute belongs to`, - Type: schema.TypeString, - Optional: true, + Description: `the name of the dictionary which the dictionary attribute belongs to`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "direction_type": &schema.Schema{ - Description: `the direction for the useage of the dictionary attribute`, - Type: schema.TypeString, - Optional: true, + Description: `the direction for the useage of the dictionary attribute`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `Identifier for the dictionary attribute`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the dictionary attribute`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "internal_name": &schema.Schema{ - Description: `the internal name of the dictionary attribute`, - Type: schema.TypeString, - Optional: true, + Description: `the internal name of the dictionary attribute`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The dictionary attribute's name`, - Type: schema.TypeString, - Optional: true, + Description: `The dictionary attribute's name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -181,7 +202,8 @@ func resourceNetworkAccessDictionaryAttribute() *schema.Resource { func resourceNetworkAccessDictionaryAttributeCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionaryAttribute create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -241,7 +263,8 @@ func resourceNetworkAccessDictionaryAttributeCreate(ctx context.Context, d *sche func resourceNetworkAccessDictionaryAttributeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionaryAttribute read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -286,6 +309,12 @@ func resourceNetworkAccessDictionaryAttributeRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessDictionaryAttributesByDictionaryName search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -312,6 +341,12 @@ func resourceNetworkAccessDictionaryAttributeRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessDictionaryAttributeByName response", + err)) + return diags + } return diags } @@ -320,7 +355,8 @@ func resourceNetworkAccessDictionaryAttributeRead(ctx context.Context, d *schema func resourceNetworkAccessDictionaryAttributeUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionaryAttribute update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -386,7 +422,8 @@ func resourceNetworkAccessDictionaryAttributeUpdate(ctx context.Context, d *sche func resourceNetworkAccessDictionaryAttributeDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessDictionaryAttribute delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -607,7 +644,8 @@ func getAllItemsNetworkAccessDictionaryAttributeGetNetworkAccessDictionaryAttrib } func searchNetworkAccessDictionaryAttributeGetNetworkAccessDictionaryAttributesByDictionaryName(m interface{}, items []isegosdk.ResponseNetworkAccessDictionaryAttributeGetNetworkAccessDictionaryAttributesByDictionaryNameResponse, name string, id string) (*isegosdk.ResponseNetworkAccessDictionaryAttributeGetNetworkAccessDictionaryAttributeByNameResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessDictionaryAttributeGetNetworkAccessDictionaryAttributeByNameResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_global_exception_rules.go b/ciscoise/resource_network_access_global_exception_rules.go index 33a0eb11..0edd775a 100644 --- a/ciscoise/resource_network_access_global_exception_rules.go +++ b/ciscoise/resource_network_access_global_exception_rules.go @@ -352,238 +352,245 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "profile": &schema.Schema{ - Description: `The authorization profile/s`, - Type: schema.TypeList, - Optional: true, + Description: `The authorization profile/s`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "security_group": &schema.Schema{ - Description: `Security group used in authorization policies`, - Type: schema.TypeString, - Optional: true, + Description: `Security group used in authorization policies`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -594,8 +601,10 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceNetworkAccessGlobalExceptionRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessGlobalExceptionRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -620,27 +629,29 @@ func resourceNetworkAccessGlobalExceptionRulesCreate(ctx context.Context, d *sch vvName = interfaceToString(v) } } - if okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessAuthorizationGlobalExceptionRules.GetNetworkAccessPolicySetGlobalExceptionRuleByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessGlobalExceptionRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessAuthorizationGlobalExceptionRules.GetNetworkAccessPolicySetGlobalExceptionRules() - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRules(m, response2) - item2, err := searchNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRules(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessAuthorizationGlobalExceptionRules.GetNetworkAccessPolicySetGlobalExceptionRuleByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessGlobalExceptionRulesRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessAuthorizationGlobalExceptionRules.GetNetworkAccessPolicySetGlobalExceptionRules() + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRules(m, response2) + item2, err := searchNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRules(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.Rule.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessGlobalExceptionRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessAuthorizationGlobalExceptionRules.CreateNetworkAccessPolicySetGlobalExceptionRule(request1) @@ -669,7 +680,8 @@ func resourceNetworkAccessGlobalExceptionRulesCreate(ctx context.Context, d *sch func resourceNetworkAccessGlobalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessGlobalExceptionRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -728,6 +740,12 @@ func resourceNetworkAccessGlobalExceptionRulesRead(ctx context.Context, d *schem err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessPolicySetGlobalExceptionRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -752,6 +770,12 @@ func resourceNetworkAccessGlobalExceptionRulesRead(ctx context.Context, d *schem err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessPolicySetGlobalExceptionRuleByID response", + err)) + return diags + } return diags } @@ -760,7 +784,8 @@ func resourceNetworkAccessGlobalExceptionRulesRead(ctx context.Context, d *schem func resourceNetworkAccessGlobalExceptionRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessGlobalExceptionRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -837,7 +862,8 @@ func resourceNetworkAccessGlobalExceptionRulesUpdate(ctx context.Context, d *sch func resourceNetworkAccessGlobalExceptionRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessGlobalExceptionRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1409,7 +1435,8 @@ func getAllItemsNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPo } func searchNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRules(m interface{}, items []isegosdk.ResponseNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRulesResponse, name string, id string) (*isegosdk.ResponseNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessAuthorizationGlobalExceptionRulesGetNetworkAccessPolicySetGlobalExceptionRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_global_exception_rules_reset_hitcount.go b/ciscoise/resource_network_access_global_exception_rules_reset_hitcount.go index 3a2e33ce..1e1c9cc9 100644 --- a/ciscoise/resource_network_access_global_exception_rules_reset_hitcount.go +++ b/ciscoise/resource_network_access_global_exception_rules_reset_hitcount.go @@ -56,7 +56,8 @@ func resourceNetworkAccessGlobalExceptionRulesResetHitcount() *schema.Resource { func resourceNetworkAccessGlobalExceptionRulesResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsNetworkAccessGlobalExceptions create") log.Printf("[DEBUG] Missing ResetHitCountsNetworkAccessGlobalExceptions create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, restyResp1, err := client.NetworkAccessAuthorizationGlobalExceptionRules.ResetHitCountsNetworkAccessGlobalExceptions() diff --git a/ciscoise/resource_network_access_local_exception_rules.go b/ciscoise/resource_network_access_local_exception_rules.go index d66ca2fc..1eb02751 100644 --- a/ciscoise/resource_network_access_local_exception_rules.go +++ b/ciscoise/resource_network_access_local_exception_rules.go @@ -349,244 +349,252 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ - Description: `id path parameter. Rule id`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter. Rule id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "policy_id": &schema.Schema{ + Description: `policyId path parameter. Policy id`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, "profile": &schema.Schema{ - Description: `The authorization profile/s`, - Type: schema.TypeList, - Optional: true, + Description: `The authorization profile/s`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, - "policy_id": &schema.Schema{ - Description: `policyId path parameter. Policy id`, - Type: schema.TypeString, - Optional: true, - }, "rule": &schema.Schema{ - Description: `Common attributes in rule authentication/authorization`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Common attributes in rule authentication/authorization`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, - "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, - }, - }, - "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }}, }, }, - "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + "condition_type": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + "is_negate": &schema.Schema{ + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "start_time": &schema.Schema{ + "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - }, - }, - }, - "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "end_time": &schema.Schema{ + "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, - "start_time": &schema.Schema{ + "type": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, - "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, - }, - - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, - }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, - }, - "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, }, }, }, "default": &schema.Schema{ - Description: `Indicates if this rule is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates if this rule is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the rule was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the rule was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `The identifier of the rule`, - Type: schema.TypeString, - Optional: true, + Description: `The identifier of the rule`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Rule name, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other rules. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the rule is in. A disabled rule cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the rule is in. A disabled rule cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "security_group": &schema.Schema{ - Description: `Security group used in authorization policies`, - Type: schema.TypeString, - Optional: true, + Description: `Security group used in authorization policies`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -597,8 +605,10 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock func resourceNetworkAccessLocalExceptionRulesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessLocalExceptionRules create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -626,22 +636,10 @@ func resourceNetworkAccessLocalExceptionRulesCreate(ctx context.Context, d *sche } } - if okPolicyID && vvPolicyID != "" && okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessAuthorizationExceptionRules.GetNetworkAccessLocalExceptionRuleByID(vvPolicyID, vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["policy_id"] = vvPolicyID - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessLocalExceptionRulesRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessAuthorizationExceptionRules.GetNetworkAccessLocalExceptionRules(vvPolicyID) - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRules(m, response2, vvPolicyID) - item2, err := searchNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRules(m, items2, vvName, vvID, vvPolicyID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okPolicyID && vvPolicyID != "" && okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessAuthorizationExceptionRules.GetNetworkAccessLocalExceptionRuleByID(vvPolicyID, vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["policy_id"] = vvPolicyID resourceMap["id"] = vvID @@ -649,6 +647,20 @@ func resourceNetworkAccessLocalExceptionRulesCreate(ctx context.Context, d *sche d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessLocalExceptionRulesRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessAuthorizationExceptionRules.GetNetworkAccessLocalExceptionRules(vvPolicyID) + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRules(m, response2, vvPolicyID) + item2, err := searchNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRules(m, items2, vvName, vvID, vvPolicyID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["policy_id"] = vvPolicyID + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessLocalExceptionRulesRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessAuthorizationExceptionRules.CreateNetworkAccessLocalExceptionRule(vvPolicyID, request1) @@ -678,7 +690,8 @@ func resourceNetworkAccessLocalExceptionRulesCreate(ctx context.Context, d *sche func resourceNetworkAccessLocalExceptionRulesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessLocalExceptionRules read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -739,6 +752,12 @@ func resourceNetworkAccessLocalExceptionRulesRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessLocalExceptionRules search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -763,6 +782,12 @@ func resourceNetworkAccessLocalExceptionRulesRead(ctx context.Context, d *schema err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessLocalExceptionRuleByID response", + err)) + return diags + } return diags } @@ -771,7 +796,8 @@ func resourceNetworkAccessLocalExceptionRulesRead(ctx context.Context, d *schema func resourceNetworkAccessLocalExceptionRulesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessLocalExceptionRules update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -850,7 +876,8 @@ func resourceNetworkAccessLocalExceptionRulesUpdate(ctx context.Context, d *sche func resourceNetworkAccessLocalExceptionRulesDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessLocalExceptionRules delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1439,7 +1466,8 @@ func getAllItemsNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExc } func searchNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRules(m interface{}, items []isegosdk.ResponseNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRulesResponse, name string, id string, policyID string) (*isegosdk.ResponseNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRuleByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessAuthorizationExceptionRulesGetNetworkAccessLocalExceptionRuleByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_local_exception_rules_reset_hitcounts.go b/ciscoise/resource_network_access_local_exception_rules_reset_hitcounts.go index fa56fafa..04778f99 100644 --- a/ciscoise/resource_network_access_local_exception_rules_reset_hitcounts.go +++ b/ciscoise/resource_network_access_local_exception_rules_reset_hitcounts.go @@ -63,7 +63,8 @@ func resourceNetworkAccessLocalExceptionRulesResetHitcounts() *schema.Resource { func resourceNetworkAccessLocalExceptionRulesResetHitcountsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsNetworkAccessLocalExceptions create") log.Printf("[DEBUG] Missing ResetHitCountsNetworkAccessLocalExceptions create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_network_access_network_condition.go b/ciscoise/resource_network_access_network_condition.go index 6def3fec..66454d24 100644 --- a/ciscoise/resource_network_access_network_condition.go +++ b/ciscoise/resource_network_access_network_condition.go @@ -183,91 +183,119 @@ func resourceNetworkAccessNetworkCondition() *schema.Resource { Schema: map[string]*schema.Schema{ "condition_type": &schema.Schema{ - Description: `This field determines the content of the conditions field`, - Type: schema.TypeString, - Optional: true, + Description: `This field determines the content of the conditions field`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "conditions": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cli_dnis_list": &schema.Schema{ - Description: `

This field should contain a Caller ID (CLI), comma, and Called ID (DNIS).
Line format - Caller ID (CLI), Called ID (DNIS)

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain a Caller ID (CLI), comma, and Called ID (DNIS).
Line format - Caller ID (CLI), Called ID (DNIS)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "condition_type": &schema.Schema{ - Description: `This field determines the content of the conditions field`, - Type: schema.TypeString, - Optional: true, + Description: `This field determines the content of the conditions field`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "device_group_list": &schema.Schema{ - Description: `

This field should contain a tuple with NDG Root, comma, and an NDG (that it under the root).
Line format - NDG Root Name, NDG, Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain a tuple with NDG Root, comma, and an NDG (that it under the root).
Line format - NDG Root Name, NDG, Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "device_list": &schema.Schema{ - Description: `

This field should contain Device-Name,port-number. The device name must be the same as the name field in a Network Device object.
Line format - Device Name,Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain Device-Name,port-number. The device name must be the same as the name field in a Network Device object.
Line format - Device Name,Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ip_addr_list": &schema.Schema{ - Description: `

This field should contain IP-address-or-subnet,port number
IP address can be IPV4 format (n.n.n.n) or IPV6 format (n:n:n:n:n:n:n:n).
IP subnet can be IPV4 format (n.n.n.n/m) or IPV6 format (n:n:n:n:n:n:n:n/m).
Line format - IP Address or subnet,Port

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain IP-address-or-subnet,port number
IP address can be IPV4 format (n.n.n.n) or IPV6 format (n:n:n:n:n:n:n:n).
IP subnet can be IPV4 format (n.n.n.n/m) or IPV6 format (n:n:n:n:n:n:n:n/m).
Line format - IP Address or subnet,Port

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "mac_addr_list": &schema.Schema{ - Description: `

This field should contain Endstation MAC address, comma, and Destination MAC addresses.
Each Max address must include twelve hexadecimal digits using formats nn:nn:nn:nn:nn:nn or nn-nn-nn-nn-nn-nn or nnnn.nnnn.nnnn or nnnnnnnnnnnn.
Line format - Endstation MAC,Destination MAC

`, - Type: schema.TypeList, - Optional: true, + Description: `

This field should contain Endstation MAC address, comma, and Destination MAC addresses.
Each Max address must include twelve hexadecimal digits using formats nn:nn:nn:nn:nn:nn or nn-nn-nn-nn-nn-nn or nnnn.nnnn.nnnn or nnnnnnnnnnnn.
Line format - Endstation MAC,Destination MAC

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "name": &schema.Schema{ - Description: `Network Condition name`, - Type: schema.TypeString, - Optional: true, + Description: `Network Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Network Condition name`, - Type: schema.TypeString, - Optional: true, + Description: `Network Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -278,8 +306,10 @@ func resourceNetworkAccessNetworkCondition() *schema.Resource { func resourceNetworkAccessNetworkConditionCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessNetworkCondition create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -292,27 +322,29 @@ func resourceNetworkAccessNetworkConditionCreate(ctx context.Context, d *schema. vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessNetworkConditions.GetNetworkAccessNetworkConditionByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessNetworkConditionRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessNetworkConditions.GetNetworkAccessNetworkConditions() - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions(m, response2) - item2, err := searchNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessNetworkConditions.GetNetworkAccessNetworkConditionByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessNetworkConditionRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessNetworkConditions.GetNetworkAccessNetworkConditions() + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions(m, response2) + item2, err := searchNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessNetworkConditionRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessNetworkConditions.CreateNetworkAccessNetworkCondition(request1) @@ -341,7 +373,8 @@ func resourceNetworkAccessNetworkConditionCreate(ctx context.Context, d *schema. func resourceNetworkAccessNetworkConditionRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessNetworkCondition read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -385,6 +418,12 @@ func resourceNetworkAccessNetworkConditionRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessNetworkConditions search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -409,6 +448,12 @@ func resourceNetworkAccessNetworkConditionRead(ctx context.Context, d *schema.Re err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessNetworkConditionByID response", + err)) + return diags + } return diags } @@ -417,7 +462,8 @@ func resourceNetworkAccessNetworkConditionRead(ctx context.Context, d *schema.Re func resourceNetworkAccessNetworkConditionUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessNetworkCondition update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -479,7 +525,8 @@ func resourceNetworkAccessNetworkConditionUpdate(ctx context.Context, d *schema. func resourceNetworkAccessNetworkConditionDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessNetworkCondition delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -783,7 +830,8 @@ func getAllItemsNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions( } func searchNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditions(m interface{}, items []isegosdk.ResponseNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditionsResponse, name string, id string) (*isegosdk.ResponseNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditionByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessNetworkConditionsGetNetworkAccessNetworkConditionByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_policy_set.go b/ciscoise/resource_network_access_policy_set.go index 6e454c96..cdc4fecf 100644 --- a/ciscoise/resource_network_access_policy_set.go +++ b/ciscoise/resource_network_access_policy_set.go @@ -226,100 +226,127 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock }, "parameters": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Required: true, MaxItems: 1, + MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "condition": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "attribute_id": &schema.Schema{ - Description: `Dictionary attribute id (Optional), used for additional verification`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeString, - Optional: true, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "link": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, "type": &schema.Schema{ + Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, @@ -328,72 +355,91 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock }, }, "default": &schema.Schema{ - Description: `Flag which indicates if this policy set is the default one`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Flag which indicates if this policy set is the default one`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Description: `The description for the policy set`, - Type: schema.TypeString, - Optional: true, + Description: `The description for the policy set`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hit_counts": &schema.Schema{ - Description: `The amount of times the policy was matched`, - Type: schema.TypeInt, - Optional: true, + Description: `The amount of times the policy was matched`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Description: `Identifier for the policy set`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the policy set`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_proxy": &schema.Schema{ - Description: `Flag which indicates if the policy set service is of type 'Proxy Sequence' or 'Allowed Protocols'`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Flag which indicates if the policy set service is of type 'Proxy Sequence' or 'Allowed Protocols'`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "link": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "href": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, "rel": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, "type": &schema.Schema{ + Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, "name": &schema.Schema{ - Description: `Given name for the policy set, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, - Type: schema.TypeString, - Optional: true, + Description: `Given name for the policy set, [Valid characters are alphanumerics, underscore, hyphen, space, period, parentheses]`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "rank": &schema.Schema{ - Description: `The rank(priority) in relation to other policy set. Lower rank is higher priority.`, - Type: schema.TypeInt, - Optional: true, + Description: `The rank(priority) in relation to other policy set. Lower rank is higher priority.`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "service_name": &schema.Schema{ - Description: `Policy set service identifier - Allowed Protocols,Server Sequence..`, - Type: schema.TypeString, - Optional: true, + Description: `Policy set service identifier - Allowed Protocols,Server Sequence..`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "state": &schema.Schema{ - Description: `The state that the policy set is in. A disabled policy set cannot be matched.`, - Type: schema.TypeString, - Optional: true, + Description: `The state that the policy set is in. A disabled policy set cannot be matched.`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -403,8 +449,10 @@ ConditionAttributes, ConditionAndBlock, ConditionOrBlock } func resourceNetworkAccessPolicySetCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -418,27 +466,29 @@ func resourceNetworkAccessPolicySetCreate(ctx context.Context, d *schema.Resourc vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessPolicySet.GetNetworkAccessPolicySetByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessPolicySetRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessPolicySet.GetNetworkAccessPolicySets() - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessPolicySetGetNetworkAccessPolicySets(m, response2) - item2, err := searchNetworkAccessPolicySetGetNetworkAccessPolicySets(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessPolicySet.GetNetworkAccessPolicySetByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessPolicySetRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessPolicySet.GetNetworkAccessPolicySets() + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessPolicySetGetNetworkAccessPolicySets(m, response2) + item2, err := searchNetworkAccessPolicySetGetNetworkAccessPolicySets(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessPolicySetRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessPolicySet.CreateNetworkAccessPolicySet(request1) @@ -467,7 +517,8 @@ func resourceNetworkAccessPolicySetCreate(ctx context.Context, d *schema.Resourc func resourceNetworkAccessPolicySetRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessPolicySet read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -512,6 +563,12 @@ func resourceNetworkAccessPolicySetRead(ctx context.Context, d *schema.ResourceD err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessPolicySets search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -536,6 +593,12 @@ func resourceNetworkAccessPolicySetRead(ctx context.Context, d *schema.ResourceD err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessPolicySetByID response", + err)) + return diags + } return diags } @@ -544,7 +607,8 @@ func resourceNetworkAccessPolicySetRead(ctx context.Context, d *schema.ResourceD func resourceNetworkAccessPolicySetUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessPolicySet update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -606,7 +670,8 @@ func resourceNetworkAccessPolicySetUpdate(ctx context.Context, d *schema.Resourc func resourceNetworkAccessPolicySetDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessPolicySet delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -985,7 +1050,8 @@ func getAllItemsNetworkAccessPolicySetGetNetworkAccessPolicySets(m interface{}, } func searchNetworkAccessPolicySetGetNetworkAccessPolicySets(m interface{}, items []isegosdk.ResponseNetworkAccessPolicySetGetNetworkAccessPolicySetsResponse, name string, id string) (*isegosdk.ResponseNetworkAccessPolicySetGetNetworkAccessPolicySetByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessPolicySetGetNetworkAccessPolicySetByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_access_policy_set_reset_hitcount.go b/ciscoise/resource_network_access_policy_set_reset_hitcount.go index 55ea8ca4..97bcb2b1 100644 --- a/ciscoise/resource_network_access_policy_set_reset_hitcount.go +++ b/ciscoise/resource_network_access_policy_set_reset_hitcount.go @@ -56,7 +56,8 @@ func resourceNetworkAccessPolicySetResetHitcount() *schema.Resource { func resourceNetworkAccessPolicySetResetHitcountCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ResetHitCountsNetworkAccessPolicySets create") log.Printf("[DEBUG] Missing ResetHitCountsNetworkAccessPolicySets create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, restyResp1, err := client.NetworkAccessPolicySet.ResetHitCountsNetworkAccessPolicySets() diff --git a/ciscoise/resource_network_access_time_date_conditions.go b/ciscoise/resource_network_access_time_date_conditions.go index 0d2c287f..fa002c61 100644 --- a/ciscoise/resource_network_access_time_date_conditions.go +++ b/ciscoise/resource_network_access_time_date_conditions.go @@ -254,166 +254,269 @@ func resourceNetworkAccessTimeDateConditions() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "attribute_name": &schema.Schema{ - Description: `Dictionary attribute name`, - Type: schema.TypeString, - Optional: true, - }, - "attribute_value": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, - }, "children": &schema.Schema{ - Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, - Type: schema.TypeList, - Optional: true, + Description: `In case type is andBlock or orBlock addtional conditions will be aggregated under this logical (OR/AND) condition`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + "attribute_id": &schema.Schema{ + Description: `Dictionary attribute id (Optional), used for additional verification`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "attribute_name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "attribute_value": &schema.Schema{ + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_name": &schema.Schema{ + Description: `Dictionary name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "dictionary_value": &schema.Schema{ + Description: `Dictionary value`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "end_date": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "name": &schema.Schema{ + Description: `Dictionary attribute name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "operator": &schema.Schema{ + Description: `Equality operator`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "start_date": &schema.Schema{ + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, }, "condition_type": &schema.Schema{ - Description: ``, - Type: schema.TypeString, - Optional: true, + Description: ``, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dates_range": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "dates_range_exception": &schema.Schema{ - Description: `

Defines for which date/s TimeAndDate condition will be matched
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which date/s TimeAndDate condition will be matched or NOT matched if used in exceptionDates prooperty
Options are - Date range, for specific date, the same date should be used for start/end date
Default - no specific dates
In order to reset the dates to have no specific dates Date format - yyyy-mm-dd (MM = month, dd = day, yyyy = year)

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Description: `Condition description`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_name": &schema.Schema{ - Description: `Dictionary name`, - Type: schema.TypeString, - Optional: true, - }, - "dictionary_value": &schema.Schema{ - Description: `Dictionary value`, - Type: schema.TypeString, - Optional: true, + Description: `Condition description`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hours_range": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "hours_range_exception": &schema.Schema{ - Description: `

Defines for which hours a TimeAndDate condition will be matched
Time format - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `

Defines for which hours a TimeAndDate condition will be matched or not matched if used in exceptionHours property
Time foramt - hh:mm ( h = hour , mm = minutes )
Default - All Day

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_negate": &schema.Schema{ - Description: `Indicates whereas this condition is in negate mode`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates whereas this condition is in negate mode`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Description: `Condition name`, - Type: schema.TypeString, - Optional: true, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, - "operator": &schema.Schema{ - Description: `Equality operator`, - Type: schema.TypeString, - Optional: true, + "name": &schema.Schema{ + Description: `Condition name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "week_days": &schema.Schema{ - Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will be matched
Days format - Arrays of WeekDay enums
Default - List of All week days

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "week_days_exception": &schema.Schema{ - Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, - Type: schema.TypeList, - Optional: true, + Description: `

Defines for which days this condition will NOT be matched
Days format - Arrays of WeekDay enums
Default - Not enabled

`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -427,8 +530,10 @@ func resourceNetworkAccessTimeDateConditions() *schema.Resource { func resourceNetworkAccessTimeDateConditionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessTimeDateConditions create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -441,27 +546,29 @@ func resourceNetworkAccessTimeDateConditionsCreate(ctx context.Context, d *schem vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.NetworkAccessTimeDateConditions.GetNetworkAccessTimeConditionByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkAccessTimeDateConditionsRead(ctx, d, m) - } - } else { - response2, _, err := client.NetworkAccessTimeDateConditions.GetNetworkAccessTimeConditions() - if response2 != nil && err == nil { - items2 := getAllItemsNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m, response2) - item2, err := searchNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.NetworkAccessTimeDateConditions.GetNetworkAccessTimeConditionByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceNetworkAccessTimeDateConditionsRead(ctx, d, m) } + } else { + response2, _, err := client.NetworkAccessTimeDateConditions.GetNetworkAccessTimeConditions() + if response2 != nil && err == nil { + items2 := getAllItemsNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m, response2) + item2, err := searchNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkAccessTimeDateConditionsRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.NetworkAccessTimeDateConditions.CreateNetworkAccessTimeCondition(request1) @@ -490,7 +597,8 @@ func resourceNetworkAccessTimeDateConditionsCreate(ctx context.Context, d *schem func resourceNetworkAccessTimeDateConditionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessTimeDateConditions read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -534,6 +642,12 @@ func resourceNetworkAccessTimeDateConditionsRead(ctx context.Context, d *schema. err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessTimeConditions search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -558,6 +672,12 @@ func resourceNetworkAccessTimeDateConditionsRead(ctx context.Context, d *schema. err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkAccessTimeConditionByID response", + err)) + return diags + } return diags } @@ -566,7 +686,8 @@ func resourceNetworkAccessTimeDateConditionsRead(ctx context.Context, d *schema. func resourceNetworkAccessTimeDateConditionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessTimeDateConditions update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -628,7 +749,8 @@ func resourceNetworkAccessTimeDateConditionsUpdate(ctx context.Context, d *schem func resourceNetworkAccessTimeDateConditionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkAccessTimeDateConditions delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1074,7 +1196,8 @@ func getAllItemsNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m } func searchNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditions(m interface{}, items []isegosdk.ResponseNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditionsResponse, name string, id string) (*isegosdk.ResponseNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditionByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNetworkAccessTimeDateConditionsGetNetworkAccessTimeConditionByIDResponse for _, item := range items { diff --git a/ciscoise/resource_network_device.go b/ciscoise/resource_network_device.go index 5d4536ff..bb580eff 100644 --- a/ciscoise/resource_network_device.go +++ b/ciscoise/resource_network_device.go @@ -355,288 +355,408 @@ func resourceNetworkDevice() *schema.Resource { Schema: map[string]*schema.Schema{ "network_device_group_list": &schema.Schema{ - Description: `List of Network Device Group names for this node`, - Type: schema.TypeList, - Optional: true, + Description: `List of Network Device Group names for this node`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "network_device_iplist": &schema.Schema{ - Description: `List of IP Subnets for this node`, - Type: schema.TypeList, - Optional: true, + Description: `List of IP Subnets for this node`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "get_ipaddress_exclude": &schema.Schema{ - Description: `It can be either single IP address or IP range address`, - Type: schema.TypeString, - Optional: true, + Description: `It can be either single IP address or IP range address`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ipaddress": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mask": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "authentication_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "dtls_required": &schema.Schema{ - Description: `This value enforces use of dtls`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `This value enforces use of dtls`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_key_wrap": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_multi_secret": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enabled": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "key_encryption_key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "key_input_format": &schema.Schema{ Description: `Allowed values: -- ASCII, -- HEXADECIMAL`, - Type: schema.TypeString, - Optional: true, + - ASCII, + - HEXADECIMAL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "message_authenticator_code_key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "network_protocol": &schema.Schema{ Description: `Allowed values: -- RADIUS, -- TACACS_PLUS`, - Type: schema.TypeString, - Optional: true, + - RADIUS, + - TACACS_PLUS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "radius_shared_secret": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "second_radius_shared_secret": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "coa_port": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dtls_dns_name": &schema.Schema{ - Description: `This value is used to verify the client identity contained in the X.509 RADIUS/DTLS client certificate`, - Type: schema.TypeString, - Optional: true, + Description: `This value is used to verify the client identity contained in the X.509 RADIUS/DTLS client certificate`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "model_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "profile_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "snmpsettings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "link_trap_query": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "mac_trap_query": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "originating_policy_services_node": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "polling_interval": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ro_community": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "version": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "software_version": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "tacacs_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "connect_mode_options": &schema.Schema{ Description: `Allowed values: -- OFF, -- ON_LEGACY, -- ON_DRAFT_COMPLIANT`, - Type: schema.TypeString, - Optional: true, + - OFF, + - ON_LEGACY, + - ON_DRAFT_COMPLIANT`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "shared_secret": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "trustsecsettings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "device_authentication_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "sga_device_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sga_device_password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "device_configuration_deployment": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "enable_mode_password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "exec_mode_password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "exec_mode_username": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_when_deploying_sgt_updates": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "push_id_support": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "sga_notification_and_updates": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "coa_source_host": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "downlaod_environment_data_every_x_seconds": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "downlaod_peer_authorization_policy_every_x_seconds": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "download_sga_cllists_every_x_seconds": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "other_sga_devices_to_trust_this_device": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "re_authentication_every_x_seconds": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "send_configuration_to_device": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "send_configuration_to_device_using": &schema.Schema{ Description: `Allowed values: -- ENABLE_USING_COA, -- ENABLE_USING_CLI, -- DISABLE_ALL`, - Type: schema.TypeString, - Optional: true, + - ENABLE_USING_COA, + - ENABLE_USING_CLI, + - DISABLE_ALL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -653,8 +773,10 @@ func resourceNetworkDevice() *schema.Resource { func resourceNetworkDeviceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDevice create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -667,24 +789,26 @@ func resourceNetworkDeviceCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.NetworkDevice.GetNetworkDeviceByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkDeviceRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.NetworkDevice.GetNetworkDeviceByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkDeviceRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.NetworkDevice.GetNetworkDeviceByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkDeviceRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.NetworkDevice.GetNetworkDeviceByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.NetworkDevice.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkDeviceRead(ctx, d, m) + } } } restyResp1, err := client.NetworkDevice.CreateNetworkDevice(request1) @@ -711,7 +835,8 @@ func resourceNetworkDeviceCreate(ctx context.Context, d *schema.ResourceData, m func resourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDevice read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -749,6 +874,12 @@ func resourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkDeviceByName response", + err)) + return diags + } return diags } @@ -775,6 +906,12 @@ func resourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkDeviceByID response", + err)) + return diags + } return diags } @@ -783,7 +920,8 @@ func resourceNetworkDeviceRead(ctx context.Context, d *schema.ResourceData, m in func resourceNetworkDeviceUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDevice update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -845,7 +983,8 @@ func resourceNetworkDeviceUpdate(ctx context.Context, d *schema.ResourceData, m func resourceNetworkDeviceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDevice delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_network_device_bulk_request.go b/ciscoise/resource_network_device_bulk_request.go index 9777680f..a52b11ca 100644 --- a/ciscoise/resource_network_device_bulk_request.go +++ b/ciscoise/resource_network_device_bulk_request.go @@ -60,7 +60,8 @@ func resourceNetworkDeviceBulkRequest() *schema.Resource { func resourceNetworkDeviceBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForNetworkDevice create") log.Printf("[DEBUG] Missing BulkRequestForNetworkDevice create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestNetworkDeviceBulkRequestBulkRequestForNetworkDevice(ctx, "parameters.0", d) diff --git a/ciscoise/resource_network_device_group.go b/ciscoise/resource_network_device_group.go index 4e7d5e76..6355d36c 100644 --- a/ciscoise/resource_network_device_group.go +++ b/ciscoise/resource_network_device_group.go @@ -92,20 +92,49 @@ func resourceNetworkDeviceGroup() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "othername": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -116,8 +145,10 @@ func resourceNetworkDeviceGroup() *schema.Resource { func resourceNetworkDeviceGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDeviceGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -130,24 +161,26 @@ func resourceNetworkDeviceGroupCreate(ctx context.Context, d *schema.ResourceDat vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.NetworkDeviceGroup.GetNetworkDeviceGroupByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkDeviceGroupRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.NetworkDeviceGroup.GetNetworkDeviceGroupByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkDeviceGroupRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.NetworkDeviceGroup.GetNetworkDeviceGroupByName(replaceAllStr(vvName, "#", ":")) // WARNING: (:) colon is used as a separator instead of (#) in the NDG name. - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceNetworkDeviceGroupRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.NetworkDeviceGroup.GetNetworkDeviceGroupByName(replaceAllStr(vvName, "#", ":")) // WARNING: (:) colon is used as a separator instead of (#) in the NDG name. + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.NetworkDeviceGroup.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceNetworkDeviceGroupRead(ctx, d, m) + } } } restyResp1, err := client.NetworkDeviceGroup.CreateNetworkDeviceGroup(request1) @@ -174,7 +207,8 @@ func resourceNetworkDeviceGroupCreate(ctx context.Context, d *schema.ResourceDat func resourceNetworkDeviceGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDeviceGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -212,6 +246,12 @@ func resourceNetworkDeviceGroupRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkDeviceGroupByName response", + err)) + return diags + } return diags } @@ -238,6 +278,12 @@ func resourceNetworkDeviceGroupRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNetworkDeviceGroupByID response", + err)) + return diags + } return diags } @@ -246,7 +292,8 @@ func resourceNetworkDeviceGroupRead(ctx context.Context, d *schema.ResourceData, func resourceNetworkDeviceGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDeviceGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -308,7 +355,8 @@ func resourceNetworkDeviceGroupUpdate(ctx context.Context, d *schema.ResourceDat func resourceNetworkDeviceGroupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NetworkDeviceGroup delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_node_deployment.go b/ciscoise/resource_node_deployment.go index e823f770..612c782e 100644 --- a/ciscoise/resource_node_deployment.go +++ b/ciscoise/resource_node_deployment.go @@ -86,51 +86,70 @@ standalone node. }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_cert_import": &schema.Schema{ - Description: `Consent to import the self-signed certificate of the registering node. `, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Consent to import the self-signed certificate of the registering node. `, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "fqdn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "hostname": &schema.Schema{ Description: `hostname path parameter. Hostname of the deployed node.`, Type: schema.TypeString, - Optional: true, + Required: true, }, - "fqdn": &schema.Schema{ + "ip_address": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, + }, + "node_status": &schema.Schema{ + Type: schema.TypeString, + Computed: true, }, "password": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Sensitive: true, + Computed: true, }, "roles": &schema.Schema{ - Description: `Roles can be empty or have many values for a node. `, - Type: schema.TypeList, - Optional: true, + Description: `Roles can be empty or have many values for a node. `, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "services": &schema.Schema{ - Description: `Services can be empty or have many values for a node. `, - Type: schema.TypeList, - Optional: true, + Description: `Services can be empty or have many values for a node. `, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "user_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -141,7 +160,8 @@ standalone node. func resourceNodeDeploymentCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeDeployment create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -198,7 +218,8 @@ func resourceNodeDeploymentCreate(ctx context.Context, d *schema.ResourceData, m func resourceNodeDeploymentRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeDeployment read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -243,6 +264,12 @@ func resourceNodeDeploymentRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetDeploymentNodes search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -268,6 +295,12 @@ func resourceNodeDeploymentRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNodeDetails response", + err)) + return diags + } return diags } @@ -276,7 +309,8 @@ func resourceNodeDeploymentRead(ctx context.Context, d *schema.ResourceData, m i func resourceNodeDeploymentUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeDeployment update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -339,7 +373,8 @@ func resourceNodeDeploymentUpdate(ctx context.Context, d *schema.ResourceData, m func resourceNodeDeploymentDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeDeployment delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -454,7 +489,8 @@ func getAllItemsNodeDeploymentGetDeploymentNodes(m interface{}, response *isegos } func searchNodeDeploymentGetDeploymentNodes(m interface{}, items []isegosdk.ResponseNodeDeploymentGetDeploymentNodesResponse, name string, fqdn string, id string) (*isegosdk.ResponseNodeDeploymentGetNodeDetailsResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNodeDeploymentGetNodeDetailsResponse for _, item := range items { diff --git a/ciscoise/resource_node_deployment_sync.go b/ciscoise/resource_node_deployment_sync.go index 50f12463..4e63d837 100644 --- a/ciscoise/resource_node_deployment_sync.go +++ b/ciscoise/resource_node_deployment_sync.go @@ -70,7 +70,8 @@ Approximate execution time 300 seconds. func resourceNodeDeploymentSyncCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SyncNode create") log.Printf("[DEBUG] Missing SyncNode create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_node_group.go b/ciscoise/resource_node_group.go index 5f21b503..2f584fdb 100644 --- a/ciscoise/resource_node_group.go +++ b/ciscoise/resource_node_group.go @@ -91,54 +91,66 @@ longer carried out among the nodes. }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mar_cache": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "query_attempts": &schema.Schema{ - Description: `The number of times Cisco ISE attempts to perform the cache entry query. (0 - 5). `, - Type: schema.TypeInt, - Optional: true, + Description: `The number of times Cisco ISE attempts to perform the cache entry query. (0 - 5). `, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "query_timeout": &schema.Schema{ - Description: `The time, in seconds, after which the cache entry query times out. (1 - 10). `, - Type: schema.TypeInt, - Optional: true, + Description: `The time, in seconds, after which the cache entry query times out. (1 - 10). `, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "replication_attempts": &schema.Schema{ - Description: `The number of times Cisco ISE attempts to perform MAR cache entry replication. (0 - 5). `, - Type: schema.TypeInt, - Optional: true, + Description: `The number of times Cisco ISE attempts to perform MAR cache entry replication. (0 - 5). `, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "replication_timeout": &schema.Schema{ - Description: `The time, in seconds, after which the cache entry replication times out. (1 - 10). `, - Type: schema.TypeInt, - Optional: true, + Description: `The time, in seconds, after which the cache entry replication times out. (1 - 10). `, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "node_group_name": &schema.Schema{ Description: `nodeGroupName path parameter. Name of the existing node group.`, Type: schema.TypeString, - Optional: true, + Required: true, }, }, }, @@ -149,7 +161,8 @@ longer carried out among the nodes. func resourceNodeGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -201,7 +214,8 @@ func resourceNodeGroupCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceNodeGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -244,6 +258,12 @@ func resourceNodeGroupRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNodeGroups search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -269,6 +289,12 @@ func resourceNodeGroupRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNodeGroup response", + err)) + return diags + } return diags } @@ -277,7 +303,8 @@ func resourceNodeGroupRead(ctx context.Context, d *schema.ResourceData, m interf func resourceNodeGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -338,7 +365,8 @@ func resourceNodeGroupUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceNodeGroupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroup delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -482,7 +510,8 @@ func getAllItemsNodeGroupGetNodeGroups(m interface{}, response *isegosdk.Respons } func searchNodeGroupGetNodeGroups(m interface{}, items []isegosdk.ResponseNodeGroupGetNodeGroupsResponse, name string, id string) (*isegosdk.ResponseNodeGroupGetNodeGroupResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseNodeGroupGetNodeGroupResponse for _, item := range items { diff --git a/ciscoise/resource_node_group_node.go b/ciscoise/resource_node_group_node.go index a489db2f..ae2dceb2 100644 --- a/ciscoise/resource_node_group_node.go +++ b/ciscoise/resource_node_group_node.go @@ -91,7 +91,8 @@ delete the node, but failover is no longer carried out if the node is not part a func resourceNodeGroupNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroupNode read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -137,7 +138,8 @@ func resourceNodeGroupNodeRead(ctx context.Context, d *schema.ResourceData, m in func resourceNodeGroupNodeCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeGroupNode create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -189,6 +191,12 @@ func resourceNodeGroupNodeCreate(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting AddNode response", + err)) + return diags + } resourceMap := make(map[string]string) resourceMap["node_group_name"] = vvNodeGroupName resourceMap["hostname"] = vvHostname @@ -199,7 +207,8 @@ func resourceNodeGroupNodeCreate(ctx context.Context, d *schema.ResourceData, m } func resourceNodeGroupNodeDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -252,6 +261,12 @@ func resourceNodeGroupNodeDelete(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting RemoveNode response", + err)) + return diags + } return diags } diff --git a/ciscoise/resource_node_primary_to_standalone.go b/ciscoise/resource_node_primary_to_standalone.go index 94ceb0ea..aea8e34a 100644 --- a/ciscoise/resource_node_primary_to_standalone.go +++ b/ciscoise/resource_node_primary_to_standalone.go @@ -71,7 +71,8 @@ node. func resourceNodePrimaryToStandaloneCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning MakeStandalone create") log.Printf("[DEBUG] Missing MakeStandalone create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, restyResp1, err := client.NodeDeployment.MakeStandalone() diff --git a/ciscoise/resource_node_secondary_to_primary.go b/ciscoise/resource_node_secondary_to_primary.go index bd3ed84f..38486dfa 100644 --- a/ciscoise/resource_node_secondary_to_primary.go +++ b/ciscoise/resource_node_secondary_to_primary.go @@ -72,7 +72,8 @@ setting is enabled in the secondary PAN. func resourceNodeSecondaryToPrimaryCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PromoteNode create") log.Printf("[DEBUG] Missing PromoteNode create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics response1, restyResp1, err := client.NodeDeployment.PromoteNode() diff --git a/ciscoise/resource_node_services_profiler_probe_config.go b/ciscoise/resource_node_services_profiler_probe_config.go index 78e3fbc6..15118a60 100644 --- a/ciscoise/resource_node_services_profiler_probe_config.go +++ b/ciscoise/resource_node_services_profiler_probe_config.go @@ -274,53 +274,54 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "hostname": &schema.Schema{ - Description: `hostname path parameter. Hostname of the node.`, - Type: schema.TypeString, - Required: true, - }, + "active_directory": &schema.Schema{ Description: `The Active Directory probe queries the Active Directory for Windows information.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "days_before_rescan": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, }, + "days_before_rescan": &schema.Schema{ + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, "dhcp": &schema.Schema{ Description: `The DHCP probe listens for DHCP packets from IP helpers.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interfaces": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interface": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, "port": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, @@ -328,19 +329,19 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes "dhcp_span": &schema.Schema{ Description: `The DHCP SPAN probe collects DHCP packets.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interfaces": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interface": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, @@ -351,33 +352,38 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes "dns": &schema.Schema{ Description: `The DNS probe performs a DNS lookup for the FQDN.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "timeout": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, }, + "hostname": &schema.Schema{ + Description: `hostname path parameter. Hostname of the node.`, + Type: schema.TypeString, + Required: true, + }, "http": &schema.Schema{ Description: `The HTTP probe receives and parses HTTP packets.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interfaces": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interface": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, @@ -388,78 +394,72 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes "netflow": &schema.Schema{ Description: `The NetFlow probe collects the NetFlow packets that are sent to it from routers.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interfaces": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interface": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, "port": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, }, "nmap": &schema.Schema{ - Description: `The NMAP probe scans endpoints for open ports and OS. - If set to true, it will activate the NMAP probe. - If set to false, it will deactivate the NMAP probe. - Finally, if set to empty string or no-set (default), it will maintain the NMAP probe state. - `, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The NMAP probe scans endpoints for open ports and OS.`, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "pxgrid": &schema.Schema{ - Description: `The pxGrid probe fetches attributes of MAC address or IP address as a subscriber from the pxGrid queue. - If set to true, it will activate the pxGrid probe. - If set to false, it will deactivate the pxGrid probe. - Finally, if set to empty string or no-set (default), it will maintain the pxGrid probe state. - `, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The pxGrid probe fetches attributes of MAC address or IP address as a subscriber from the pxGrid queue.`, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "radius": &schema.Schema{ - Description: `The RADIUS probe collects RADIUS session attributes as well as CDP, LLDP, DHCP, HTTP, and MDM attributes from IOS Sensors. - If set to true, it will activate the RADIUS probe. - If set to false, it will deactivate the RADIUS probe. - Finally, if set to empty string or no-set (default), it will maintain the RADIUS probe state. - `, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `The RADIUS probe collects RADIUS session attributes as well as CDP, LLDP, DHCP, HTTP, and MDM attributes from IOS Sensors.`, + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "snmp_query": &schema.Schema{ Description: `The SNMP query probe collects details from network devices such as interface, CDP, LLDP, and ARP.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "event_timeout": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, "retries": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, "timeout": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, @@ -467,36 +467,34 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes "snmp_trap": &schema.Schema{ Description: `The SNMP trap probe receives linkup, linkdown, and MAC notification traps from network devices.`, Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interfaces": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "interface": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, }, }, }, }, "link_trap_query": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + Computed: true, }, "mac_trap_query": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + Computed: true, }, "port": &schema.Schema{ Type: schema.TypeInt, - Optional: true, + Computed: true, }, }, }, @@ -511,7 +509,8 @@ Ex: Below payload will disable NMAP, PxGrid and SNMPTRAP probes func resourceNodeServicesProfilerProbeConfigCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesProfilerProbeConfig create") log.Printf("[DEBUG] Missing NodeServicesProfilerProbeConfig create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -545,7 +544,8 @@ func resourceNodeServicesProfilerProbeConfigCreate(ctx context.Context, d *schem func resourceNodeServicesProfilerProbeConfigRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesProfilerProbeConfig read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -577,6 +577,12 @@ func resourceNodeServicesProfilerProbeConfigRead(ctx context.Context, d *schema. err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetProfilerProbeConfig response", + err)) + return diags + } return diags } @@ -585,7 +591,8 @@ func resourceNodeServicesProfilerProbeConfigRead(ctx context.Context, d *schema. func resourceNodeServicesProfilerProbeConfigUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesProfilerProbeConfig update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_node_services_sxp_interfaces.go b/ciscoise/resource_node_services_sxp_interfaces.go index 4d2ca3c7..3bbc4d02 100644 --- a/ciscoise/resource_node_services_sxp_interfaces.go +++ b/ciscoise/resource_node_services_sxp_interfaces.go @@ -48,11 +48,11 @@ func resourceNodeServicesSxpInterfaces() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "hostname": &schema.Schema{ Description: `hostname path parameter. Hostname of the node.`, Type: schema.TypeString, @@ -61,6 +61,7 @@ func resourceNodeServicesSxpInterfaces() *schema.Resource { "interface": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, }, }, @@ -72,7 +73,8 @@ func resourceNodeServicesSxpInterfaces() *schema.Resource { func resourceNodeServicesSxpInterfacesCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesSxpInterfaces create") log.Printf("[DEBUG] Missing NodeServicesSxpInterfaces create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -107,7 +109,8 @@ func resourceNodeServicesSxpInterfacesCreate(ctx context.Context, d *schema.Reso func resourceNodeServicesSxpInterfacesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesSxpInterfaces read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -139,6 +142,12 @@ func resourceNodeServicesSxpInterfacesRead(ctx context.Context, d *schema.Resour err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpInterface response", + err)) + return diags + } return diags } @@ -147,7 +156,8 @@ func resourceNodeServicesSxpInterfacesRead(ctx context.Context, d *schema.Resour func resourceNodeServicesSxpInterfacesUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning NodeServicesSxpInterfaces update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_node_standalone_to_primary.go b/ciscoise/resource_node_standalone_to_primary.go index 7761fdd9..493786f5 100644 --- a/ciscoise/resource_node_standalone_to_primary.go +++ b/ciscoise/resource_node_standalone_to_primary.go @@ -74,7 +74,8 @@ node (PAN). } func resourceNodeStandaloneToPrimaryCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_pan_ha.go b/ciscoise/resource_pan_ha.go index aee430c4..4d67a3d5 100644 --- a/ciscoise/resource_pan_ha.go +++ b/ciscoise/resource_pan_ha.go @@ -95,35 +95,47 @@ func resourcePanHa() *schema.Resource { Required: true, }, "failed_attempts": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "polling_interval": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "primary_health_check_node": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "hostname": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "secondary_health_check_node": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "hostname": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -143,7 +155,8 @@ secondary_health_check_node_hostname func resourcePanHaCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PanHa create") log.Printf("[DEBUG] Missing PanHa create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -199,7 +212,8 @@ func resourcePanHaCreate(ctx context.Context, d *schema.ResourceData, m interfac func resourcePanHaRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PanHa read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -226,6 +240,12 @@ func resourcePanHaRead(ctx context.Context, d *schema.ResourceData, m interface{ err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetPanHaStatus response", + err)) + return diags + } return diags } @@ -234,7 +254,8 @@ func resourcePanHaRead(ctx context.Context, d *schema.ResourceData, m interface{ func resourcePanHaUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PanHa update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_patch.go b/ciscoise/resource_patch.go index dce25a89..f69f0e25 100644 --- a/ciscoise/resource_patch.go +++ b/ciscoise/resource_patch.go @@ -45,24 +45,30 @@ a certain period of time. Computed: true, }, "parameters": &schema.Schema{ - Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Type: schema.TypeList, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + MaxItems: 1, + MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "repository_name": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, "patch_number": &schema.Schema{ - Type: schema.TypeInt, - Required: true, - ForceNew: true, + Type: schema.TypeInt, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + ForceNew: true, }, "patch_name": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, }, }, @@ -89,7 +95,8 @@ a certain period of time. func resourcePatchCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Patch create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -183,7 +190,8 @@ func resourcePatchCreate(ctx context.Context, d *schema.ResourceData, m interfac func resourcePatchRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Patch read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -226,7 +234,8 @@ func resourcePatchUpdate(ctx context.Context, d *schema.ResourceData, m interfac func resourcePatchDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Patch delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_portal_global_setting.go b/ciscoise/resource_portal_global_setting.go index 23f00593..301c9278 100644 --- a/ciscoise/resource_portal_global_setting.go +++ b/ciscoise/resource_portal_global_setting.go @@ -77,22 +77,46 @@ func resourcePortalGlobalSetting() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "customization": &schema.Schema{ Description: `Allowed values: -- HTML, -- HTMLANDJAVASCRIPT`, - Type: schema.TypeString, - Optional: true, + - HTML, + - HTMLANDJAVASCRIPT`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, @@ -104,7 +128,8 @@ func resourcePortalGlobalSetting() *schema.Resource { func resourcePortalGlobalSettingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalGlobalSetting create") log.Printf("[DEBUG] Missing PortalGlobalSetting create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -137,7 +162,8 @@ func resourcePortalGlobalSettingCreate(ctx context.Context, d *schema.ResourceDa func resourcePortalGlobalSettingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalGlobalSetting read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -182,6 +208,12 @@ func resourcePortalGlobalSettingRead(ctx context.Context, d *schema.ResourceData err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetPortalGlobalSettings search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -207,6 +239,12 @@ func resourcePortalGlobalSettingRead(ctx context.Context, d *schema.ResourceData err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetPortalGlobalSettingByID response", + err)) + return diags + } return diags } @@ -215,7 +253,8 @@ func resourcePortalGlobalSettingRead(ctx context.Context, d *schema.ResourceData func resourcePortalGlobalSettingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalGlobalSetting update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -303,7 +342,8 @@ func expandRequestPortalGlobalSettingUpdatePortalGlobalSettingByIDPortalCustomiz } func getAllItemsPortalGlobalSettingGetPortalGlobalSettings(m interface{}, response *isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettings, queryParams *isegosdk.GetPortalGlobalSettingsQueryParams) []isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettingsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettingsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -331,7 +371,8 @@ func getAllItemsPortalGlobalSettingGetPortalGlobalSettings(m interface{}, respon } func searchPortalGlobalSettingGetPortalGlobalSettings(m interface{}, items []isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettingsSearchResultResources, name string, id string) (*isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettingByIDPortalCustomizationGlobalSetting, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponsePortalGlobalSettingGetPortalGlobalSettingByIDPortalCustomizationGlobalSetting for _, item := range items { diff --git a/ciscoise/resource_portal_theme.go b/ciscoise/resource_portal_theme.go index 69996b9d..fc8d47e4 100644 --- a/ciscoise/resource_portal_theme.go +++ b/ciscoise/resource_portal_theme.go @@ -94,21 +94,50 @@ func resourcePortalTheme() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `Portal Theme for all portals`, - Type: schema.TypeString, - Optional: true, + Description: `Portal Theme for all portals`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -119,8 +148,10 @@ func resourcePortalTheme() *schema.Resource { func resourcePortalThemeCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalTheme create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -133,29 +164,31 @@ func resourcePortalThemeCreate(ctx context.Context, d *schema.ResourceData, m in vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.PortalTheme.GetPortalThemeByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourcePortalThemeRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetPortalThemesQueryParams{} - - response2, _, err := client.PortalTheme.GetPortalThemes(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsPortalThemeGetPortalThemes(m, response2, &queryParams2) - item2, err := searchPortalThemeGetPortalThemes(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.PortalTheme.GetPortalThemeByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourcePortalThemeRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetPortalThemesQueryParams{} + + response2, _, err := client.PortalTheme.GetPortalThemes(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsPortalThemeGetPortalThemes(m, response2, &queryParams2) + item2, err := searchPortalThemeGetPortalThemes(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourcePortalThemeRead(ctx, d, m) + } + } } } restyResp1, err := client.PortalTheme.CreatePortalTheme(request1) @@ -182,7 +215,8 @@ func resourcePortalThemeCreate(ctx context.Context, d *schema.ResourceData, m in func resourcePortalThemeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalTheme read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -229,6 +263,12 @@ func resourcePortalThemeRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetPortalThemes search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -254,6 +294,12 @@ func resourcePortalThemeRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetPortalThemeByID response", + err)) + return diags + } return diags } @@ -262,7 +308,8 @@ func resourcePortalThemeRead(ctx context.Context, d *schema.ResourceData, m inte func resourcePortalThemeUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalTheme update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -327,7 +374,8 @@ func resourcePortalThemeUpdate(ctx context.Context, d *schema.ResourceData, m in func resourcePortalThemeDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PortalTheme delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -449,7 +497,8 @@ func expandRequestPortalThemeUpdatePortalThemeByIDPortalTheme(ctx context.Contex } func getAllItemsPortalThemeGetPortalThemes(m interface{}, response *isegosdk.ResponsePortalThemeGetPortalThemes, queryParams *isegosdk.GetPortalThemesQueryParams) []isegosdk.ResponsePortalThemeGetPortalThemesSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponsePortalThemeGetPortalThemesSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -477,7 +526,8 @@ func getAllItemsPortalThemeGetPortalThemes(m interface{}, response *isegosdk.Res } func searchPortalThemeGetPortalThemes(m interface{}, items []isegosdk.ResponsePortalThemeGetPortalThemesSearchResultResources, name string, id string) (*isegosdk.ResponsePortalThemeGetPortalThemeByIDPortalTheme, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponsePortalThemeGetPortalThemeByIDPortalTheme for _, item := range items { diff --git a/ciscoise/resource_proxy_connection_settings.go b/ciscoise/resource_proxy_connection_settings.go index 012028e2..2281722e 100644 --- a/ciscoise/resource_proxy_connection_settings.go +++ b/ciscoise/resource_proxy_connection_settings.go @@ -103,36 +103,48 @@ pxGrid Cloud Schema: map[string]*schema.Schema{ "bypass_hosts": &schema.Schema{ - Description: `Bypass hosts for the proxy connection`, - Type: schema.TypeString, - Optional: true, + Description: `Bypass hosts for the proxy connection`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fqdn": &schema.Schema{ - Description: `proxy IP address or DNS-resolvable host name`, - Type: schema.TypeString, - Optional: true, + Description: `proxy IP address or DNS-resolvable host name`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "password": &schema.Schema{ - Description: `Password for the proxy connection`, - Type: schema.TypeString, - Optional: true, - Sensitive: true, + Description: `Password for the proxy connection`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Sensitive: true, }, "password_required": &schema.Schema{ - Description: `Indicates whether password configuration is required for Proxy.`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Indicates whether password configuration is required for Proxy.`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "port": &schema.Schema{ - Description: `Port for proxy connection. should be between 1 and 65535`, - Type: schema.TypeInt, - Optional: true, + Description: `Port for proxy connection. should be between 1 and 65535`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "user_name": &schema.Schema{ - Description: `User name for the proxy connection`, - Type: schema.TypeString, - Optional: true, + Description: `User name for the proxy connection`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -144,7 +156,8 @@ pxGrid Cloud func resourceProxyConnectionSettingsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ProxyConnectionSettings create") log.Printf("[DEBUG] Missing ProxyConnectionSettings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -177,7 +190,8 @@ func resourceProxyConnectionSettingsCreate(ctx context.Context, d *schema.Resour func resourceProxyConnectionSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ProxyConnectionSettings read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -204,6 +218,12 @@ func resourceProxyConnectionSettingsRead(ctx context.Context, d *schema.Resource err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetProxyConnection response", + err)) + return diags + } return diags } @@ -212,7 +232,8 @@ func resourceProxyConnectionSettingsRead(ctx context.Context, d *schema.Resource func resourceProxyConnectionSettingsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ProxyConnectionSettings update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_px_grid_node.go b/ciscoise/resource_px_grid_node.go index b4c4a8f5..0a789f04 100644 --- a/ciscoise/resource_px_grid_node.go +++ b/ciscoise/resource_px_grid_node.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -97,6 +95,47 @@ func resourcePxGridNode() *schema.Resource { Type: schema.TypeString, Required: true, }, + "auth_method": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "description": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "groups": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "status": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -106,7 +145,8 @@ func resourcePxGridNode() *schema.Resource { func resourcePxGridNodeCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PxGridNode create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -130,7 +170,8 @@ func resourcePxGridNodeCreate(ctx context.Context, d *schema.ResourceData, m int func resourcePxGridNodeRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PxGridNode read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -173,7 +214,8 @@ func resourcePxGridNodeUpdate(ctx context.Context, d *schema.ResourceData, m int func resourcePxGridNodeDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning PxGridNode delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_px_grid_settings_auto_approve.go b/ciscoise/resource_px_grid_settings_auto_approve.go index 789751ad..e011acaf 100644 --- a/ciscoise/resource_px_grid_settings_auto_approve.go +++ b/ciscoise/resource_px_grid_settings_auto_approve.go @@ -64,7 +64,8 @@ func resourcePxGridSettingsAutoApprove() *schema.Resource { func resourcePxGridSettingsAutoApproveCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AutoapprovePxGridSettings create") log.Printf("[DEBUG] Missing AutoapprovePxGridSettings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestPxGridSettingsAutoApproveAutoapprovePxGridSettings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_pxgrid_access_secret.go b/ciscoise/resource_pxgrid_access_secret.go index ea4b9a97..2dcd485e 100644 --- a/ciscoise/resource_pxgrid_access_secret.go +++ b/ciscoise/resource_pxgrid_access_secret.go @@ -55,7 +55,8 @@ func resourcePxgridAccessSecret() *schema.Resource { func resourcePxgridAccessSecretCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning AccessSecret create") log.Printf("[DEBUG] Missing AccessSecret create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_pxgrid_account_activate.go b/ciscoise/resource_pxgrid_account_activate.go index a128f19b..bbe06b49 100644 --- a/ciscoise/resource_pxgrid_account_activate.go +++ b/ciscoise/resource_pxgrid_account_activate.go @@ -55,7 +55,8 @@ func resourcePxgridAccountActivate() *schema.Resource { func resourcePxgridAccountActivateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ActivateAccount create") log.Printf("[DEBUG] Missing ActivateAccount create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestPxgridAccountActivateActivateAccount(ctx, "parameters.0", d) diff --git a/ciscoise/resource_pxgrid_account_create.go b/ciscoise/resource_pxgrid_account_create.go index 5c28ae11..aa1bcba1 100644 --- a/ciscoise/resource_pxgrid_account_create.go +++ b/ciscoise/resource_pxgrid_account_create.go @@ -55,7 +55,8 @@ func resourcePxgridAccountCreate() *schema.Resource { func resourcePxgridAccountCreateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning CreateAccount create") log.Printf("[DEBUG] Missing CreateAccount create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_pxgrid_authorization.go b/ciscoise/resource_pxgrid_authorization.go index 8e3fa27b..03584bc6 100644 --- a/ciscoise/resource_pxgrid_authorization.go +++ b/ciscoise/resource_pxgrid_authorization.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -48,7 +46,8 @@ func resourcePxgridAuthorization() *schema.Resource { func resourcePxgridAuthorizationCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Authorization create") log.Printf("[DEBUG] Missing Authorization create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, err := client.Provider.Authorization() diff --git a/ciscoise/resource_pxgrid_service_lookup.go b/ciscoise/resource_pxgrid_service_lookup.go index f250978c..568d4e24 100644 --- a/ciscoise/resource_pxgrid_service_lookup.go +++ b/ciscoise/resource_pxgrid_service_lookup.go @@ -55,7 +55,8 @@ func resourcePxgridServiceLookup() *schema.Resource { func resourcePxgridServiceLookupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning LookupService create") log.Printf("[DEBUG] Missing LookupService create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestPxgridServiceLookupLookupService(ctx, "parameters.0", d) diff --git a/ciscoise/resource_pxgrid_service_register.go b/ciscoise/resource_pxgrid_service_register.go index 3e8c5baa..9db13c57 100644 --- a/ciscoise/resource_pxgrid_service_register.go +++ b/ciscoise/resource_pxgrid_service_register.go @@ -55,7 +55,8 @@ func resourcePxgridServiceRegister() *schema.Resource { func resourcePxgridServiceRegisterCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RegisterService create") log.Printf("[DEBUG] Missing RegisterService create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_pxgrid_service_reregister.go b/ciscoise/resource_pxgrid_service_reregister.go index 1bca4fbd..cd1bd364 100644 --- a/ciscoise/resource_pxgrid_service_reregister.go +++ b/ciscoise/resource_pxgrid_service_reregister.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -48,7 +46,8 @@ func resourcePxgridServiceReregister() *schema.Resource { func resourcePxgridServiceReregisterCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ReregisterService create") log.Printf("[DEBUG] Missing ReregisterService create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics d.Set("parameters", nil) diff --git a/ciscoise/resource_pxgrid_service_unregister.go b/ciscoise/resource_pxgrid_service_unregister.go index 6332c8ae..795f10d2 100644 --- a/ciscoise/resource_pxgrid_service_unregister.go +++ b/ciscoise/resource_pxgrid_service_unregister.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -48,7 +46,8 @@ func resourcePxgridServiceUnregister() *schema.Resource { func resourcePxgridServiceUnregisterCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning UnregisterService create") log.Printf("[DEBUG] Missing UnregisterService create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, err := client.Provider.UnregisterService() diff --git a/ciscoise/resource_radius_server_sequence.go b/ciscoise/resource_radius_server_sequence.go index 86b3855d..a27d7dd5 100644 --- a/ciscoise/resource_radius_server_sequence.go +++ b/ciscoise/resource_radius_server_sequence.go @@ -206,140 +206,211 @@ func resourceRadiusServerSequence() *schema.Resource { Schema: map[string]*schema.Schema{ "before_accept_attr_manipulators_list": &schema.Schema{ - Description: `The beforeAcceptAttrManipulators is required only if useAttrSetBeforeAcc is true`, - Type: schema.TypeList, - Optional: true, + Description: `The beforeAcceptAttrManipulators is required only if useAttrSetBeforeAcc is true`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "action": &schema.Schema{ Description: `Allowed Values: -- ADD, -- UPDATE, -- REMOVE, -- REMOVEANY`, - Type: schema.TypeString, - Optional: true, + - ADD, + - UPDATE, + - REMOVE, + - REMOVEANY`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "changed_val": &schema.Schema{ - Description: `The changedVal is required only if the action equals to 'UPDATE'`, - Type: schema.TypeString, - Optional: true, + Description: `The changedVal is required only if the action equals to 'UPDATE'`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "on_request_attr_manipulator_list": &schema.Schema{ - Description: `The onRequestAttrManipulators is required only if useAttrSetOnRequest is true`, - Type: schema.TypeList, - Optional: true, + Description: `The onRequestAttrManipulators is required only if useAttrSetOnRequest is true`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "action": &schema.Schema{ Description: `Allowed Values: -- ADD, -- UPDATE, -- REMOVE, -- REMOVEANY`, - Type: schema.TypeString, - Optional: true, + - ADD, + - UPDATE, + - REMOVE, + - REMOVEANY`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "attribute_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "changed_val": &schema.Schema{ - Description: `The changedVal is required only if the action equals to 'UPDATE'`, - Type: schema.TypeString, - Optional: true, + Description: `The changedVal is required only if the action equals to 'UPDATE'`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "dictionary_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "radius_server_list": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "continue_authorz_policy": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "local_accounting": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "prefix_separator": &schema.Schema{ - Description: `The prefixSeparator is required only if stripPrefix is true. The maximum length is 1 character`, - Type: schema.TypeString, - Optional: true, + Description: `The prefixSeparator is required only if stripPrefix is true. The maximum length is 1 character`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "remote_accounting": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "strip_prefix": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "strip_suffix": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "suffix_separator": &schema.Schema{ - Description: `The suffixSeparator is required only if stripSuffix is true. The maximum length is 1 character`, - Type: schema.TypeString, - Optional: true, + Description: `The suffixSeparator is required only if stripSuffix is true. The maximum length is 1 character`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "use_attr_set_before_acc": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "use_attr_set_on_request": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -350,8 +421,10 @@ func resourceRadiusServerSequence() *schema.Resource { func resourceRadiusServerSequenceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RadiusServerSequence create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -364,29 +437,31 @@ func resourceRadiusServerSequenceCreate(ctx context.Context, d *schema.ResourceD vName, _ := resourceItem["name"] vvID := interfaceToString(vID) vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.RadiusServerSequence.GetRadiusServerSequenceByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceRadiusServerSequenceRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetRadiusServerSequenceQueryParams{} - - response2, _, err := client.RadiusServerSequence.GetRadiusServerSequence(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsRadiusServerSequenceGetRadiusServerSequence(m, response2, &queryParams2) - item2, err := searchRadiusServerSequenceGetRadiusServerSequence(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.RadiusServerSequence.GetRadiusServerSequenceByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceRadiusServerSequenceRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetRadiusServerSequenceQueryParams{} + + response2, _, err := client.RadiusServerSequence.GetRadiusServerSequence(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsRadiusServerSequenceGetRadiusServerSequence(m, response2, &queryParams2) + item2, err := searchRadiusServerSequenceGetRadiusServerSequence(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceRadiusServerSequenceRead(ctx, d, m) + } + } } } restyResp1, err := client.RadiusServerSequence.CreateRadiusServerSequence(request1) @@ -413,7 +488,8 @@ func resourceRadiusServerSequenceCreate(ctx context.Context, d *schema.ResourceD func resourceRadiusServerSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RadiusServerSequence read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -459,6 +535,12 @@ func resourceRadiusServerSequenceRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRadiusServerSequence search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -484,6 +566,12 @@ func resourceRadiusServerSequenceRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRadiusServerSequenceByID response", + err)) + return diags + } return diags } @@ -492,7 +580,8 @@ func resourceRadiusServerSequenceRead(ctx context.Context, d *schema.ResourceDat func resourceRadiusServerSequenceUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RadiusServerSequence update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -556,7 +645,8 @@ func resourceRadiusServerSequenceUpdate(ctx context.Context, d *schema.ResourceD func resourceRadiusServerSequenceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RadiusServerSequence delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -949,7 +1039,8 @@ func expandRequestRadiusServerSequenceUpdateRadiusServerSequenceByIDRadiusServer } func getAllItemsRadiusServerSequenceGetRadiusServerSequence(m interface{}, response *isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequence, queryParams *isegosdk.GetRadiusServerSequenceQueryParams) []isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequenceSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequenceSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -977,7 +1068,8 @@ func getAllItemsRadiusServerSequenceGetRadiusServerSequence(m interface{}, respo } func searchRadiusServerSequenceGetRadiusServerSequence(m interface{}, items []isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequenceSearchResultResources, name string, id string) (*isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequenceByIDRadiusServerSequence, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseRadiusServerSequenceGetRadiusServerSequenceByIDRadiusServerSequence for _, item := range items { diff --git a/ciscoise/resource_renew_certificate.go b/ciscoise/resource_renew_certificate.go index 97832158..0736455c 100644 --- a/ciscoise/resource_renew_certificate.go +++ b/ciscoise/resource_renew_certificate.go @@ -91,7 +91,8 @@ func resourceRenewCertificate() *schema.Resource { func resourceRenewCertificateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RenewCerts create") log.Printf("[DEBUG] Missing RenewCerts create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_repository.go b/ciscoise/resource_repository.go index 1ec76b0a..b6c9ed43 100644 --- a/ciscoise/resource_repository.go +++ b/ciscoise/resource_repository.go @@ -82,9 +82,8 @@ func resourceRepository() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -92,35 +91,42 @@ func resourceRepository() *schema.Resource { Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "name": &schema.Schema{ - Description: `repositoryName path parameter. Unique name for a repository. Repository name should be less than 80 characters and can contain alphanumeric, underscore, hyphen and dot characters.`, + Description: `Repository name should be less than 80 characters and can contain alphanumeric, underscore, hyphen and dot characters.`, Type: schema.TypeString, Optional: true, + Computed: true, }, "password": &schema.Schema{ Description: `Password can contain alphanumeric and/or special characters.`, Type: schema.TypeString, Optional: true, Sensitive: true, + Computed: true, }, "path": &schema.Schema{ Description: `Path should always start with "/" and can contain alphanumeric, underscore, hyphen and dot characters.`, Type: schema.TypeString, Optional: true, + Computed: true, }, "protocol": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "server_name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "user_name": &schema.Schema{ Description: `Username may contain alphanumeric and _-./@\\$ characters.`, Type: schema.TypeString, Optional: true, + Computed: true, }, }, }, @@ -131,7 +137,8 @@ func resourceRepository() *schema.Resource { func resourceRepositoryCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Repository create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -183,7 +190,8 @@ func resourceRepositoryCreate(ctx context.Context, d *schema.ResourceData, m int func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Repository read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -226,6 +234,12 @@ func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRepositories search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -251,6 +265,12 @@ func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRepository response", + err)) + return diags + } return diags } @@ -259,7 +279,8 @@ func resourceRepositoryRead(ctx context.Context, d *schema.ResourceData, m inter func resourceRepositoryUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Repository update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -320,7 +341,8 @@ func resourceRepositoryUpdate(ctx context.Context, d *schema.ResourceData, m int func resourceRepositoryDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Repository delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -451,7 +473,8 @@ func getAllItemsRepositoryGetRepositories(m interface{}, response *isegosdk.Resp } func searchRepositoryGetRepositories(m interface{}, items []isegosdk.ResponseRepositoryGetRepositoriesResponse, name string, id string) (*isegosdk.ResponseRepositoryGetRepositoryResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseRepositoryGetRepositoryResponse for _, item := range items { diff --git a/ciscoise/resource_rest_id_store.go b/ciscoise/resource_rest_id_store.go index 40049dd3..1d1363af 100644 --- a/ciscoise/resource_rest_id_store.go +++ b/ciscoise/resource_rest_id_store.go @@ -138,62 +138,102 @@ Options are: Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ers_rest_idstore_attributes": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "headers": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "predefined": &schema.Schema{ Description: `The cloud provider connected to of the RestIDStore. -Options are: -- Azure, -- Okta, -- None`, - Type: schema.TypeString, - Optional: true, + Options are: + - Azure, + - Okta, + - None`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "root_url": &schema.Schema{ - Description: `url of the root of the RestIDStore`, - Type: schema.TypeString, - Optional: true, + Description: `url of the root of the RestIDStore`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "username_suffix": &schema.Schema{ - Description: `Suffix of the username domain`, - Type: schema.TypeString, - Optional: true, + Description: `Suffix of the username domain`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -204,8 +244,10 @@ Options are: func resourceRestIDStoreCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RestIDStore create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -218,24 +260,26 @@ func resourceRestIDStoreCreate(ctx context.Context, d *schema.ResourceData, m in vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.RestidStore.GetRestIDStoreByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceRestIDStoreRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.RestidStore.GetRestIDStoreByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceRestIDStoreRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.RestidStore.GetRestIDStoreByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceRestIDStoreRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.RestidStore.GetRestIDStoreByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.ERSRestIDStore.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceRestIDStoreRead(ctx, d, m) + } } } restyResp1, err := client.RestidStore.CreateRestIDStore(request1) @@ -262,7 +306,8 @@ func resourceRestIDStoreCreate(ctx context.Context, d *schema.ResourceData, m in func resourceRestIDStoreRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RestIDStore read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -300,6 +345,12 @@ func resourceRestIDStoreRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRestIDStoreByName response", + err)) + return diags + } return diags } @@ -326,6 +377,12 @@ func resourceRestIDStoreRead(ctx context.Context, d *schema.ResourceData, m inte err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetRestIDStoreByID response", + err)) + return diags + } return diags } @@ -334,7 +391,8 @@ func resourceRestIDStoreRead(ctx context.Context, d *schema.ResourceData, m inte func resourceRestIDStoreUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RestIDStore update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -396,7 +454,8 @@ func resourceRestIDStoreUpdate(ctx context.Context, d *schema.ResourceData, m in func resourceRestIDStoreDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning RestIDStore delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_self_registered_portal.go b/ciscoise/resource_self_registered_portal.go index 8885e805..ab59c711 100644 --- a/ciscoise/resource_self_registered_portal.go +++ b/ciscoise/resource_self_registered_portal.go @@ -1201,88 +1201,108 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Description: `Defines all of the Portal Customizations available`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the Portal Customizations available`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -1291,42 +1311,52 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "language": &schema.Schema{ - Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Description: `Represent the entire page customization as a giant dictionary`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Represent the entire page customization as a giant dictionary`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `The Dictionary will be exposed here as key value pair`, - Type: schema.TypeList, - Optional: true, + Description: `The Dictionary will be exposed here as key value pair`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -1335,55 +1365,71 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "portal_theme": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -1392,217 +1438,295 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_frequency": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed Values: -- FIRSTLOGIN, -- EVERYLOGIN, -- RECURRING`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed Values: + - FIRSTLOGIN, + - EVERYLOGIN, + - RECURRING`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_frequency_interval_days": &schema.Schema{ - Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Require the portal user to read and accept an AUP`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to read and accept an AUP`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_scrolling": &schema.Schema{ Description: `Require the portal user to scroll to the end of the AUP. -Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "skip_aup_for_employees": &schema.Schema{ - Description: `Only valid if requireAupAcceptance = trueG`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only valid if requireAupAcceptance = trueG`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "use_diff_aup_for_employees": &schema.Schema{ - Description: `Only valid if requireAupAcceptance = trueG`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only valid if requireAupAcceptance = trueG`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "auth_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "byod_settings": &schema.Schema{ - Description: `Configuration of BYOD Device Welcome, Registration and Success steps`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD Device Welcome, Registration and Success steps`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "byod_registration_settings": &schema.Schema{ - Description: `Configuration of BYOD endpoint Registration step configuration`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD endpoint Registration step configuration`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_point_identity_group_id": &schema.Schema{ - Description: `Identity group id for which endpoint belongs`, - Type: schema.TypeString, - Optional: true, + Description: `Identity group id for which endpoint belongs`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "show_device_id": &schema.Schema{ - Description: `Display Device ID field during registration`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Display Device ID field during registration`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "byod_registration_success_settings": &schema.Schema{ - Description: `Configuration of BYOD endpoint Registration Success step configuration`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD endpoint Registration Success step configuration`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Description: `Target URL for redirection, used when successRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Description: `Target URL for redirection, used when successRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ Description: `After an Authentication Success where should device be redirected. -Allowed values: -- AUTHSUCCESSPAGE, -- ORIGINATINGURL, -- URL`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - AUTHSUCCESSPAGE, + - ORIGINATINGURL, + - URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "byod_welcome_settings": &schema.Schema{ - Description: `Configuration of BYOD endpoint welcome step configuration`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD endpoint welcome step configuration`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_byo_d": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_guest_access": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_mdm": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ Description: `Require BYOD devices to scroll down to the bottom of the AUP, -Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1611,670 +1735,849 @@ Only valid if includeAup = true`, }, }, "guest_change_password_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_change_passwd_at_first_login": &schema.Schema{ - Description: `Allow guest to change their own passwords`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow guest to change their own passwords`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "guest_device_registration_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_guests_to_register_devices": &schema.Schema{ - Description: `Allow guests to register devices`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow guests to register devices`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "auto_register_guest_devices": &schema.Schema{ - Description: `Automatically register guest devices`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Automatically register guest devices`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "login_page_settings": &schema.Schema{ - Description: `Portal Login Page settings groups follow`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Portal Login Page settings groups follow`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "access_code": &schema.Schema{ - Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, - Type: schema.TypeString, - Optional: true, + Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_alternate_guest_portal": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_forgot_password": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_to_change_password": &schema.Schema{ - Description: `Require the portal user to enter an access code`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to enter an access code`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_to_create_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_to_use_social_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_show_guest_form": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "alternate_guest_portal": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_failed_attempts_before_rate_limit": &schema.Schema{ - Description: `Maximum failed login attempts before rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum failed login attempts before rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "require_access_code": &schema.Schema{ - Description: `Require the portal user to enter an access code`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to enter an access code`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Description: `Require the portal user to accept the AUP. Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to accept the AUP. Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "social_configs": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "social_media_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "social_media_value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "time_between_logins_during_rate_limit": &schema.Schema{ - Description: `Time between login attempts when rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Time between login attempts when rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0, -- eth1, -- eth2, -- eth3, -- eth4, -- eth5, -- bond0, -- bond1, -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0, + - eth1, + - eth2, + - eth3, + - eth4, + - eth5, + - bond0, + - bond1, + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "always_used_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "assigned_guest_type_for_employee": &schema.Schema{ Description: `Unique Id of a guest type. -Employees using this portal as a guest inherit login options from the guest type`, - Type: schema.TypeString, - Optional: true, + Employees using this portal as a guest inherit login options from the guest type`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authentication_method": &schema.Schema{ - Description: `Unique Id of the identity source sequence`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the identity source sequence`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ Description: `The port number that the allowed interfaces will listen on. -Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "post_access_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "post_login_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Description: `Include a Post-Login Banner page`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include a Post-Login Banner page`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "self_reg_page_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_validity_duration": &schema.Schema{ - Description: `Self-registered guest account is valid for this many account_validity_time_units`, - Type: schema.TypeInt, - Optional: true, + Description: `Self-registered guest account is valid for this many account_validity_time_units`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "account_validity_time_units": &schema.Schema{ Description: `Time units for account_validity_duration. -Allowed Values: -- DAYS, -- HOURS, -- MINUTES`, - Type: schema.TypeString, - Optional: true, + Allowed Values: + - DAYS, + - HOURS, + - MINUTES`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_grace_access": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "approval_email_addresses": &schema.Schema{ - Description: `Only valid if requireGuestApproval = true and sendApprovalRequestTo = SELECTEDEMAILADDRESSES`, - Type: schema.TypeString, - Optional: true, + Description: `Only valid if requireGuestApproval = true and sendApprovalRequestTo = SELECTEDEMAILADDRESSES`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "approve_deny_links_time_units": &schema.Schema{ Description: `This attribute, along with approveDenyLinksValidFor, specifies how long the link can be used. -Only valid if requireGuestApproval = true. -Allowed Values: -- DAYS, -- HOURS, -- MINUTES`, - Type: schema.TypeString, - Optional: true, + Only valid if requireGuestApproval = true. + Allowed Values: + - DAYS, + - HOURS, + - MINUTES`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "approve_deny_links_valid_for": &schema.Schema{ Description: `This attribute, along with approveDenyLinksTimeUnits, specifies how long the link can be used. -Only valid if requireGuestApproval = true`, - Type: schema.TypeInt, - Optional: true, + Only valid if requireGuestApproval = true`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "assign_guests_to_guest_type": &schema.Schema{ - Description: `Guests are assigned to this guest type`, - Type: schema.TypeString, - Optional: true, + Description: `Guests are assigned to this guest type`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authenticate_sponsors_using_portal_list": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "auto_login_self_wait": &schema.Schema{ Description: `Allow guests to login automatically from self-registration after sponsor's approval. -No need to provide the credentials by guest to login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + No need to provide the credentials by guest to login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "auto_login_time_period": &schema.Schema{ Description: `Waiting period for auto login until sponsor's approval. -If time exceeds, guest has to login manually by providing the credentials. -Default value is 5 minutes`, - Type: schema.TypeInt, - Optional: true, + If time exceeds, guest has to login manually by providing the credentials. + Default value is 5 minutes`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "credential_notification_using_email": &schema.Schema{ Description: `If true, send credential notification upon approval using email. -Only valid if requireGuestApproval = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if requireGuestApproval = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "credential_notification_using_sms": &schema.Schema{ Description: `If true, send credential notification upon approval using SMS. -Only valid if requireGuestApproval = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if requireGuestApproval = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_guest_email_blacklist": &schema.Schema{ - Description: `Disallow guests with an e-mail address from selected domains`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Disallow guests with an e-mail address from selected domains`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_guest_email_whitelist": &schema.Schema{ - Description: `Allow guests with an e-mail address from selected domains`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow guests with an e-mail address from selected domains`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "field_company": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_email_addr": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_first_name": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_last_name": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_location": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_person_being_visited": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_phone_no": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_reason_for_visit": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_sms_provider": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "field_user_name": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require": &schema.Schema{ - Description: `Only applicable if include = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only applicable if include = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "grace_access_expire_interval": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "grace_access_send_account_expiration": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "guest_email_blacklist_domains": &schema.Schema{ - Description: `Disallow guests with an e-mail address from selected domains`, - Type: schema.TypeList, - Optional: true, + Description: `Disallow guests with an e-mail address from selected domains`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "guest_email_whitelist_domains": &schema.Schema{ Description: `Self-registered guests whose e-mail address is in one of these domains will be allowed. -Only valid if enableGuestEmailWhitelist = true`, - Type: schema.TypeList, - Optional: true, + Only valid if enableGuestEmailWhitelist = true`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "include_aup": &schema.Schema{ - Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "post_registration_redirect": &schema.Schema{ Description: `After the registration submission direct the guest user to one of the following pages. -Only valid if requireGuestApproval = true. -Allowed Values: -- SELFREGISTRATIONSUCCESS, -- LOGINPAGEWITHINSTRUCTIONS -- URL`, - Type: schema.TypeString, - Optional: true, + Only valid if requireGuestApproval = true. + Allowed Values: + - SELFREGISTRATIONSUCCESS, + - LOGINPAGEWITHINSTRUCTIONS + - URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "post_registration_redirect_url": &schema.Schema{ Description: `URL where guest user is redirected after registration. -Only valid if requireGuestApproval = true and postRegistrationRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Only valid if requireGuestApproval = true and postRegistrationRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "registration_code": &schema.Schema{ - Description: `The registration code that the guest user must enter`, - Type: schema.TypeString, - Optional: true, + Description: `The registration code that the guest user must enter`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "require_approver_to_authenticate": &schema.Schema{ Description: `When self-registered guests require approval, an approval request is e-mailed to one or more sponsor users. -If the Cisco ISE Administrator chooses to include an approval link in the e-mail, -a sponsor user who clicks the link will be required to enter their username and password if this attribute is true. -Only valid if requireGuestApproval = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + If the Cisco ISE Administrator chooses to include an approval link in the e-mail, + a sponsor user who clicks the link will be required to enter their username and password if this attribute is true. + Only valid if requireGuestApproval = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Description: `Require the portal user to accept the AUP. Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to accept the AUP. Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_guest_approval": &schema.Schema{ - Description: `Require self-registered guests to be approved if true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require self-registered guests to be approved if true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_registration_code": &schema.Schema{ - Description: `Self-registered guests are required to enter a registration code`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Self-registered guests are required to enter a registration code`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "selectable_locations": &schema.Schema{ - Description: `Guests can choose from these locations to set their time zone`, - Type: schema.TypeList, - Optional: true, + Description: `Guests can choose from these locations to set their time zone`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "selectable_sms_providers": &schema.Schema{ - Description: `This attribute is an array of SMS provider names`, - Type: schema.TypeList, - Optional: true, + Description: `This attribute is an array of SMS provider names`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "send_approval_request_to": &schema.Schema{ Description: `Specifies where approval requests are sent. -Only valid if requireGuestApproval = true. -Allowed Values: -- SELECTEDEMAILADDRESSES, -- PERSONBEINGVISITED`, - Type: schema.TypeString, - Optional: true, + Only valid if requireGuestApproval = true. + Allowed Values: + - SELECTEDEMAILADDRESSES, + - PERSONBEINGVISITED`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sponsor_portal_list": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -2283,160 +2586,216 @@ Allowed Values: }, }, "self_reg_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_guest_login_from_selfreg_success_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_send_self_using_email": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_send_self_using_print": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_send_self_using_sms": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "aup_on_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_company": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_email_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_first_name": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_last_name": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_location": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_password": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_person_being_visited": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_phone_no": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_reason_for_visit": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_sms_provider": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_user_name": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_scrolling": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -2453,8 +2812,10 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, func resourceSelfRegisteredPortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SelfRegisteredPortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -2467,29 +2828,31 @@ func resourceSelfRegisteredPortalCreate(ctx context.Context, d *schema.ResourceD vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SelfRegisteredPortal.GetSelfRegisteredPortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSelfRegisteredPortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSelfRegisteredPortalsQueryParams{} - - response2, _, err := client.SelfRegisteredPortal.GetSelfRegisteredPortals(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSelfRegisteredPortalGetSelfRegisteredPortals(m, response2, &queryParams2) - item2, err := searchSelfRegisteredPortalGetSelfRegisteredPortals(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SelfRegisteredPortal.GetSelfRegisteredPortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSelfRegisteredPortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSelfRegisteredPortalsQueryParams{} + + response2, _, err := client.SelfRegisteredPortal.GetSelfRegisteredPortals(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSelfRegisteredPortalGetSelfRegisteredPortals(m, response2, &queryParams2) + item2, err := searchSelfRegisteredPortalGetSelfRegisteredPortals(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSelfRegisteredPortalRead(ctx, d, m) + } + } } } restyResp1, err := client.SelfRegisteredPortal.CreateSelfRegisteredPortal(request1) @@ -2516,7 +2879,8 @@ func resourceSelfRegisteredPortalCreate(ctx context.Context, d *schema.ResourceD func resourceSelfRegisteredPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SelfRegisteredPortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -2562,6 +2926,12 @@ func resourceSelfRegisteredPortalRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSelfRegisteredPortals search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -2587,6 +2957,12 @@ func resourceSelfRegisteredPortalRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSelfRegisteredPortalByID response", + err)) + return diags + } return diags } @@ -2595,7 +2971,8 @@ func resourceSelfRegisteredPortalRead(ctx context.Context, d *schema.ResourceDat func resourceSelfRegisteredPortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SelfRegisteredPortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -2659,7 +3036,8 @@ func resourceSelfRegisteredPortalUpdate(ctx context.Context, d *schema.ResourceD func resourceSelfRegisteredPortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SelfRegisteredPortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -4575,7 +4953,8 @@ func expandRequestSelfRegisteredPortalUpdateSelfRegisteredPortalByIDSelfRegPorta } func getAllItemsSelfRegisteredPortalGetSelfRegisteredPortals(m interface{}, response *isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortals, queryParams *isegosdk.GetSelfRegisteredPortalsQueryParams) []isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortalsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortalsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -4603,7 +4982,8 @@ func getAllItemsSelfRegisteredPortalGetSelfRegisteredPortals(m interface{}, resp } func searchSelfRegisteredPortalGetSelfRegisteredPortals(m interface{}, items []isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortalsSearchResultResources, name string, id string) (*isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortalByIDSelfRegPortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSelfRegisteredPortalGetSelfRegisteredPortalByIDSelfRegPortal for _, item := range items { diff --git a/ciscoise/resource_selfsigned_certificate_generate.go b/ciscoise/resource_selfsigned_certificate_generate.go index f3f38f2c..f9171086 100644 --- a/ciscoise/resource_selfsigned_certificate_generate.go +++ b/ciscoise/resource_selfsigned_certificate_generate.go @@ -291,7 +291,8 @@ Wildcard certificate and SAML certificate can be generated only on PPAN or Stand func resourceSelfsignedCertificateGenerateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning GenerateSelfSignedCertificate create") log.Printf("[DEBUG] Missing GenerateSelfSignedCertificate create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_sg_acl.go b/ciscoise/resource_sg_acl.go index 0b590f21..2d932106 100644 --- a/ciscoise/resource_sg_acl.go +++ b/ciscoise/resource_sg_acl.go @@ -114,42 +114,82 @@ func resourceSgACL() *schema.Resource { Schema: map[string]*schema.Schema{ "aclcontent": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "generation_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ip_version": &schema.Schema{ Description: `Allowed values: -- IPV4, -- IPV6, -- IP_AGNOSTIC`, - Type: schema.TypeString, - Optional: true, + - IPV4, + - IPV6, + - IP_AGNOSTIC`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_read_only": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "modelled_content": &schema.Schema{ - Description: `Modelled content of contract`, - Type: schema.TypeString, - Optional: true, + Description: `Modelled content of contract`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -160,8 +200,10 @@ func resourceSgACL() *schema.Resource { func resourceSgACLCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgACL create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -174,29 +216,31 @@ func resourceSgACLCreate(ctx context.Context, d *schema.ResourceData, m interfac vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SecurityGroupsACLs.GetSecurityGroupsACLByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSgACLRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSecurityGroupsACLQueryParams{} - - response2, _, err := client.SecurityGroupsACLs.GetSecurityGroupsACL(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSecurityGroupsACLsGetSecurityGroupsACL(m, response2, &queryParams2) - item2, err := searchSecurityGroupsACLsGetSecurityGroupsACL(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SecurityGroupsACLs.GetSecurityGroupsACLByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSgACLRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSecurityGroupsACLQueryParams{} + + response2, _, err := client.SecurityGroupsACLs.GetSecurityGroupsACL(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSecurityGroupsACLsGetSecurityGroupsACL(m, response2, &queryParams2) + item2, err := searchSecurityGroupsACLsGetSecurityGroupsACL(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSgACLRead(ctx, d, m) + } + } } } restyResp1, err := client.SecurityGroupsACLs.CreateSecurityGroupsACL(request1) @@ -223,7 +267,8 @@ func resourceSgACLCreate(ctx context.Context, d *schema.ResourceData, m interfac func resourceSgACLRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgACL read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -269,6 +314,12 @@ func resourceSgACLRead(ctx context.Context, d *schema.ResourceData, m interface{ err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroupsACL search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -294,6 +345,12 @@ func resourceSgACLRead(ctx context.Context, d *schema.ResourceData, m interface{ err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroupsACLByID response", + err)) + return diags + } return diags } @@ -302,7 +359,8 @@ func resourceSgACLRead(ctx context.Context, d *schema.ResourceData, m interface{ func resourceSgACLUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgACL update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -367,7 +425,8 @@ func resourceSgACLUpdate(ctx context.Context, d *schema.ResourceData, m interfac func resourceSgACLDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgACL delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -528,7 +587,8 @@ func expandRequestSgACLUpdateSecurityGroupsACLByIDSgaclModelledContent(ctx conte } func getAllItemsSecurityGroupsACLsGetSecurityGroupsACL(m interface{}, response *isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACL, queryParams *isegosdk.GetSecurityGroupsACLQueryParams) []isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACLSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACLSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -556,7 +616,8 @@ func getAllItemsSecurityGroupsACLsGetSecurityGroupsACL(m interface{}, response * } func searchSecurityGroupsACLsGetSecurityGroupsACL(m interface{}, items []isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACLSearchResultResources, name string, id string) (*isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACLByIDSgacl, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSecurityGroupsACLsGetSecurityGroupsACLByIDSgacl for _, item := range items { diff --git a/ciscoise/resource_sg_acl_bulk_request.go b/ciscoise/resource_sg_acl_bulk_request.go index 7b7dc240..0e9ad83b 100644 --- a/ciscoise/resource_sg_acl_bulk_request.go +++ b/ciscoise/resource_sg_acl_bulk_request.go @@ -60,7 +60,8 @@ func resourceSgACLBulkRequest() *schema.Resource { func resourceSgACLBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSecurityGroupsACL create") log.Printf("[DEBUG] Missing BulkRequestForSecurityGroupsACL create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSgACLBulkRequestBulkRequestForSecurityGroupsACL(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sg_mapping.go b/ciscoise/resource_sg_mapping.go index 0e9e102d..344ccfa9 100644 --- a/ciscoise/resource_sg_mapping.go +++ b/ciscoise/resource_sg_mapping.go @@ -118,46 +118,82 @@ func resourceSgMapping() *schema.Resource { Schema: map[string]*schema.Schema{ "deploy_to": &schema.Schema{ - Description: `Mandatory unless mappingGroup is set or unless deployType=ALL`, - Type: schema.TypeString, - Optional: true, + Description: `Mandatory unless mappingGroup is set or unless deployType=ALL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "deploy_type": &schema.Schema{ Description: `Allowed values: -- ALL, -- ND, -- NDG`, - Type: schema.TypeString, - Optional: true, + - ALL, + - ND, + - NDG`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "host_ip": &schema.Schema{ - Description: `Mandatory if hostName is empty -- valid IP`, - Type: schema.TypeString, - Optional: true, + Description: `Mandatory if hostName is empty -- valid IP`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "host_name": &schema.Schema{ - Description: `Mandatory if hostIp is empty`, - Type: schema.TypeString, - Optional: true, + Description: `Mandatory if hostIp is empty`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "mapping_group": &schema.Schema{ - Description: `Mapping Group Id. Mandatory unless sgt and deployTo and deployType are set`, - Type: schema.TypeString, - Optional: true, + Description: `Mapping Group Id. Mandatory unless sgt and deployTo and deployType are set`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sgt": &schema.Schema{ Description: `Mandatory unless mappingGroup is set`, Type: schema.TypeString, Optional: true, - DiffSuppressFunc: diffSuppressSgt(), + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -168,8 +204,10 @@ func resourceSgMapping() *schema.Resource { func resourceSgMappingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMapping create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -182,29 +220,31 @@ func resourceSgMappingCreate(ctx context.Context, d *schema.ResourceData, m inte vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.IPToSgtMapping.GetIPToSgtMappingByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSgMappingRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetIPToSgtMappingQueryParams{} - - response2, _, err := client.IPToSgtMapping.GetIPToSgtMapping(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsIPToSgtMappingGetIPToSgtMapping(m, response2, &queryParams2) - item2, err := searchIPToSgtMappingGetIPToSgtMapping(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.IPToSgtMapping.GetIPToSgtMappingByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSgMappingRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetIPToSgtMappingQueryParams{} + + response2, _, err := client.IPToSgtMapping.GetIPToSgtMapping(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsIPToSgtMappingGetIPToSgtMapping(m, response2, &queryParams2) + item2, err := searchIPToSgtMappingGetIPToSgtMapping(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSgMappingRead(ctx, d, m) + } + } } } restyResp1, err := client.IPToSgtMapping.CreateIPToSgtMapping(request1) @@ -231,7 +271,8 @@ func resourceSgMappingCreate(ctx context.Context, d *schema.ResourceData, m inte func resourceSgMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMapping read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -277,6 +318,12 @@ func resourceSgMappingRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIPToSgtMapping search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -302,6 +349,12 @@ func resourceSgMappingRead(ctx context.Context, d *schema.ResourceData, m interf err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIPToSgtMappingByID response", + err)) + return diags + } return diags } @@ -310,7 +363,8 @@ func resourceSgMappingRead(ctx context.Context, d *schema.ResourceData, m interf func resourceSgMappingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMapping update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -373,7 +427,8 @@ func resourceSgMappingUpdate(ctx context.Context, d *schema.ResourceData, m inte func resourceSgMappingDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMapping delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -521,7 +576,8 @@ func expandRequestSgMappingUpdateIPToSgtMappingByIDSgMapping(ctx context.Context } func getAllItemsIPToSgtMappingGetIPToSgtMapping(m interface{}, response *isegosdk.ResponseIPToSgtMappingGetIPToSgtMapping, queryParams *isegosdk.GetIPToSgtMappingQueryParams) []isegosdk.ResponseIPToSgtMappingGetIPToSgtMappingSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseIPToSgtMappingGetIPToSgtMappingSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -549,7 +605,8 @@ func getAllItemsIPToSgtMappingGetIPToSgtMapping(m interface{}, response *isegosd } func searchIPToSgtMappingGetIPToSgtMapping(m interface{}, items []isegosdk.ResponseIPToSgtMappingGetIPToSgtMappingSearchResultResources, name string, id string) (*isegosdk.ResponseIPToSgtMappingGetIPToSgtMappingByIDSgMapping, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseIPToSgtMappingGetIPToSgtMappingByIDSgMapping for _, item := range items { diff --git a/ciscoise/resource_sg_mapping_bulk_request.go b/ciscoise/resource_sg_mapping_bulk_request.go index cecb6308..b255369e 100644 --- a/ciscoise/resource_sg_mapping_bulk_request.go +++ b/ciscoise/resource_sg_mapping_bulk_request.go @@ -60,7 +60,8 @@ func resourceSgMappingBulkRequest() *schema.Resource { func resourceSgMappingBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForIPToSgtMapping create") log.Printf("[DEBUG] Missing BulkRequestForIPToSgtMapping create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSgMappingBulkRequestBulkRequestForIPToSgtMapping(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sg_mapping_deploy.go b/ciscoise/resource_sg_mapping_deploy.go index 8b4688ee..8fdad40b 100644 --- a/ciscoise/resource_sg_mapping_deploy.go +++ b/ciscoise/resource_sg_mapping_deploy.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -56,7 +54,8 @@ Only one Deploy process can run at any given time func resourceSgMappingDeployCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeployIPToSgtMappingByID create") log.Printf("[DEBUG] Missing DeployIPToSgtMappingByID create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics vID := d.Get("parameters.0.id") diff --git a/ciscoise/resource_sg_mapping_deploy_all.go b/ciscoise/resource_sg_mapping_deploy_all.go index 20885054..5e3dbc4c 100644 --- a/ciscoise/resource_sg_mapping_deploy_all.go +++ b/ciscoise/resource_sg_mapping_deploy_all.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -49,7 +47,8 @@ Only one Deploy process can run at any given time func resourceSgMappingDeployAllCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeployAllIPToSgtMapping create") log.Printf("[DEBUG] Missing DeployAllIPToSgtMapping create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, err := client.IPToSgtMapping.DeployAllIPToSgtMapping() diff --git a/ciscoise/resource_sg_mapping_group.go b/ciscoise/resource_sg_mapping_group.go index e0a60a55..a4097b0c 100644 --- a/ciscoise/resource_sg_mapping_group.go +++ b/ciscoise/resource_sg_mapping_group.go @@ -92,39 +92,66 @@ func resourceSgMappingGroup() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "deploy_to": &schema.Schema{ - Description: `Mandatory unless mappingGroup is set or unless deployType=ALL`, - Type: schema.TypeString, - Optional: true, + Description: `Mandatory unless mappingGroup is set or unless deployType=ALL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "deploy_type": &schema.Schema{ Description: `Allowed values: -- ALL, -- ND, -- NDG`, - Type: schema.TypeString, - Optional: true, + - ALL, + - ND, + - NDG`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ Description: `id path parameter.`, Type: schema.TypeString, - Optional: true, + Required: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sgt": &schema.Schema{ Description: `Mandatory unless mappingGroup is set`, Type: schema.TypeString, Optional: true, - DiffSuppressFunc: diffSuppressSgt(), + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -135,7 +162,8 @@ func resourceSgMappingGroup() *schema.Resource { func resourceSgMappingGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMappingGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -198,7 +226,8 @@ func resourceSgMappingGroupCreate(ctx context.Context, d *schema.ResourceData, m func resourceSgMappingGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMappingGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -244,6 +273,12 @@ func resourceSgMappingGroupRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIPToSgtMappingGroup search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -269,6 +304,12 @@ func resourceSgMappingGroupRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetIPToSgtMappingGroupByID response", + err)) + return diags + } return diags } @@ -277,7 +318,8 @@ func resourceSgMappingGroupRead(ctx context.Context, d *schema.ResourceData, m i func resourceSgMappingGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMappingGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -336,7 +378,8 @@ func resourceSgMappingGroupUpdate(ctx context.Context, d *schema.ResourceData, m func resourceSgMappingGroupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgMappingGroup delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -458,7 +501,8 @@ func expandRequestSgMappingGroupUpdateIPToSgtMappingGroupByIDSgMappingGroup(ctx } func getAllItemsIPToSgtMappingGroupGetIPToSgtMappingGroup(m interface{}, response *isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroup, queryParams *isegosdk.GetIPToSgtMappingGroupQueryParams) []isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroupSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroupSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -486,7 +530,8 @@ func getAllItemsIPToSgtMappingGroupGetIPToSgtMappingGroup(m interface{}, respons } func searchIPToSgtMappingGroupGetIPToSgtMappingGroup(m interface{}, items []isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroupSearchResultResources, name string, id string) (*isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroupByIDSgMappingGroup, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseIPToSgtMappingGroupGetIPToSgtMappingGroupByIDSgMappingGroup for _, item := range items { diff --git a/ciscoise/resource_sg_mapping_group_bulk_request.go b/ciscoise/resource_sg_mapping_group_bulk_request.go index 010f553a..59352525 100644 --- a/ciscoise/resource_sg_mapping_group_bulk_request.go +++ b/ciscoise/resource_sg_mapping_group_bulk_request.go @@ -60,7 +60,8 @@ func resourceSgMappingGroupBulkRequest() *schema.Resource { func resourceSgMappingGroupBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForIPToSgtMappingGroup create") log.Printf("[DEBUG] Missing BulkRequestForIPToSgtMappingGroup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSgMappingGroupBulkRequestBulkRequestForIPToSgtMappingGroup(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sg_mapping_group_deploy.go b/ciscoise/resource_sg_mapping_group_deploy.go index 49084164..46470e15 100644 --- a/ciscoise/resource_sg_mapping_group_deploy.go +++ b/ciscoise/resource_sg_mapping_group_deploy.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -56,7 +54,8 @@ Only one Deploy process can run at any given time func resourceSgMappingGroupDeployCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeployIPToSgtMappingGroupByID create") log.Printf("[DEBUG] Missing DeployIPToSgtMappingGroupByID create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) diff --git a/ciscoise/resource_sg_mapping_group_deploy_all.go b/ciscoise/resource_sg_mapping_group_deploy_all.go index 77a68ff4..c0b0ae3c 100644 --- a/ciscoise/resource_sg_mapping_group_deploy_all.go +++ b/ciscoise/resource_sg_mapping_group_deploy_all.go @@ -5,8 +5,6 @@ import ( "log" - isegosdk "github.com/CiscoISE/ciscoise-go-sdk/sdk" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -49,7 +47,8 @@ Only one Deploy process can run at any given time func resourceSgMappingGroupDeployAllCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning DeployAllIPToSgtMappingGroup create") log.Printf("[DEBUG] Missing DeployAllIPToSgtMappingGroup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client d.Set("parameters", nil) var diags diag.Diagnostics response1, err := client.IPToSgtMappingGroup.DeployAllIPToSgtMappingGroup() diff --git a/ciscoise/resource_sg_to_vn_to_vlan.go b/ciscoise/resource_sg_to_vn_to_vlan.go index 4ea9ce44..3c0ffc54 100644 --- a/ciscoise/resource_sg_to_vn_to_vlan.go +++ b/ciscoise/resource_sg_to_vn_to_vlan.go @@ -151,75 +151,128 @@ func resourceSgToVnToVLAN() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sgt_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "virtualnetworklist": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_virtual_network": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vlans": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "default_vlan": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "max_value": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -236,8 +289,10 @@ func resourceSgToVnToVLAN() *schema.Resource { func resourceSgToVnToVLANCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgToVnToVLAN create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -250,29 +305,31 @@ func resourceSgToVnToVLANCreate(ctx context.Context, d *schema.ResourceData, m i vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SecurityGroupToVirtualNetwork.GetSecurityGroupsToVnToVLANByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSgToVnToVLANRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSecurityGroupsToVnToVLANQueryParams{} - - response2, _, err := client.SecurityGroupToVirtualNetwork.GetSecurityGroupsToVnToVLAN(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m, response2, &queryParams2) - item2, err := searchSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SecurityGroupToVirtualNetwork.GetSecurityGroupsToVnToVLANByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSgToVnToVLANRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSecurityGroupsToVnToVLANQueryParams{} + + response2, _, err := client.SecurityGroupToVirtualNetwork.GetSecurityGroupsToVnToVLAN(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m, response2, &queryParams2) + item2, err := searchSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSgToVnToVLANRead(ctx, d, m) + } + } } } restyResp1, err := client.SecurityGroupToVirtualNetwork.CreateSecurityGroupsToVnToVLAN(request1) @@ -299,7 +356,8 @@ func resourceSgToVnToVLANCreate(ctx context.Context, d *schema.ResourceData, m i func resourceSgToVnToVLANRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgToVnToVLAN read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -345,6 +403,12 @@ func resourceSgToVnToVLANRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroupsToVnToVLAN search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -370,6 +434,12 @@ func resourceSgToVnToVLANRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroupsToVnToVLANByID response", + err)) + return diags + } return diags } @@ -378,7 +448,8 @@ func resourceSgToVnToVLANRead(ctx context.Context, d *schema.ResourceData, m int func resourceSgToVnToVLANUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgToVnToVLAN update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -442,7 +513,8 @@ func resourceSgToVnToVLANUpdate(ctx context.Context, d *schema.ResourceData, m i func resourceSgToVnToVLANDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SgToVnToVLAN delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -763,7 +835,8 @@ func expandRequestSgToVnToVLANUpdateSecurityGroupsToVnToVLANByIDSgtVnVLANContain } func getAllItemsSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m interface{}, response *isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN, queryParams *isegosdk.GetSecurityGroupsToVnToVLANQueryParams) []isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLANSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLANSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -791,7 +864,8 @@ func getAllItemsSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m inter } func searchSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLAN(m interface{}, items []isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLANSearchResultResources, name string, id string) (*isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLANByIDSgtVnVLANContainer, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSecurityGroupToVirtualNetworkGetSecurityGroupsToVnToVLANByIDSgtVnVLANContainer for _, item := range items { diff --git a/ciscoise/resource_sg_to_vn_to_vlan_bulk_request.go b/ciscoise/resource_sg_to_vn_to_vlan_bulk_request.go index 21439f82..cdba54fe 100644 --- a/ciscoise/resource_sg_to_vn_to_vlan_bulk_request.go +++ b/ciscoise/resource_sg_to_vn_to_vlan_bulk_request.go @@ -60,7 +60,8 @@ func resourceSgToVnToVLANBulkRequest() *schema.Resource { func resourceSgToVnToVLANBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSecurityGroupsToVnToVLAN create") log.Printf("[DEBUG] Missing BulkRequestForSecurityGroupsToVnToVLAN create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSgToVnToVLANBulkRequestBulkRequestForSecurityGroupsToVnToVLAN(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sgt.go b/ciscoise/resource_sgt.go index 6c4c1e4d..e3066b32 100644 --- a/ciscoise/resource_sgt.go +++ b/ciscoise/resource_sgt.go @@ -115,6 +115,7 @@ func resourceSgt() *schema.Resource { "default_sgacls": &schema.Schema{ Type: schema.TypeList, Optional: true, + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, @@ -122,33 +123,65 @@ func resourceSgt() *schema.Resource { "description": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "generation_id": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + DiffSuppressFunc: diffSupressOptional(), }, "is_read_only": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + Computed: true, + DiffSuppressFunc: diffSupressBool(), }, "name": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "propogate_to_apic": &schema.Schema{ Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Computed: true, Optional: true, }, "value": &schema.Schema{ - Description: `Value range: 2 ot 65519 or -1 to auto-generate`, - Type: schema.TypeInt, - Optional: true, + Description: `Value range: 2 ot 65519`, + Type: schema.TypeInt, + Computed: true, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + ValidateFunc: validateIntegerInRange(2, 65519), + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, }, }, @@ -159,7 +192,12 @@ func resourceSgt() *schema.Resource { func resourceSgtCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Sgt create") - client := m.(*isegosdk.Client) + + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := m.(ClientConfig).EnableAutoImport + log.Printf("[INFO] Is new resource => %t", d.IsNewResource()) + log.Printf("[INFO] Is EnableAutoImport => %t", m.(ClientConfig).EnableAutoImport) var diags diag.Diagnostics @@ -173,29 +211,31 @@ func resourceSgtCreate(ctx context.Context, d *schema.ResourceData, m interface{ vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SecurityGroups.GetSecurityGroupByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSgtRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSecurityGroupsQueryParams{} - - response2, _, err := client.SecurityGroups.GetSecurityGroups(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSecurityGroupsGetSecurityGroups(m, response2, &queryParams2) - item2, err := searchSecurityGroupsGetSecurityGroups(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SecurityGroups.GetSecurityGroupByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSgtRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSecurityGroupsQueryParams{} + + response2, _, err := client.SecurityGroups.GetSecurityGroups(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSecurityGroupsGetSecurityGroups(m, response2, &queryParams2) + item2, err := searchSecurityGroupsGetSecurityGroups(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSgtRead(ctx, d, m) + } + } } } restyResp1, err := client.SecurityGroups.CreateSecurityGroup(request1) @@ -222,7 +262,8 @@ func resourceSgtCreate(ctx context.Context, d *schema.ResourceData, m interface{ func resourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Sgt read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -230,7 +271,6 @@ func resourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) resourceMap := separateResourceID(resourceID) vID, okID := resourceMap["id"] vName, okName := resourceMap["name"] - method1 := []bool{okID} log.Printf("[DEBUG] Selecting method. Method 1 %v", method1) method2 := []bool{okName} @@ -262,12 +302,25 @@ func resourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) return diags } vItem1 := flattenSecurityGroupsGetSecurityGroupByIDItem(item1) + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroups search response", + err)) + return diags + } + if err := d.Set("item", vItem1); err != nil { diags = append(diags, diagError( "Failure when setting GetSecurityGroups search response", err)) return diags } + // if err := d.Set("parameters", remove_parameters(vItem1, "link")); err != nil { + // diags = append(diags, diagError( + // "Failure when setting GetSecurityGroups response to parameters", + // err)) + // return diags + // } } if selectedMethod == 1 { @@ -289,11 +342,22 @@ func resourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) vItem2 := flattenSecurityGroupsGetSecurityGroupByIDItem(response2.Sgt) if err := d.Set("item", vItem2); err != nil { diags = append(diags, diagError( - "Failure when setting GetSecurityGroupByID response", + "Failure when setting GetSecurityGroups search response", + err)) + return diags + } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSecurityGroups search response", err)) return diags } - return diags + // if err := d.Set("parameters", remove_parameters(vItem2, "link")); err != nil { + // diags = append(diags, diagError( + // "Failure when setting GetSecurityGroups response to parameters", + // err)) + // return diags + // } } return diags @@ -301,7 +365,8 @@ func resourceSgtRead(ctx context.Context, d *schema.ResourceData, m interface{}) func resourceSgtUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Sgt update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -338,6 +403,7 @@ func resourceSgtUpdate(ctx context.Context, d *schema.ResourceData, m interface{ vvID = vID } if d.HasChange("parameters") { + log.Printf("[DEBUG] if dentro") log.Printf("[DEBUG] ID used for update operation %s", vvID) request1 := expandRequestSgtUpdateSecurityGroupByID(ctx, "parameters.0", d) if request1 != nil { @@ -365,7 +431,8 @@ func resourceSgtUpdate(ctx context.Context, d *schema.ResourceData, m interface{ func resourceSgtDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning Sgt delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -571,7 +638,8 @@ func expandRequestSgtUpdateSecurityGroupByIDSgtDefaultSgACLs(ctx context.Context } func getAllItemsSecurityGroupsGetSecurityGroups(m interface{}, response *isegosdk.ResponseSecurityGroupsGetSecurityGroups, queryParams *isegosdk.GetSecurityGroupsQueryParams) []isegosdk.ResponseSecurityGroupsGetSecurityGroupsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSecurityGroupsGetSecurityGroupsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -599,7 +667,8 @@ func getAllItemsSecurityGroupsGetSecurityGroups(m interface{}, response *isegosd } func searchSecurityGroupsGetSecurityGroups(m interface{}, items []isegosdk.ResponseSecurityGroupsGetSecurityGroupsSearchResultResources, name string, id string) (*isegosdk.ResponseSecurityGroupsGetSecurityGroupByIDSgt, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSecurityGroupsGetSecurityGroupByIDSgt for _, item := range items { diff --git a/ciscoise/resource_sgt_bulk_request.go b/ciscoise/resource_sgt_bulk_request.go index ba020b01..124cc2f5 100644 --- a/ciscoise/resource_sgt_bulk_request.go +++ b/ciscoise/resource_sgt_bulk_request.go @@ -60,7 +60,8 @@ func resourceSgtBulkRequest() *schema.Resource { func resourceSgtBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSecurityGroup create") log.Printf("[DEBUG] Missing BulkRequestForSecurityGroup create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSgtBulkRequestBulkRequestForSecurityGroup(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sponsor_group.go b/ciscoise/resource_sponsor_group.go index 7d9c6a03..9f7ebe08 100644 --- a/ciscoise/resource_sponsor_group.go +++ b/ciscoise/resource_sponsor_group.go @@ -224,169 +224,252 @@ func resourceSponsorGroup() *schema.Resource { Schema: map[string]*schema.Schema{ "auto_notification": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "create_permissions": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "can_create_random_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_import_multiple_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_set_future_start_date": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_specify_username_prefix": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "default_username_prefix": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "import_batch_size_limit": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "random_batch_size_limit": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "start_date_future_limit_days": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "guest_types": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_default_group": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "is_enabled": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "locations": &schema.Schema{ + "link": &schema.Schema{ Type: schema.TypeList, - Optional: true, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "locations": &schema.Schema{ + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "manage_permission": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "member_groups": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "other_permissions": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "can_access_via_rest": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_approve_selfreg_guests": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_delete_guest_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_extend_guest_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_reinstate_suspended_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_reset_guest_passwords": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_send_sms_notifications": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_suspend_guest_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_update_guest_contact_info": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "can_view_guest_passwords": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "limit_approval_to_sponsors_guests": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_suspension_reason": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -400,8 +483,10 @@ func resourceSponsorGroup() *schema.Resource { func resourceSponsorGroupCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorGroup create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -414,29 +499,31 @@ func resourceSponsorGroupCreate(ctx context.Context, d *schema.ResourceData, m i vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SponsorGroup.GetSponsorGroupByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSponsorGroupRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSponsorGroupQueryParams{} - - response2, _, err := client.SponsorGroup.GetSponsorGroup(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSponsorGroupGetSponsorGroup(m, response2, &queryParams2) - item2, err := searchSponsorGroupGetSponsorGroup(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SponsorGroup.GetSponsorGroupByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSponsorGroupRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSponsorGroupQueryParams{} + + response2, _, err := client.SponsorGroup.GetSponsorGroup(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSponsorGroupGetSponsorGroup(m, response2, &queryParams2) + item2, err := searchSponsorGroupGetSponsorGroup(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSponsorGroupRead(ctx, d, m) + } + } } } restyResp1, err := client.SponsorGroup.CreateSponsorGroup(request1) @@ -463,7 +550,8 @@ func resourceSponsorGroupCreate(ctx context.Context, d *schema.ResourceData, m i func resourceSponsorGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorGroup read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -509,6 +597,12 @@ func resourceSponsorGroupRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsorGroup search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -534,6 +628,12 @@ func resourceSponsorGroupRead(ctx context.Context, d *schema.ResourceData, m int err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsorGroupByID response", + err)) + return diags + } return diags } @@ -542,7 +642,8 @@ func resourceSponsorGroupRead(ctx context.Context, d *schema.ResourceData, m int func resourceSponsorGroupUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorGroup update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -606,7 +707,8 @@ func resourceSponsorGroupUpdate(ctx context.Context, d *schema.ResourceData, m i func resourceSponsorGroupDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorGroup delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -928,7 +1030,8 @@ func expandRequestSponsorGroupUpdateSponsorGroupByIDSponsorGroupOtherPermissions } func getAllItemsSponsorGroupGetSponsorGroup(m interface{}, response *isegosdk.ResponseSponsorGroupGetSponsorGroup, queryParams *isegosdk.GetSponsorGroupQueryParams) []isegosdk.ResponseSponsorGroupGetSponsorGroupSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSponsorGroupGetSponsorGroupSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -956,7 +1059,8 @@ func getAllItemsSponsorGroupGetSponsorGroup(m interface{}, response *isegosdk.Re } func searchSponsorGroupGetSponsorGroup(m interface{}, items []isegosdk.ResponseSponsorGroupGetSponsorGroupSearchResultResources, name string, id string) (*isegosdk.ResponseSponsorGroupGetSponsorGroupByIDSponsorGroup, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSponsorGroupGetSponsorGroupByIDSponsorGroup for _, item := range items { diff --git a/ciscoise/resource_sponsor_portal.go b/ciscoise/resource_sponsor_portal.go index ea51ce2a..1b346791 100644 --- a/ciscoise/resource_sponsor_portal.go +++ b/ciscoise/resource_sponsor_portal.go @@ -536,87 +536,107 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -625,41 +645,51 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "language": &schema.Schema{ - Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `The Dictionary will be exposed here as key value pair`, - Type: schema.TypeList, - Optional: true, + Description: `The Dictionary will be exposed here as key value pair`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -668,55 +698,71 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "portal_theme": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -725,300 +771,401 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_frequency": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. Only valid if includeAup = true. Allowed Values: -- FIRSTLOGIN, -- EVERYLOGIN, -- RECURRING`, - Type: schema.TypeString, - Optional: true, + - FIRSTLOGIN, + - EVERYLOGIN, + - RECURRING`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_frequency_interval_days": &schema.Schema{ - Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "login_page_settings": &schema.Schema{ - Description: `Portal Login Page settings groups follow`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Portal Login Page settings groups follow`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_failed_attempts_before_rate_limit": &schema.Schema{ - Description: `Maximum failed login attempts before rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum failed login attempts before rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ Description: `Require the portal user to accept the AUP. -Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_scrolling": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "social_configs": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "time_between_logins_during_rate_limit": &schema.Schema{ - Description: `Time between login attempts when rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Time between login attempts when rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0, -- eth1, -- eth2, -- eth3, -- eth4, -- eth5, -- bond0, -- bond1, -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0, + - eth1, + - eth2, + - eth3, + - eth4, + - eth5, + - bond0, + - bond1, + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "authentication_method": &schema.Schema{ - Description: `Unique Id of the identity source sequence`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the identity source sequence`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "available_ssids": &schema.Schema{ - Description: `Names of the SSIDs available for assignment to guest users by sponsors`, - Type: schema.TypeList, - Optional: true, + Description: `Names of the SSIDs available for assignment to guest users by sponsors`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fqdn": &schema.Schema{ - Description: `The fully-qualified domain name (FQDN) that end-users will use to access this portal. Used only in Sponsor portal`, - Type: schema.TypeString, - Optional: true, + Description: `The fully-qualified domain name (FQDN) that end-users will use to access this portal. Used only in Sponsor portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ Description: `The port number that the allowed interfaces will listen on. -Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "idle_timeout": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "post_access_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "post_login_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Description: `Include a Post-Login Banner page`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include a Post-Login Banner page`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "sponsor_change_password_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_sponsor_to_change_pwd": &schema.Schema{ - Description: `Allow sponsors to change their own passwords`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow sponsors to change their own passwords`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1035,8 +1182,10 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, func resourceSponsorPortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorPortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -1049,29 +1198,31 @@ func resourceSponsorPortalCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SponsorPortal.GetSponsorPortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSponsorPortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSponsorPortalQueryParams{} - - response2, _, err := client.SponsorPortal.GetSponsorPortal(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSponsorPortalGetSponsorPortal(m, response2, &queryParams2) - item2, err := searchSponsorPortalGetSponsorPortal(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SponsorPortal.GetSponsorPortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSponsorPortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSponsorPortalQueryParams{} + + response2, _, err := client.SponsorPortal.GetSponsorPortal(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSponsorPortalGetSponsorPortal(m, response2, &queryParams2) + item2, err := searchSponsorPortalGetSponsorPortal(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSponsorPortalRead(ctx, d, m) + } + } } } restyResp1, err := client.SponsorPortal.CreateSponsorPortal(request1) @@ -1098,7 +1249,8 @@ func resourceSponsorPortalCreate(ctx context.Context, d *schema.ResourceData, m func resourceSponsorPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorPortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1144,6 +1296,12 @@ func resourceSponsorPortalRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsorPortal search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -1169,6 +1327,12 @@ func resourceSponsorPortalRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsorPortalByID response", + err)) + return diags + } return diags } @@ -1177,7 +1341,8 @@ func resourceSponsorPortalRead(ctx context.Context, d *schema.ResourceData, m in func resourceSponsorPortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorPortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1241,7 +1406,8 @@ func resourceSponsorPortalUpdate(ctx context.Context, d *schema.ResourceData, m func resourceSponsorPortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsorPortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -2123,7 +2289,8 @@ func expandRequestSponsorPortalUpdateSponsorPortalByIDSponsorPortalCustomization } func getAllItemsSponsorPortalGetSponsorPortal(m interface{}, response *isegosdk.ResponseSponsorPortalGetSponsorPortal, queryParams *isegosdk.GetSponsorPortalQueryParams) []isegosdk.ResponseSponsorPortalGetSponsorPortalSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSponsorPortalGetSponsorPortalSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -2151,7 +2318,8 @@ func getAllItemsSponsorPortalGetSponsorPortal(m interface{}, response *isegosdk. } func searchSponsorPortalGetSponsorPortal(m interface{}, items []isegosdk.ResponseSponsorPortalGetSponsorPortalSearchResultResources, name string, id string) (*isegosdk.ResponseSponsorPortalGetSponsorPortalByIDSponsorPortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSponsorPortalGetSponsorPortalByIDSponsorPortal for _, item := range items { diff --git a/ciscoise/resource_sponsored_guest_portal.go b/ciscoise/resource_sponsored_guest_portal.go index fbcd52f3..3b6288e8 100644 --- a/ciscoise/resource_sponsored_guest_portal.go +++ b/ciscoise/resource_sponsored_guest_portal.go @@ -715,88 +715,108 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, Schema: map[string]*schema.Schema{ "customizations": &schema.Schema{ - Description: `Defines all of the Portal Customizations available`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the Portal Customizations available`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "global_customizations": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "background_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "banner_title": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "contact_text": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "desktop_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "footer_element": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "mobile_logo_image": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `Represented as base 64 encoded string of the image byte array`, - Type: schema.TypeString, - Optional: true, + Description: `Represented as base 64 encoded string of the image byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -805,42 +825,52 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "language": &schema.Schema{ - Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `This property is supported only for Read operation and it allows to show the customizations in English. Other languages are not supported`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "view_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "page_customizations": &schema.Schema{ - Description: `Represent the entire page customization as a giant dictionary`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Represent the entire page customization as a giant dictionary`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "data": &schema.Schema{ - Description: `The Dictionary will be exposed here as key value pair`, - Type: schema.TypeList, - Optional: true, + Description: `The Dictionary will be exposed here as key value pair`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "key": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -849,55 +879,71 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, }, }, "portal_theme": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `The system- or user-assigned name of the portal theme`, - Type: schema.TypeString, - Optional: true, + Description: `The system- or user-assigned name of the portal theme`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "theme_data": &schema.Schema{ - Description: `A CSS file, represented as a Base64-encoded byte array`, - Type: schema.TypeString, - Optional: true, + Description: `A CSS file, represented as a Base64-encoded byte array`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_tweak_settings": &schema.Schema{ Description: `The Tweak Settings are a customization of the Portal Theme that has been selected for the portal. -When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. -The Tweak Settings can subsequently be changed by the user`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + When the Portal Theme selection is changed, the Tweak Settings are overwritten to match the values in the theme. + The Tweak Settings can subsequently be changed by the user`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "banner_color": &schema.Schema{ - Description: `Hex value of color`, - Type: schema.TypeString, - Optional: true, + Description: `Hex value of color`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "banner_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_background_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "page_label_and_text_color": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -906,215 +952,293 @@ The Tweak Settings can subsequently be changed by the user`, }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_test_url": &schema.Schema{ - Description: `URL to bring up a test page for this portal`, - Type: schema.TypeString, - Optional: true, + Description: `URL to bring up a test page for this portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal_type": &schema.Schema{ Description: `Allowed values: -- BYOD, -- HOTSPOTGUEST, -- MYDEVICE, -- SELFREGGUEST, -- SPONSOR, -- SPONSOREDGUEST`, - Type: schema.TypeString, - Optional: true, + - BYOD, + - HOTSPOTGUEST, + - MYDEVICE, + - SELFREGGUEST, + - SPONSOR, + - SPONSOREDGUEST`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "settings": &schema.Schema{ - Description: `Defines all of the settings groups available for a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Defines all of the settings groups available for a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_frequency": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. Only valid if includeAup = true. Allowed Values: -- FIRSTLOGIN, -- EVERYLOGIN, -- RECURRING`, - Type: schema.TypeString, - Optional: true, + - FIRSTLOGIN, + - EVERYLOGIN, + - RECURRING`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_frequency_interval_days": &schema.Schema{ - Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, - Type: schema.TypeInt, - Optional: true, + Description: `Number of days between AUP confirmations (when displayFrequency = recurring)`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_scrolling": &schema.Schema{ - Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to scroll to the end of the AUP. Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "skip_aup_for_employees": &schema.Schema{ - Description: `Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "use_diff_aup_for_employees": &schema.Schema{ - Description: `Only valid if requireAupAcceptance = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Only valid if requireAupAcceptance = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "auth_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Description: `Target URL for redirection, used when successRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Description: `Target URL for redirection, used when successRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ Description: `After an Authentication Success where should device be redirected. -Allowed values: -- AUTHSUCCESSPAGE, -- ORIGINATINGURL, -- URL`, - Type: schema.TypeString, - Optional: true, + Allowed values: + - AUTHSUCCESSPAGE, + - ORIGINATINGURL, + - URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "byod_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "byod_registration_settings": &schema.Schema{ - Description: `Configuration of BYOD endpoint Registration step configuration`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Configuration of BYOD endpoint Registration step configuration`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "end_point_identity_group_id": &schema.Schema{ - Description: `Identity group id for which endpoint belongs`, - Type: schema.TypeString, - Optional: true, + Description: `Identity group id for which endpoint belongs`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "show_device_id": &schema.Schema{ - Description: `Display Device ID field during registration`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Display Device ID field during registration`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "byod_registration_success_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "redirect_url": &schema.Schema{ - Description: `Target URL for redirection, used when successRedirect = URL`, - Type: schema.TypeString, - Optional: true, + Description: `Target URL for redirection, used when successRedirect = URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "success_redirect": &schema.Schema{ Description: `After an Authentication Success where should device be redirected. Allowed values: -- AUTHSUCCESSPAGE, -- ORIGINATINGURL, -- URL`, - Type: schema.TypeString, - Optional: true, + - AUTHSUCCESSPAGE, + - ORIGINATINGURL, + - URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "byod_welcome_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enable_byo_d": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_guest_access": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_aup": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_mdm": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_scrolling": &schema.Schema{ Description: `Require BYOD devices to scroll down to the bottom of the AUP. -Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1123,282 +1247,359 @@ Only valid if includeAup = true`, }, }, "guest_change_password_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_change_passwd_at_first_login": &schema.Schema{ - Description: `Allow guest to change their own passwords`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow guest to change their own passwords`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "guest_device_registration_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allow_guests_to_register_devices": &schema.Schema{ - Description: `Allow guests to register devices`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow guests to register devices`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "auto_register_guest_devices": &schema.Schema{ - Description: `Automatically register guest devices`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Automatically register guest devices`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "login_page_settings": &schema.Schema{ - Description: `Portal Login Page settings groups follow`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Portal Login Page settings groups follow`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "access_code": &schema.Schema{ - Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, - Type: schema.TypeString, - Optional: true, + Description: `Access code that must be entered by the portal user (only valid if requireAccessCode = true)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "allow_alternate_guest_portal": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_forgot_password": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_to_change_password": &schema.Schema{ - Description: `Require the portal user to enter an access code`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Require the portal user to enter an access code`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_guest_to_create_accounts": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "aup_display": &schema.Schema{ Description: `How the AUP should be displayed, either on page or as a link. -Only valid if includeAup = true. -Allowed values: -- ONPAGE, -- ASLINK`, - Type: schema.TypeString, - Optional: true, + Only valid if includeAup = true. + Allowed values: + - ONPAGE, + - ASLINK`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_aup": &schema.Schema{ - Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include an Acceptable Use Policy (AUP) that should be displayed during login`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "max_failed_attempts_before_rate_limit": &schema.Schema{ - Description: `Maximum failed login attempts before rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Maximum failed login attempts before rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "require_access_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "require_aup_acceptance": &schema.Schema{ Description: `Require the portal user to accept the AUP. -Only valid if includeAup = true`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Only valid if includeAup = true`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "social_configs": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "social_media_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "social_media_value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "time_between_logins_during_rate_limit": &schema.Schema{ - Description: `Time between login attempts when rate limiting`, - Type: schema.TypeInt, - Optional: true, + Description: `Time between login attempts when rate limiting`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "portal_settings": &schema.Schema{ - Description: `The port, interface, certificate, and other basic settings of a portal`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `The port, interface, certificate, and other basic settings of a portal`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "allowed_interfaces": &schema.Schema{ Description: `Interfaces that the portal will be reachable on. -Allowed values: -- eth0, -- eth1, -- eth2, -- eth3, -- eth4, -- eth5, -- bond0, -- bond1, -- bond2`, - Type: schema.TypeList, - Optional: true, + Allowed values: + - eth0, + - eth1, + - eth2, + - eth3, + - eth4, + - eth5, + - bond0, + - bond1, + - bond2`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "always_used_language": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "assigned_guest_type_for_employee": &schema.Schema{ Description: `Unique Id of a guest type. -Employees using this portal as a guest inherit login options from the guest type`, - Type: schema.TypeString, - Optional: true, + Employees using this portal as a guest inherit login options from the guest type`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "authentication_method": &schema.Schema{ - Description: `Unique Id of the identity source sequence`, - Type: schema.TypeString, - Optional: true, + Description: `Unique Id of the identity source sequence`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "certificate_group_tag": &schema.Schema{ - Description: `Logical name of the x.509 server certificate that will be used for the portal`, - Type: schema.TypeString, - Optional: true, + Description: `Logical name of the x.509 server certificate that will be used for the portal`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "display_lang": &schema.Schema{ Description: `Allowed values: -- USEBROWSERLOCALE, -- ALWAYSUSE`, - Type: schema.TypeString, - Optional: true, + - USEBROWSERLOCALE, + - ALWAYSUSE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "fallback_language": &schema.Schema{ - Description: `Used when displayLang = USEBROWSERLOCALE`, - Type: schema.TypeString, - Optional: true, + Description: `Used when displayLang = USEBROWSERLOCALE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "https_port": &schema.Schema{ Description: `The port number that the allowed interfaces will listen on. -Range from 8000 to 8999`, - Type: schema.TypeInt, - Optional: true, + Range from 8000 to 8999`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, }, "post_access_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "post_login_banner_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "include_post_access_banner": &schema.Schema{ - Description: `Include a Post-Login Banner page`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Include a Post-Login Banner page`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, }, "support_info_settings": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "default_empty_field_value": &schema.Schema{ Description: `The default value displayed for an empty field. -Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "empty_field_display": &schema.Schema{ Description: `Specifies how empty fields are handled on the Support Information Page. Allowed values: -- HIDE, -- DISPLAYWITHNOVALUE, -- DISPLAYWITHDEFAULTVALUE`, - Type: schema.TypeString, - Optional: true, + - HIDE, + - DISPLAYWITHNOVALUE, + - DISPLAYWITHDEFAULTVALUE`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "include_browser_user_agent": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_failure_code": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_ip_address": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_mac_addr": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_policy_server": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "include_support_info_page": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -1415,8 +1616,10 @@ Only valid when emptyFieldDisplay = DISPLAYWITHDEFAULTVALUE`, func resourceSponsoredGuestPortalCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsoredGuestPortal create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -1429,29 +1632,31 @@ func resourceSponsoredGuestPortalCreate(ctx context.Context, d *schema.ResourceD vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SponsoredGuestPortal.GetSponsoredGuestPortalByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSponsoredGuestPortalRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSponsoredGuestPortalsQueryParams{} - - response2, _, err := client.SponsoredGuestPortal.GetSponsoredGuestPortals(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSponsoredGuestPortalGetSponsoredGuestPortals(m, response2, &queryParams2) - item2, err := searchSponsoredGuestPortalGetSponsoredGuestPortals(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SponsoredGuestPortal.GetSponsoredGuestPortalByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSponsoredGuestPortalRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSponsoredGuestPortalsQueryParams{} + + response2, _, err := client.SponsoredGuestPortal.GetSponsoredGuestPortals(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSponsoredGuestPortalGetSponsoredGuestPortals(m, response2, &queryParams2) + item2, err := searchSponsoredGuestPortalGetSponsoredGuestPortals(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSponsoredGuestPortalRead(ctx, d, m) + } + } } } restyResp1, err := client.SponsoredGuestPortal.CreateSponsoredGuestPortal(request1) @@ -1478,7 +1683,8 @@ func resourceSponsoredGuestPortalCreate(ctx context.Context, d *schema.ResourceD func resourceSponsoredGuestPortalRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsoredGuestPortal read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1524,6 +1730,12 @@ func resourceSponsoredGuestPortalRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsoredGuestPortals search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -1549,6 +1761,12 @@ func resourceSponsoredGuestPortalRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSponsoredGuestPortalByID response", + err)) + return diags + } return diags } @@ -1557,7 +1775,8 @@ func resourceSponsoredGuestPortalRead(ctx context.Context, d *schema.ResourceDat func resourceSponsoredGuestPortalUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsoredGuestPortal update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -1622,7 +1841,8 @@ func resourceSponsoredGuestPortalUpdate(ctx context.Context, d *schema.ResourceD func resourceSponsoredGuestPortalDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SponsoredGuestPortal delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -2840,7 +3060,8 @@ func expandRequestSponsoredGuestPortalUpdateSponsoredGuestPortalByIDSponsoredGue } func getAllItemsSponsoredGuestPortalGetSponsoredGuestPortals(m interface{}, response *isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortals, queryParams *isegosdk.GetSponsoredGuestPortalsQueryParams) []isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortalsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortalsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -2868,7 +3089,8 @@ func getAllItemsSponsoredGuestPortalGetSponsoredGuestPortals(m interface{}, resp } func searchSponsoredGuestPortalGetSponsoredGuestPortals(m interface{}, items []isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortalsSearchResultResources, name string, id string) (*isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortalByIDSponsoredGuestPortal, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSponsoredGuestPortalGetSponsoredGuestPortalByIDSponsoredGuestPortal for _, item := range items { diff --git a/ciscoise/resource_sxp_connections.go b/ciscoise/resource_sxp_connections.go index d9e7bf52..d5964494 100644 --- a/ciscoise/resource_sxp_connections.go +++ b/ciscoise/resource_sxp_connections.go @@ -113,41 +113,80 @@ func resourceSxpConnections() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "enabled": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ip_address": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "sxp_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sxp_node": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sxp_peer": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sxp_version": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sxp_vpn": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -158,8 +197,10 @@ func resourceSxpConnections() *schema.Resource { func resourceSxpConnectionsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpConnections create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -170,27 +211,29 @@ func resourceSxpConnectionsCreate(ctx context.Context, d *schema.ResourceData, m vID, okID := resourceItem["id"] vvID := interfaceToString(vID) - if okID && vvID != "" { - getResponse2, _, err := client.SxpConnections.GetSxpConnectionsByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - d.SetId(joinResourceID(resourceMap)) - return resourceSxpConnectionsRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSxpConnectionsQueryParams{} - - response2, _, err := client.SxpConnections.GetSxpConnections(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSxpConnectionsGetSxpConnections(m, response2, &queryParams2) - item2, err := searchSxpConnectionsGetSxpConnections(m, items2, "", vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SxpConnections.GetSxpConnectionsByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID d.SetId(joinResourceID(resourceMap)) return resourceSxpConnectionsRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSxpConnectionsQueryParams{} + + response2, _, err := client.SxpConnections.GetSxpConnections(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSxpConnectionsGetSxpConnections(m, response2, &queryParams2) + item2, err := searchSxpConnectionsGetSxpConnections(m, items2, "", vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + d.SetId(joinResourceID(resourceMap)) + return resourceSxpConnectionsRead(ctx, d, m) + } + } } } restyResp1, err := client.SxpConnections.CreateSxpConnections(request1) @@ -216,7 +259,8 @@ func resourceSxpConnectionsCreate(ctx context.Context, d *schema.ResourceData, m func resourceSxpConnectionsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpConnections read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -260,6 +304,12 @@ func resourceSxpConnectionsRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpConnections search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -285,6 +335,12 @@ func resourceSxpConnectionsRead(ctx context.Context, d *schema.ResourceData, m i err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpConnectionsByID response", + err)) + return diags + } return diags } @@ -293,7 +349,8 @@ func resourceSxpConnectionsRead(ctx context.Context, d *schema.ResourceData, m i func resourceSxpConnectionsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpConnections update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -341,7 +398,8 @@ func resourceSxpConnectionsUpdate(ctx context.Context, d *schema.ResourceData, m func resourceSxpConnectionsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpConnections delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -492,7 +550,8 @@ func expandRequestSxpConnectionsUpdateSxpConnectionsByIDERSSxpConnection(ctx con } func getAllItemsSxpConnectionsGetSxpConnections(m interface{}, response *isegosdk.ResponseSxpConnectionsGetSxpConnections, queryParams *isegosdk.GetSxpConnectionsQueryParams) []isegosdk.ResponseSxpConnectionsGetSxpConnectionsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSxpConnectionsGetSxpConnectionsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -520,7 +579,8 @@ func getAllItemsSxpConnectionsGetSxpConnections(m interface{}, response *isegosd } func searchSxpConnectionsGetSxpConnections(m interface{}, items []isegosdk.ResponseSxpConnectionsGetSxpConnectionsSearchResultResources, name string, id string) (*isegosdk.ResponseSxpConnectionsGetSxpConnectionsByIDERSSxpConnection, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSxpConnectionsGetSxpConnectionsByIDERSSxpConnection for _, item := range items { diff --git a/ciscoise/resource_sxp_connections_bulk_request.go b/ciscoise/resource_sxp_connections_bulk_request.go index b8febc17..334ad8fa 100644 --- a/ciscoise/resource_sxp_connections_bulk_request.go +++ b/ciscoise/resource_sxp_connections_bulk_request.go @@ -60,7 +60,8 @@ func resourceSxpConnectionsBulkRequest() *schema.Resource { func resourceSxpConnectionsBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSxpConnections create") log.Printf("[DEBUG] Missing BulkRequestForSxpConnections create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSxpConnectionsBulkRequestBulkRequestForSxpConnections(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sxp_local_bindings.go b/ciscoise/resource_sxp_local_bindings.go index 35c91ce9..887cce00 100644 --- a/ciscoise/resource_sxp_local_bindings.go +++ b/ciscoise/resource_sxp_local_bindings.go @@ -110,38 +110,72 @@ func resourceSxpLocalBindings() *schema.Resource { Schema: map[string]*schema.Schema{ "binding_name": &schema.Schema{ - Description: `This field is depricated from Cisco ISE 3.0`, - Type: schema.TypeString, - Optional: true, + Description: `This field is depricated from Cisco ISE 3.0`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "ip_address_or_host": &schema.Schema{ - Description: `IP address for static mapping (hostname is not supported)`, - Type: schema.TypeString, - Optional: true, + Description: `IP address for static mapping (hostname is not supported)`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "sgt": &schema.Schema{ Description: `SGT name or ID`, Type: schema.TypeString, Optional: true, - DiffSuppressFunc: diffSuppressSgt(), + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sxp_vpn": &schema.Schema{ - Description: `List of SXP Domains, separated with comma. At least one of: sxpVpn or vns should be defined`, - Type: schema.TypeString, - Optional: true, + Description: `List of SXP Domains, separated with comma. At least one of: sxpVpn or vns should be defined`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vns": &schema.Schema{ - Description: `List of Virtual Networks, separated with comma. At least one of: sxpVpn or vns should be defined`, - Type: schema.TypeString, - Optional: true, + Description: `List of Virtual Networks, separated with comma. At least one of: sxpVpn or vns should be defined`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -152,8 +186,10 @@ func resourceSxpLocalBindings() *schema.Resource { func resourceSxpLocalBindingsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpLocalBindings create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -164,27 +200,29 @@ func resourceSxpLocalBindingsCreate(ctx context.Context, d *schema.ResourceData, vID, okID := resourceItem["id"] vvID := interfaceToString(vID) - if okID && vvID != "" { - getResponse2, _, err := client.SxpLocalBindings.GetSxpLocalBindingsByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - d.SetId(joinResourceID(resourceMap)) - return resourceSxpLocalBindingsRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSxpLocalBindingsQueryParams{} - - response2, _, err := client.SxpLocalBindings.GetSxpLocalBindings(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSxpLocalBindingsGetSxpLocalBindings(m, response2, &queryParams2) - item2, err := searchSxpLocalBindingsGetSxpLocalBindings(m, items2, "", vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SxpLocalBindings.GetSxpLocalBindingsByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID d.SetId(joinResourceID(resourceMap)) return resourceSxpLocalBindingsRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSxpLocalBindingsQueryParams{} + + response2, _, err := client.SxpLocalBindings.GetSxpLocalBindings(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSxpLocalBindingsGetSxpLocalBindings(m, response2, &queryParams2) + item2, err := searchSxpLocalBindingsGetSxpLocalBindings(m, items2, "", vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + d.SetId(joinResourceID(resourceMap)) + return resourceSxpLocalBindingsRead(ctx, d, m) + } + } } } restyResp1, err := client.SxpLocalBindings.CreateSxpLocalBindings(request1) @@ -210,7 +248,8 @@ func resourceSxpLocalBindingsCreate(ctx context.Context, d *schema.ResourceData, func resourceSxpLocalBindingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpLocalBindings read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -254,6 +293,12 @@ func resourceSxpLocalBindingsRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpLocalBindings search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -279,6 +324,12 @@ func resourceSxpLocalBindingsRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpLocalBindingsByID response", + err)) + return diags + } return diags } @@ -287,7 +338,8 @@ func resourceSxpLocalBindingsRead(ctx context.Context, d *schema.ResourceData, m func resourceSxpLocalBindingsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpLocalBindings update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -334,7 +386,8 @@ func resourceSxpLocalBindingsUpdate(ctx context.Context, d *schema.ResourceData, func resourceSxpLocalBindingsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpLocalBindings delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -478,7 +531,8 @@ func expandRequestSxpLocalBindingsUpdateSxpLocalBindingsByIDERSSxpLocalBindings( } func getAllItemsSxpLocalBindingsGetSxpLocalBindings(m interface{}, response *isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindings, queryParams *isegosdk.GetSxpLocalBindingsQueryParams) []isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindingsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindingsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -506,7 +560,8 @@ func getAllItemsSxpLocalBindingsGetSxpLocalBindings(m interface{}, response *ise } func searchSxpLocalBindingsGetSxpLocalBindings(m interface{}, items []isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindingsSearchResultResources, name string, id string) (*isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindingsByIDERSSxpLocalBindings, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSxpLocalBindingsGetSxpLocalBindingsByIDERSSxpLocalBindings for _, item := range items { diff --git a/ciscoise/resource_sxp_local_bindings_bulk_request.go b/ciscoise/resource_sxp_local_bindings_bulk_request.go index f205f6bd..28256147 100644 --- a/ciscoise/resource_sxp_local_bindings_bulk_request.go +++ b/ciscoise/resource_sxp_local_bindings_bulk_request.go @@ -60,7 +60,8 @@ func resourceSxpLocalBindingsBulkRequest() *schema.Resource { func resourceSxpLocalBindingsBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSxpLocalBindings create") log.Printf("[DEBUG] Missing BulkRequestForSxpLocalBindings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSxpLocalBindingsBulkRequestBulkRequestForSxpLocalBindings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_sxp_vpns.go b/ciscoise/resource_sxp_vpns.go index b3a9fa7e..90ea3eef 100644 --- a/ciscoise/resource_sxp_vpns.go +++ b/ciscoise/resource_sxp_vpns.go @@ -81,14 +81,39 @@ func resourceSxpVpns() *schema.Resource { MinItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "id": &schema.Schema{ - Description: `id path parameter.`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter.`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "sxp_vpn_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -99,8 +124,10 @@ func resourceSxpVpns() *schema.Resource { func resourceSxpVpnsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpVpns create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -113,29 +140,31 @@ func resourceSxpVpnsCreate(ctx context.Context, d *schema.ResourceData, m interf vName, _ := resourceItem["sxp_vpn_name"] vvID := interfaceToString(vID) vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.SxpVpns.GetSxpVpnByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["sxp_vpn_name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceSxpVpnsRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSxpVpnsQueryParams{} - - response2, _, err := client.SxpVpns.GetSxpVpns(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSxpVpnsGetSxpVpns(m, response2, &queryParams2) - item2, err := searchSxpVpnsGetSxpVpns(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SxpVpns.GetSxpVpnByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["sxp_vpn_name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceSxpVpnsRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSxpVpnsQueryParams{} + + response2, _, err := client.SxpVpns.GetSxpVpns(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSxpVpnsGetSxpVpns(m, response2, &queryParams2) + item2, err := searchSxpVpnsGetSxpVpns(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = item2.ID + resourceMap["sxp_vpn_name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceSxpVpnsRead(ctx, d, m) + } + } } } restyResp1, err := client.SxpVpns.CreateSxpVpn(request1) @@ -162,7 +191,8 @@ func resourceSxpVpnsCreate(ctx context.Context, d *schema.ResourceData, m interf func resourceSxpVpnsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpVpns read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -208,6 +238,12 @@ func resourceSxpVpnsRead(ctx context.Context, d *schema.ResourceData, m interfac err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpVpns search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -233,6 +269,12 @@ func resourceSxpVpnsRead(ctx context.Context, d *schema.ResourceData, m interfac err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSxpVpnByID response", + err)) + return diags + } return diags } @@ -248,7 +290,8 @@ func resourceSxpVpnsUpdate(ctx context.Context, d *schema.ResourceData, m interf func resourceSxpVpnsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SxpVpns delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -335,7 +378,8 @@ func expandRequestSxpVpnsCreateSxpVpnERSSxpVpn(ctx context.Context, key string, } func getAllItemsSxpVpnsGetSxpVpns(m interface{}, response *isegosdk.ResponseSxpVpnsGetSxpVpns, queryParams *isegosdk.GetSxpVpnsQueryParams) []isegosdk.ResponseSxpVpnsGetSxpVpnsSearchResultResources { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseSxpVpnsGetSxpVpnsSearchResultResources for response.SearchResult != nil && response.SearchResult.Resources != nil && len(*response.SearchResult.Resources) > 0 { respItems = append(respItems, *response.SearchResult.Resources...) @@ -363,7 +407,8 @@ func getAllItemsSxpVpnsGetSxpVpns(m interface{}, response *isegosdk.ResponseSxpV } func searchSxpVpnsGetSxpVpns(m interface{}, items []isegosdk.ResponseSxpVpnsGetSxpVpnsSearchResultResources, name string, id string) (*isegosdk.ResponseSxpVpnsGetSxpVpnByIDERSSxpVpn, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseSxpVpnsGetSxpVpnByIDERSSxpVpn for _, item := range items { diff --git a/ciscoise/resource_sxp_vpns_bulk_request.go b/ciscoise/resource_sxp_vpns_bulk_request.go index 3b90ec2a..1b554b0e 100644 --- a/ciscoise/resource_sxp_vpns_bulk_request.go +++ b/ciscoise/resource_sxp_vpns_bulk_request.go @@ -60,7 +60,8 @@ func resourceSxpVpnsBulkRequest() *schema.Resource { func resourceSxpVpnsBulkRequestCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkRequestForSxpVpns create") log.Printf("[DEBUG] Missing BulkRequestForSxpVpns create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestSxpVpnsBulkRequestBulkRequestForSxpVpns(ctx, "parameters.0", d) diff --git a/ciscoise/resource_system_certificate.go b/ciscoise/resource_system_certificate.go index 7229e382..75fbb162 100644 --- a/ciscoise/resource_system_certificate.go +++ b/ciscoise/resource_system_certificate.go @@ -144,110 +144,221 @@ Request parameters accepting True and False as input can be replaced by 1 and 0 }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "admin": &schema.Schema{ - Description: `Use certificate to authenticate the Cisco ISE Admin Portal`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use certificate to authenticate the Cisco ISE Admin Portal`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_portal_tag_transfer_for_same_subject": &schema.Schema{ - Description: `Allow overwriting the portal tag from matching certificate of same subject`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow overwriting the portal tag from matching certificate of same subject`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_replacement_of_portal_group_tag": &schema.Schema{ - Description: `Allow Replacement of Portal Group Tag (required)`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow Replacement of Portal Group Tag (required)`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "allow_role_transfer_for_same_subject": &schema.Schema{ - Description: `Allow transfer of roles for certificate with matching subject `, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Allow transfer of roles for certificate with matching subject `, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "description": &schema.Schema{ - Description: `Description of System Certificate`, - Type: schema.TypeString, - Optional: true, + Description: `Description of System Certificate`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "eap": &schema.Schema{ - Description: `Use certificate for EAP protocols that use SSL/TLS tunneling`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use certificate for EAP protocols that use SSL/TLS tunneling`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "expiration_date": &schema.Schema{ + Description: `Time and date past which the certificate is no longer valid`, + Type: schema.TypeString, + Computed: true, }, "expiration_ttl_period": &schema.Schema{ - Type: schema.TypeInt, - Optional: true, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "expiration_ttl_units": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, - "ims": &schema.Schema{ - Description: `Use certificate for the Cisco ISE Messaging Service`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + "friendly_name": &schema.Schema{ + Description: `Friendly name of system certificate`, + Type: schema.TypeString, + Computed: true, + }, + "group_tag": &schema.Schema{ + Type: schema.TypeString, + Computed: true, }, "host_name": &schema.Schema{ Description: `hostName path parameter. Name of Host whose certificate needs to be updated`, Type: schema.TypeString, - Optional: true, + Required: true, }, "id": &schema.Schema{ Description: `id path parameter. ID of the System Certificate to be updated`, Type: schema.TypeString, - Optional: true, + Required: true, }, - "name": &schema.Schema{ - Description: `Name of the certificate`, + "ims": &schema.Schema{ + Description: `Use certificate for the Cisco ISE Messaging Service`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "issued_by": &schema.Schema{ + Description: `Common Name of the certificate issuer`, Type: schema.TypeString, - Optional: true, + Computed: true, + }, + "issued_to": &schema.Schema{ + Description: `Common Name of the certificate subject`, + Type: schema.TypeString, + Computed: true, + }, + "key_size": &schema.Schema{ + Description: `Length of key used for encrypting system certificate`, + Type: schema.TypeInt, + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "name": &schema.Schema{ + Description: `Name of the certificate`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "portal": &schema.Schema{ - Description: `Use for portal`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use for portal`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "portal_group_tag": &schema.Schema{ - Description: `Set Group tag`, - Type: schema.TypeString, - Optional: true, + Description: `Set Group tag`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "portals_using_the_tag": &schema.Schema{ + Type: schema.TypeString, + Computed: true, }, "pxgrid": &schema.Schema{ - Description: `Use certificate for the pxGrid Controller`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use certificate for the pxGrid Controller`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "radius": &schema.Schema{ - Description: `Use certificate for the RADSec server`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use certificate for the RADSec server`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "renew_self_signed_certificate": &schema.Schema{ - Description: `Renew Self-signed Certificate`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Renew Self-signed Certificate`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "saml": &schema.Schema{ - Description: `Use certificate for SAML Signing`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Use certificate for SAML Signing`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "self_signed": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "serial_number_decimal_format": &schema.Schema{ + Description: `Used to uniquely identify the certificate within a CA's systems`, + Type: schema.TypeString, + Computed: true, + }, + "sha256_fingerprint": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "signature_algorithm": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "used_by": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "valid_from": &schema.Schema{ + Description: `Time and date on which the certificate was created, also known as the Not Before certificate attribute`, + Type: schema.TypeString, + Computed: true, }, }, }, @@ -259,7 +370,8 @@ Request parameters accepting True and False as input can be replaced by 1 and 0 func resourceSystemCertificateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SystemCertificate create") log.Printf("[DEBUG] Missing SystemCertificate create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -295,7 +407,8 @@ func resourceSystemCertificateCreate(ctx context.Context, d *schema.ResourceData func resourceSystemCertificateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SystemCertificate read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -343,6 +456,12 @@ func resourceSystemCertificateRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSystemCertificates search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -367,6 +486,12 @@ func resourceSystemCertificateRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSystemCertificateByID response", + err)) + return diags + } return diags } @@ -375,7 +500,8 @@ func resourceSystemCertificateRead(ctx context.Context, d *schema.ResourceData, func resourceSystemCertificateUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SystemCertificate update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -428,7 +554,8 @@ func resourceSystemCertificateUpdate(ctx context.Context, d *schema.ResourceData func resourceSystemCertificateDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning SystemCertificate delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -532,7 +659,8 @@ func expandRequestSystemCertificateUpdateSystemCert(ctx context.Context, key str } func getAllItemsCertificatesGetSystemCertificates(m interface{}, response *isegosdk.ResponseCertificatesGetSystemCertificates, hostname string, queryParams *isegosdk.GetSystemCertificatesQueryParams) []isegosdk.ResponseCertificatesGetSystemCertificatesResponse { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseCertificatesGetSystemCertificatesResponse for response.Response != nil && len(*response.Response) > 0 { respItems = append(respItems, *response.Response...) @@ -560,7 +688,8 @@ func getAllItemsCertificatesGetSystemCertificates(m interface{}, response *isego } func searchCertificatesGetSystemCertificates(m interface{}, items []isegosdk.ResponseCertificatesGetSystemCertificatesResponse, name string, id string, hostname string) (*isegosdk.ResponseCertificatesGetSystemCertificateByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseCertificatesGetSystemCertificateByIDResponse for _, item := range items { diff --git a/ciscoise/resource_system_certificate_import.go b/ciscoise/resource_system_certificate_import.go index d3147e3d..61308d84 100644 --- a/ciscoise/resource_system_certificate_import.go +++ b/ciscoise/resource_system_certificate_import.go @@ -220,7 +220,8 @@ Request parameters accepting True and False as input can be replaced by 1 and 0 func resourceSystemCertificateImportCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ImportSystemCert create") log.Printf("[DEBUG] Missing ImportSystemCert create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_tacacs_command_sets.go b/ciscoise/resource_tacacs_command_sets.go index 4ca0284b..cb7da4ed 100644 --- a/ciscoise/resource_tacacs_command_sets.go +++ b/ciscoise/resource_tacacs_command_sets.go @@ -124,30 +124,39 @@ func resourceTacacsCommandSets() *schema.Resource { Schema: map[string]*schema.Schema{ "commands": &schema.Schema{ - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "command_list": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "arguments": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "command": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "grant": &schema.Schema{ - Description: `Allowed values: PERMIT, DENY, DENY_ALWAYS`, - Type: schema.TypeString, - Optional: true, + Description: `Allowed values: PERMIT, DENY, DENY_ALWAYS`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -156,21 +165,50 @@ func resourceTacacsCommandSets() *schema.Resource { }, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "permit_unmatched": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -181,8 +219,10 @@ func resourceTacacsCommandSets() *schema.Resource { func resourceTacacsCommandSetsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsCommandSets create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -195,24 +235,26 @@ func resourceTacacsCommandSetsCreate(ctx context.Context, d *schema.ResourceData vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.TacacsCommandSets.GetTacacsCommandSetsByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsCommandSetsRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.TacacsCommandSets.GetTacacsCommandSetsByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsCommandSetsRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.TacacsCommandSets.GetTacacsCommandSetsByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsCommandSetsRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.TacacsCommandSets.GetTacacsCommandSetsByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.TacacsCommandSets.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsCommandSetsRead(ctx, d, m) + } } } restyResp1, err := client.TacacsCommandSets.CreateTacacsCommandSets(request1) @@ -239,7 +281,8 @@ func resourceTacacsCommandSetsCreate(ctx context.Context, d *schema.ResourceData func resourceTacacsCommandSetsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsCommandSets read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -277,6 +320,18 @@ func resourceTacacsCommandSetsRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsCommandSetsByName response", + err)) + return diags + } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsCommandSetsByName response", + err)) + return diags + } return diags } @@ -303,6 +358,18 @@ func resourceTacacsCommandSetsRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsCommandSetsByID response", + err)) + return diags + } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsCommandSetsByID response", + err)) + return diags + } return diags } @@ -311,7 +378,8 @@ func resourceTacacsCommandSetsRead(ctx context.Context, d *schema.ResourceData, func resourceTacacsCommandSetsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsCommandSets update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -373,7 +441,8 @@ func resourceTacacsCommandSetsUpdate(ctx context.Context, d *schema.ResourceData func resourceTacacsCommandSetsDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsCommandSets delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_tacacs_external_servers.go b/ciscoise/resource_tacacs_external_servers.go index af935e58..33d4c73d 100644 --- a/ciscoise/resource_tacacs_external_servers.go +++ b/ciscoise/resource_tacacs_external_servers.go @@ -113,42 +113,79 @@ func resourceTacacsExternalServers() *schema.Resource { Schema: map[string]*schema.Schema{ "connection_port": &schema.Schema{ - Description: `The port to connect the server`, - Type: schema.TypeInt, - Optional: true, + Description: `The port to connect the server`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "host_ip": &schema.Schema{ - Description: `The server IPV4 address`, - Type: schema.TypeString, - Optional: true, + Description: `The server IPV4 address`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "shared_secret": &schema.Schema{ - Description: `The server shared secret`, - Type: schema.TypeString, - Optional: true, + Description: `The server shared secret`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "single_connect": &schema.Schema{ - Description: `Define the use of single connection`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Define the use of single connection`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "timeout": &schema.Schema{ - Description: `The server timeout`, - Type: schema.TypeInt, - Optional: true, + Description: `The server timeout`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -159,8 +196,10 @@ func resourceTacacsExternalServers() *schema.Resource { func resourceTacacsExternalServersCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsExternalServers create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -173,24 +212,26 @@ func resourceTacacsExternalServersCreate(ctx context.Context, d *schema.Resource vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.TacacsExternalServers.GetTacacsExternalServersByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsExternalServersRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.TacacsExternalServers.GetTacacsExternalServersByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsExternalServersRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.TacacsExternalServers.GetTacacsExternalServersByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsExternalServersRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.TacacsExternalServers.GetTacacsExternalServersByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.TacacsExternalServer.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsExternalServersRead(ctx, d, m) + } } } restyResp1, err := client.TacacsExternalServers.CreateTacacsExternalServers(request1) @@ -217,7 +258,8 @@ func resourceTacacsExternalServersCreate(ctx context.Context, d *schema.Resource func resourceTacacsExternalServersRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsExternalServers read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -255,6 +297,12 @@ func resourceTacacsExternalServersRead(ctx context.Context, d *schema.ResourceDa err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsExternalServersByName response", + err)) + return diags + } return diags } @@ -281,6 +329,12 @@ func resourceTacacsExternalServersRead(ctx context.Context, d *schema.ResourceDa err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsExternalServersByID response", + err)) + return diags + } return diags } @@ -289,7 +343,8 @@ func resourceTacacsExternalServersRead(ctx context.Context, d *schema.ResourceDa func resourceTacacsExternalServersUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsExternalServers update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -351,7 +406,8 @@ func resourceTacacsExternalServersUpdate(ctx context.Context, d *schema.Resource func resourceTacacsExternalServersDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsExternalServers delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_tacacs_profile.go b/ciscoise/resource_tacacs_profile.go index b5807040..40d46676 100644 --- a/ciscoise/resource_tacacs_profile.go +++ b/ciscoise/resource_tacacs_profile.go @@ -121,43 +121,79 @@ func resourceTacacsProfile() *schema.Resource { Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "session_attributes": &schema.Schema{ - Description: `Holds list of session attributes. View type for GUI is Shell by default`, - Type: schema.TypeList, - Optional: true, - MaxItems: 1, + Description: `Holds list of session attributes. View type for GUI is Shell by default`, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "session_attribute_list": &schema.Schema{ - Type: schema.TypeList, - Optional: true, + Type: schema.TypeList, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "type": &schema.Schema{ - Description: `Allowed values: MANDATORY, OPTIONAL`, - Type: schema.TypeString, - Optional: true, + Description: `Allowed values: MANDATORY, OPTIONAL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "value": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -174,8 +210,10 @@ func resourceTacacsProfile() *schema.Resource { func resourceTacacsProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsProfile create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -188,24 +226,26 @@ func resourceTacacsProfileCreate(ctx context.Context, d *schema.ResourceData, m vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.TacacsProfile.GetTacacsProfileByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsProfileRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.TacacsProfile.GetTacacsProfileByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsProfileRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.TacacsProfile.GetTacacsProfileByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsProfileRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.TacacsProfile.GetTacacsProfileByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.TacacsProfile.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsProfileRead(ctx, d, m) + } } } restyResp1, err := client.TacacsProfile.CreateTacacsProfile(request1) @@ -232,7 +272,8 @@ func resourceTacacsProfileCreate(ctx context.Context, d *schema.ResourceData, m func resourceTacacsProfileRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsProfile read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -270,6 +311,12 @@ func resourceTacacsProfileRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsProfileByName response", + err)) + return diags + } return diags } @@ -296,6 +343,12 @@ func resourceTacacsProfileRead(ctx context.Context, d *schema.ResourceData, m in err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsProfileByID response", + err)) + return diags + } return diags } @@ -304,7 +357,8 @@ func resourceTacacsProfileRead(ctx context.Context, d *schema.ResourceData, m in func resourceTacacsProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsProfile update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -366,7 +420,8 @@ func resourceTacacsProfileUpdate(ctx context.Context, d *schema.ResourceData, m func resourceTacacsProfileDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsProfile delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_tacacs_server_sequence.go b/ciscoise/resource_tacacs_server_sequence.go index 5428d65e..0eebd505 100644 --- a/ciscoise/resource_tacacs_server_sequence.go +++ b/ciscoise/resource_tacacs_server_sequence.go @@ -122,54 +122,95 @@ The order of the names in the string is the order of servers that will be used d Schema: map[string]*schema.Schema{ "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, }, "local_accounting": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "prefix_delimiter": &schema.Schema{ - Description: `The delimiter that will be used for prefix strip`, - Type: schema.TypeString, - Optional: true, + Description: `The delimiter that will be used for prefix strip`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "prefix_strip": &schema.Schema{ - Description: `Define if a delimiter will be used for prefix strip`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Define if a delimiter will be used for prefix strip`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "remote_accounting": &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "server_list": &schema.Schema{ Description: `The names of Tacacs external servers separated by commas. -The order of the names in the string is the order of servers that will be used during authentication`, - Type: schema.TypeString, - Optional: true, + The order of the names in the string is the order of servers that will be used during authentication`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "suffix_delimiter": &schema.Schema{ - Description: `The delimiter that will be used for suffix strip`, - Type: schema.TypeString, - Optional: true, + Description: `The delimiter that will be used for suffix strip`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "suffix_strip": &schema.Schema{ - Description: `Define if a delimiter will be used for suffix strip`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Define if a delimiter will be used for suffix strip`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, }, }, @@ -180,8 +221,10 @@ The order of the names in the string is the order of servers that will be used d func resourceTacacsServerSequenceCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsServerSequence create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -194,24 +237,26 @@ func resourceTacacsServerSequenceCreate(ctx context.Context, d *schema.ResourceD vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse1, _, err := client.TacacsServerSequence.GetTacacsServerSequenceByID(vvID) - if err == nil && getResponse1 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsServerSequenceRead(ctx, d, m) + if isEnableAutoImport { + if okID && vvID != "" { + getResponse1, _, err := client.TacacsServerSequence.GetTacacsServerSequenceByID(vvID) + if err == nil && getResponse1 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsServerSequenceRead(ctx, d, m) + } } - } - if okName && vvName != "" { - getResponse2, _, err := client.TacacsServerSequence.GetTacacsServerSequenceByName(vvName) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTacacsServerSequenceRead(ctx, d, m) + if okName && vvName != "" { + getResponse2, _, err := client.TacacsServerSequence.GetTacacsServerSequenceByName(vvName) + if err == nil && getResponse2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = getResponse2.TacacsServerSequence.ID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTacacsServerSequenceRead(ctx, d, m) + } } } restyResp1, err := client.TacacsServerSequence.CreateTacacsServerSequence(request1) @@ -238,7 +283,8 @@ func resourceTacacsServerSequenceCreate(ctx context.Context, d *schema.ResourceD func resourceTacacsServerSequenceRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsServerSequence read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -276,6 +322,12 @@ func resourceTacacsServerSequenceRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemName1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsServerSequenceByName response", + err)) + return diags + } return diags } @@ -302,6 +354,12 @@ func resourceTacacsServerSequenceRead(ctx context.Context, d *schema.ResourceDat err)) return diags } + if err := d.Set("parameters", vItemID2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTacacsServerSequenceByID response", + err)) + return diags + } return diags } @@ -310,7 +368,8 @@ func resourceTacacsServerSequenceRead(ctx context.Context, d *schema.ResourceDat func resourceTacacsServerSequenceUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsServerSequence update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -372,7 +431,8 @@ func resourceTacacsServerSequenceUpdate(ctx context.Context, d *schema.ResourceD func resourceTacacsServerSequenceDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TacacsServerSequence delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics diff --git a/ciscoise/resource_threat_vulnerabilities_clear.go b/ciscoise/resource_threat_vulnerabilities_clear.go index ba306a34..1380fe58 100644 --- a/ciscoise/resource_threat_vulnerabilities_clear.go +++ b/ciscoise/resource_threat_vulnerabilities_clear.go @@ -56,7 +56,8 @@ given MAC Address. func resourceThreatVulnerabilitiesClearCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ClearThreatsAndVulnerabilities create") log.Printf("[DEBUG] Missing ClearThreatsAndVulnerabilities create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestThreatVulnerabilitiesClearClearThreatsAndVulnerabilities(ctx, "parameters.0", d) diff --git a/ciscoise/resource_transport_gateway_settings.go b/ciscoise/resource_transport_gateway_settings.go index 5be07587..06052aeb 100644 --- a/ciscoise/resource_transport_gateway_settings.go +++ b/ciscoise/resource_transport_gateway_settings.go @@ -55,9 +55,8 @@ in case of air-gapped network. }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -66,11 +65,13 @@ in case of air-gapped network. Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, + Computed: true, }, "url": &schema.Schema{ Description: `URL of transport gateway`, Type: schema.TypeString, Optional: true, + Computed: true, }, }, }, @@ -82,7 +83,8 @@ in case of air-gapped network. func resourceTransportGatewaySettingsCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TransportGatewaySettings create") log.Printf("[DEBUG] Missing TransportGatewaySettings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -114,7 +116,8 @@ func resourceTransportGatewaySettingsCreate(ctx context.Context, d *schema.Resou func resourceTransportGatewaySettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TransportGatewaySettings read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -141,6 +144,12 @@ func resourceTransportGatewaySettingsRead(ctx context.Context, d *schema.Resourc err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTransportGateway response", + err)) + return diags + } return diags } @@ -149,7 +158,8 @@ func resourceTransportGatewaySettingsRead(ctx context.Context, d *schema.Resourc func resourceTransportGatewaySettingsUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TransportGatewaySettings update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics if d.HasChange("parameters") { diff --git a/ciscoise/resource_trusted_certificate.go b/ciscoise/resource_trusted_certificate.go index a2d32cca..3a7ed54b 100644 --- a/ciscoise/resource_trusted_certificate.go +++ b/ciscoise/resource_trusted_certificate.go @@ -225,9 +225,8 @@ func resourceTrustedCertificate() *schema.Resource { }, "parameters": &schema.Schema{ Type: schema.TypeList, - Required: true, - MaxItems: 1, - MinItems: 1, + Optional: true, + Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -236,139 +235,260 @@ func resourceTrustedCertificate() *schema.Resource { Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "automatic_crl_update": &schema.Schema{ Description: `Switch to enable or disable automatic CRL update`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "automatic_crl_update_period": &schema.Schema{ - Description: `Automatic CRL update period`, - Type: schema.TypeInt, - Optional: true, + Description: `Automatic CRL update period`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "automatic_crl_update_units": &schema.Schema{ - Description: `Unit of time for automatic CRL update`, - Type: schema.TypeString, - Optional: true, + Description: `Unit of time for automatic CRL update`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "crl_distribution_url": &schema.Schema{ - Description: `CRL Distribution URL`, - Type: schema.TypeString, - Optional: true, + Description: `CRL Distribution URL`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "crl_download_failure_retries": &schema.Schema{ - Description: `If CRL download fails, wait time before retry`, - Type: schema.TypeInt, - Optional: true, + Description: `If CRL download fails, wait time before retry`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "crl_download_failure_retries_units": &schema.Schema{ - Description: `Unit of time before retry if CRL download fails`, - Type: schema.TypeString, - Optional: true, + Description: `Unit of time before retry if CRL download fails`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "description": &schema.Schema{ - Description: `Description for trust certificate`, - Type: schema.TypeString, - Optional: true, + Description: `Description for trust certificate`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "download_crl": &schema.Schema{ Description: `Switch to enable or disable download of CRL`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_ocsp_validation": &schema.Schema{ Description: `Switch to enable or disable OCSP Validation`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "enable_server_identity_check": &schema.Schema{ Description: `Switch to enable or disable verification if HTTPS or LDAP server certificate name fits the configured server URL`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "expiration_date": &schema.Schema{ + Description: `The time and date past which the certificate is no longer valid`, + Type: schema.TypeString, + Computed: true, + }, + "friendly_name": &schema.Schema{ + Description: `Friendly name of trust certificate`, + Type: schema.TypeString, + Computed: true, }, "id": &schema.Schema{ Description: `id path parameter. ID of the trust certificate`, Type: schema.TypeString, - Optional: true, + Required: true, }, "ignore_crl_expiration": &schema.Schema{ Description: `Switch to enable or disable ignore CRL expiration`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, - "name": &schema.Schema{ - Description: `Friendly name of the certificate`, + "internal_ca": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "is_referred_in_policy": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "issued_by": &schema.Schema{ + Description: `The entity that verified the information and signed the certificate`, Type: schema.TypeString, - Optional: true, + Computed: true, + }, + "issued_to": &schema.Schema{ + Description: `Entity to which trust certificate is issued`, + Type: schema.TypeString, + Computed: true, + }, + "key_size": &schema.Schema{ + Description: `The length of key used for encrypting trust certificate`, + Type: schema.TypeString, + Computed: true, + }, + "link": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "rel": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + "type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + "name": &schema.Schema{ + Description: `Friendly name of the certificate`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "non_automatic_crl_update_period": &schema.Schema{ - Description: `Non automatic CRL update period`, - Type: schema.TypeInt, - Optional: true, + Description: `Non automatic CRL update period`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "non_automatic_crl_update_units": &schema.Schema{ - Description: `Unit of time of non automatic CRL update`, - Type: schema.TypeString, - Optional: true, + Description: `Unit of time of non automatic CRL update`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "reject_if_no_status_from_ocs_p": &schema.Schema{ Description: `Switch to reject certificate if there is no status from OCSP`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "reject_if_unreachable_from_ocs_p": &schema.Schema{ Description: `Switch to reject certificate if unreachable from OCSP`, Type: schema.TypeString, ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), Optional: true, - DiffSuppressFunc: diffSuppressBooleans(), + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "selected_ocsp_service": &schema.Schema{ - Description: `Name of selected OCSP Service`, + Description: `Name of selected OCSP Service`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "serial_number_decimal_format": &schema.Schema{ + Description: `Used to uniquely identify the certificate within a CA's systems`, Type: schema.TypeString, - Optional: true, + Computed: true, }, - "status": &schema.Schema{ + "sha256_fingerprint": &schema.Schema{ Type: schema.TypeString, - Optional: true, + Computed: true, + }, + "signature_algorithm": &schema.Schema{ + Description: `Algorithm used for encrypting trust certificate`, + Type: schema.TypeString, + Computed: true, + }, + "status": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, + }, + "subject": &schema.Schema{ + Description: `The Subject or entity with which public key of trust certificate is associated`, + Type: schema.TypeString, + Computed: true, }, "trust_for_certificate_based_admin_auth": &schema.Schema{ - Description: `Trust for Certificate based Admin authentication`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Trust for Certificate based Admin authentication`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "trust_for_cisco_services_auth": &schema.Schema{ - Description: `Trust for authentication of Cisco Services`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Trust for authentication of Cisco Services`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "trust_for_client_auth": &schema.Schema{ - Description: `Trust for client authentication and Syslog`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Trust for client authentication and Syslog`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, }, "trust_for_ise_auth": &schema.Schema{ - Description: `Trust for authentication within Cisco ISE`, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Description: `Trust for authentication within Cisco ISE`, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressBool(), + Computed: true, + }, + "trusted_for": &schema.Schema{ + Description: `Different services for which the certificated is trusted`, + Type: schema.TypeString, + Computed: true, + }, + "valid_from": &schema.Schema{ + Description: `The earliest time and date on which the certificate is valid`, + Type: schema.TypeString, + Computed: true, }, }, }, @@ -380,7 +500,8 @@ func resourceTrustedCertificate() *schema.Resource { func resourceTrustedCertificateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustedCertificate create") log.Printf("[DEBUG] Missing TrustedCertificate create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -413,7 +534,8 @@ func resourceTrustedCertificateCreate(ctx context.Context, d *schema.ResourceDat func resourceTrustedCertificateRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustedCertificate read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -459,6 +581,12 @@ func resourceTrustedCertificateRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTrustedCertificates search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -484,6 +612,12 @@ func resourceTrustedCertificateRead(ctx context.Context, d *schema.ResourceData, err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetTrustedCertificateByID response", + err)) + return diags + } return diags } @@ -492,7 +626,8 @@ func resourceTrustedCertificateRead(ctx context.Context, d *schema.ResourceData, func resourceTrustedCertificateUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustedCertificate update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -555,7 +690,8 @@ func resourceTrustedCertificateUpdate(ctx context.Context, d *schema.ResourceDat func resourceTrustedCertificateDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustedCertificate delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -718,7 +854,8 @@ func expandRequestTrustedCertificateUpdateTrustedCertificate(ctx context.Context } func getAllItemsCertificatesGetTrustedCertificates(m interface{}, response *isegosdk.ResponseCertificatesGetTrustedCertificates, queryParams *isegosdk.GetTrustedCertificatesQueryParams) []isegosdk.ResponseCertificatesGetTrustedCertificatesResponse { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var respItems []isegosdk.ResponseCertificatesGetTrustedCertificatesResponse for response.Response != nil && len(*response.Response) > 0 { respItems = append(respItems, *response.Response...) @@ -746,7 +883,8 @@ func getAllItemsCertificatesGetTrustedCertificates(m interface{}, response *iseg } func searchCertificatesGetTrustedCertificates(m interface{}, items []isegosdk.ResponseCertificatesGetTrustedCertificatesResponse, name string, id string) (*isegosdk.ResponseCertificatesGetTrustedCertificateByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *isegosdk.ResponseCertificatesGetTrustedCertificateByIDResponse for _, item := range items { diff --git a/ciscoise/resource_trusted_certificate_import.go b/ciscoise/resource_trusted_certificate_import.go index bdcc0565..a66ab663 100644 --- a/ciscoise/resource_trusted_certificate_import.go +++ b/ciscoise/resource_trusted_certificate_import.go @@ -146,7 +146,8 @@ Request parameters accepting True and False as input can be replaced by 1 and 0 func resourceTrustedCertificateImportCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning ImportTrustCert create") log.Printf("[DEBUG] Missing ImportTrustCert create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustedCertificateImportImportTrustCert(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_nbar_app.go b/ciscoise/resource_trustsec_nbar_app.go index 56bab9be..9888b49d 100644 --- a/ciscoise/resource_trustsec_nbar_app.go +++ b/ciscoise/resource_trustsec_nbar_app.go @@ -85,36 +85,21 @@ func resourceTrustsecNbarApp() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, "id": &schema.Schema{ - Description: `id path parameter.`, - Type: schema.TypeString, - Optional: true, + Description: `id path parameter.`, + Type: schema.TypeString, + Required: true, + DiffSuppressFunc: diffSupressOptional(), }, - "name": &schema.Schema{ + "ports": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, - "network_identities": &schema.Schema{ - Description: `Array of NIs`, - Type: schema.TypeList, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - - "ports": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "protocol": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, - }, + "protocol": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, }, }, }, @@ -125,8 +110,10 @@ func resourceTrustsecNbarApp() *schema.Resource { func resourceTrustsecNbarAppCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecNbarApp create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -139,24 +126,10 @@ func resourceTrustsecNbarAppCreate(ctx context.Context, d *schema.ResourceData, vvID := interfaceToString(vID) vName, okName := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.NbarApp.GetNbarAppByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTrustsecNbarAppRead(ctx, d, m) - } - } - if okName && vvName != "" { - queryParams2 := isegosdk.GetNbarAppsQueryParams{} - - response2, _, err := client.NbarApp.GetNbarApps(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsNbarAppGetNbarApps(m, response2, &queryParams2) - item2, err := searchNbarAppGetNbarApps(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.NbarApp.GetNbarAppByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName @@ -164,6 +137,22 @@ func resourceTrustsecNbarAppCreate(ctx context.Context, d *schema.ResourceData, return resourceTrustsecNbarAppRead(ctx, d, m) } } + if okName && vvName != "" { + queryParams2 := isegosdk.GetNbarAppsQueryParams{} + + response2, _, err := client.NbarApp.GetNbarApps(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsNbarAppGetNbarApps(m, response2, &queryParams2) + item2, err := searchNbarAppGetNbarApps(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTrustsecNbarAppRead(ctx, d, m) + } + } + } } resp1, restyResp1, err := client.NbarApp.CreateNbarApp(request1) if err != nil || resp1 == nil { @@ -185,7 +174,8 @@ func resourceTrustsecNbarAppCreate(ctx context.Context, d *schema.ResourceData, func resourceTrustsecNbarAppRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecNbarApp read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -232,6 +222,12 @@ func resourceTrustsecNbarAppRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNbarApps search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -257,6 +253,12 @@ func resourceTrustsecNbarAppRead(ctx context.Context, d *schema.ResourceData, m err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetNbarAppByID response", + err)) + return diags + } return diags } @@ -265,7 +267,8 @@ func resourceTrustsecNbarAppRead(ctx context.Context, d *schema.ResourceData, m func resourceTrustsecNbarAppUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecNbarApp update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -333,7 +336,8 @@ func resourceTrustsecNbarAppUpdate(ctx context.Context, d *schema.ResourceData, func resourceTrustsecNbarAppDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecNbarApp delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -527,7 +531,8 @@ func getAllItemsNbarAppGetNbarApps(m interface{}, response *isegosdk.ResponseNba } func searchNbarAppGetNbarApps(m interface{}, items []isegosdk.ResponseNbarAppGetNbarAppsResponse, name string, id string) (*[]isegosdk.ResponseNbarAppGetNbarAppByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *[]isegosdk.ResponseNbarAppGetNbarAppByIDResponse for _, item := range items { diff --git a/ciscoise/resource_trustsec_sg_vn_mapping.go b/ciscoise/resource_trustsec_sg_vn_mapping.go index c3bbd823..c06195ca 100644 --- a/ciscoise/resource_trustsec_sg_vn_mapping.go +++ b/ciscoise/resource_trustsec_sg_vn_mapping.go @@ -47,34 +47,46 @@ func resourceTrustsecSgVnMapping() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `Identifier of the SG-VN mapping`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier of the SG-VN mapping`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "last_update": &schema.Schema{ - Description: `Timestamp for the last update of the SG-VN mapping`, - Type: schema.TypeString, - Optional: true, + Description: `Timestamp for the last update of the SG-VN mapping`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sg_name": &schema.Schema{ - Description: `Name of the associated Security Group to be used for identity if id is not provided`, - Type: schema.TypeString, - Optional: true, + Description: `Name of the associated Security Group to be used for identity if id is not provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "sgt_id": &schema.Schema{ - Description: `Identifier of the associated Security Group which is required unless its name is provided`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier of the associated Security Group which is required unless its name is provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vn_id": &schema.Schema{ - Description: `Identifier for the associated Virtual Network which is required unless its name is provided`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the associated Virtual Network which is required unless its name is provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vn_name": &schema.Schema{ - Description: `Name of the associated Virtual Network to be used for identity if id is not provided`, - Type: schema.TypeString, - Optional: true, + Description: `Name of the associated Virtual Network to be used for identity if id is not provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -124,8 +136,10 @@ func resourceTrustsecSgVnMapping() *schema.Resource { func resourceTrustsecSgVnMappingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecSgVnMapping create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -144,26 +158,10 @@ func resourceTrustsecSgVnMappingCreate(ctx context.Context, d *schema.ResourceDa vvVnID := interfaceToString(vVnID) vVnName, _ := resourceItem["vn_name"] vvVnName := interfaceToString(vVnName) - if okID && vvID != "" { - getResponse2, _, err := client.SgVnMapping.GetSgVnMappingByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["sg_name"] = vvSgName - resourceMap["sgt_id"] = vvSgtID - resourceMap["vn_id"] = vvVnID - resourceMap["vn_name"] = vvVnName - d.SetId(joinResourceID(resourceMap)) - return resourceTrustsecSgVnMappingRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetSgVnMappingsQueryParams{} - - response2, _, err := client.SgVnMapping.GetSgVnMappings(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsSgVnMappingGetSgVnMappings(m, response2, &queryParams2) - item2, err := searchSgVnMappingGetSgVnMappings(m, items2, vvSgName, vvSgtID, vvVnID, vvVnName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.SgVnMapping.GetSgVnMappingByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["sg_name"] = vvSgName @@ -173,6 +171,24 @@ func resourceTrustsecSgVnMappingCreate(ctx context.Context, d *schema.ResourceDa d.SetId(joinResourceID(resourceMap)) return resourceTrustsecSgVnMappingRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetSgVnMappingsQueryParams{} + + response2, _, err := client.SgVnMapping.GetSgVnMappings(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsSgVnMappingGetSgVnMappings(m, response2, &queryParams2) + item2, err := searchSgVnMappingGetSgVnMappings(m, items2, vvSgName, vvSgtID, vvVnID, vvVnName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["sg_name"] = vvSgName + resourceMap["sgt_id"] = vvSgtID + resourceMap["vn_id"] = vvVnID + resourceMap["vn_name"] = vvVnName + d.SetId(joinResourceID(resourceMap)) + return resourceTrustsecSgVnMappingRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.SgVnMapping.CreateSgVnMapping(request1) @@ -198,7 +214,8 @@ func resourceTrustsecSgVnMappingCreate(ctx context.Context, d *schema.ResourceDa func resourceTrustsecSgVnMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecSgVnMapping read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -249,6 +266,12 @@ func resourceTrustsecSgVnMappingRead(ctx context.Context, d *schema.ResourceData err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSgVnMappings search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -274,6 +297,12 @@ func resourceTrustsecSgVnMappingRead(ctx context.Context, d *schema.ResourceData err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetSgVnMappingByID response", + err)) + return diags + } return diags } @@ -282,7 +311,8 @@ func resourceTrustsecSgVnMappingRead(ctx context.Context, d *schema.ResourceData func resourceTrustsecSgVnMappingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecSgVnMapping update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -354,7 +384,8 @@ func resourceTrustsecSgVnMappingUpdate(ctx context.Context, d *schema.ResourceDa func resourceTrustsecSgVnMappingDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecSgVnMapping delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -496,7 +527,8 @@ func getAllItemsSgVnMappingGetSgVnMappings(m interface{}, response *isegosdk.Res } func searchSgVnMappingGetSgVnMappings(m interface{}, items []isegosdk.ResponseSgVnMappingGetSgVnMappingsResponse, sgName string, sgtID string, vnID string, vnName string, id string) (*[]isegosdk.ResponseSgVnMappingGetSgVnMappingByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *[]isegosdk.ResponseSgVnMappingGetSgVnMappingByIDResponse for _, item := range items { diff --git a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_create.go b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_create.go index 5e77921f..1ea0724a 100644 --- a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_create.go +++ b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_create.go @@ -107,7 +107,8 @@ func resourceTrustsecSgVnMappingBulkCreate() *schema.Resource { func resourceTrustsecSgVnMappingBulkCreateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkCreateSgVnMappings create") log.Printf("[DEBUG] Missing BulkCreateSgVnMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecSgVnMappingBulkCreateBulkCreateSgVnMappings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_delete.go b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_delete.go index 1892c31f..b7c63f85 100644 --- a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_delete.go +++ b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_delete.go @@ -68,7 +68,8 @@ func resourceTrustsecSgVnMappingBulkDelete() *schema.Resource { func resourceTrustsecSgVnMappingBulkDeleteCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkDeleteSgVnMappings create") log.Printf("[DEBUG] Missing BulkDeleteSgVnMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecSgVnMappingBulkDeleteBulkDeleteSgVnMappings(ctx, "parameters.0", d) @@ -93,6 +94,7 @@ func resourceTrustsecSgVnMappingBulkDeleteCreate(ctx context.Context, d *schema. return diags } _ = d.Set("last_updated", getUnixTimeString()) + log.Printf("[INFO] CREATED") log.Printf("[DEBUG] Retrieved response %+v", responseInterfaceToString(*response1)) d.SetId(getUnixTimeString()) return resourceTrustsecSgVnMappingBulkDeleteRead(ctx, d, m) diff --git a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_update.go b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_update.go index b50ed76b..5964e7da 100644 --- a/ciscoise/resource_trustsec_sg_vn_mapping_bulk_update.go +++ b/ciscoise/resource_trustsec_sg_vn_mapping_bulk_update.go @@ -107,7 +107,8 @@ func resourceTrustsecSgVnMappingBulkUpdate() *schema.Resource { func resourceTrustsecSgVnMappingBulkUpdateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkUpdateSgVnMappings create") log.Printf("[DEBUG] Missing BulkUpdateSgVnMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecSgVnMappingBulkUpdateBulkUpdateSgVnMappings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn.go b/ciscoise/resource_trustsec_vn.go index d2fcb4d9..00168fcf 100644 --- a/ciscoise/resource_trustsec_vn.go +++ b/ciscoise/resource_trustsec_vn.go @@ -50,21 +50,25 @@ func resourceTrustsecVn() *schema.Resource { Description: `JSON String of additional attributes for the Virtual Network`, Type: schema.TypeString, Optional: true, + Computed: true, }, "id": &schema.Schema{ Description: `Identifier of the Virtual Network`, Type: schema.TypeString, Optional: true, + Computed: true, }, "last_update": &schema.Schema{ Description: `Timestamp for the last update of the Virtual Network`, Type: schema.TypeString, Optional: true, + Computed: true, }, "name": &schema.Schema{ Description: `Name of the Virtual Network`, Type: schema.TypeString, Optional: true, + Computed: true, }, }, }, @@ -104,8 +108,10 @@ func resourceTrustsecVn() *schema.Resource { func resourceTrustsecVnCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVn create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -118,29 +124,31 @@ func resourceTrustsecVnCreate(ctx context.Context, d *schema.ResourceData, m int vvID := interfaceToString(vID) vName, _ := resourceItem["name"] vvName := interfaceToString(vName) - if okID && vvID != "" { - getResponse2, _, err := client.VirtualNetwork.GetVirtualNetworkByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - d.SetId(joinResourceID(resourceMap)) - return resourceTrustsecVnRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetVirtualNetworksQueryParams{} - - response2, _, err := client.VirtualNetwork.GetVirtualNetworks(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsVirtualNetworkGetVirtualNetworks(m, response2, &queryParams2) - item2, err := searchVirtualNetworkGetVirtualNetworks(m, items2, vvName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.VirtualNetwork.GetVirtualNetworkByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName d.SetId(joinResourceID(resourceMap)) return resourceTrustsecVnRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetVirtualNetworksQueryParams{} + + response2, _, err := client.VirtualNetwork.GetVirtualNetworks(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsVirtualNetworkGetVirtualNetworks(m, response2, &queryParams2) + item2, err := searchVirtualNetworkGetVirtualNetworks(m, items2, vvName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + d.SetId(joinResourceID(resourceMap)) + return resourceTrustsecVnRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.VirtualNetwork.CreateVirtualNetwork(request1) @@ -163,7 +171,8 @@ func resourceTrustsecVnCreate(ctx context.Context, d *schema.ResourceData, m int func resourceTrustsecVnRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVn read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -208,6 +217,12 @@ func resourceTrustsecVnRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetVirtualNetworks search response", + err)) + return diags + } } if selectedMethod == 1 { @@ -231,6 +246,12 @@ func resourceTrustsecVnRead(ctx context.Context, d *schema.ResourceData, m inter err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetVirtualNetworkByID response", + err)) + return diags + } return diags } @@ -239,7 +260,8 @@ func resourceTrustsecVnRead(ctx context.Context, d *schema.ResourceData, m inter func resourceTrustsecVnUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVn update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -302,7 +324,8 @@ func resourceTrustsecVnUpdate(ctx context.Context, d *schema.ResourceData, m int func resourceTrustsecVnDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVn delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -423,7 +446,8 @@ func getAllItemsVirtualNetworkGetVirtualNetworks(m interface{}, response *isegos } func searchVirtualNetworkGetVirtualNetworks(m interface{}, items []isegosdk.ResponseVirtualNetworkGetVirtualNetworksResponse, name string, id string) (*[]isegosdk.ResponseVirtualNetworkGetVirtualNetworkByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *[]isegosdk.ResponseVirtualNetworkGetVirtualNetworkByIDResponse for _, item := range items { diff --git a/ciscoise/resource_trustsec_vn_bulk_create.go b/ciscoise/resource_trustsec_vn_bulk_create.go index d8cc37df..0b29f79a 100644 --- a/ciscoise/resource_trustsec_vn_bulk_create.go +++ b/ciscoise/resource_trustsec_vn_bulk_create.go @@ -95,7 +95,8 @@ func resourceTrustsecVnBulkCreate() *schema.Resource { func resourceTrustsecVnBulkCreateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkCreateVirtualNetworks create") log.Printf("[DEBUG] Missing BulkCreateVirtualNetworks create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnBulkCreateBulkCreateVirtualNetworks(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn_bulk_delete.go b/ciscoise/resource_trustsec_vn_bulk_delete.go index ee170aea..77c66a6b 100644 --- a/ciscoise/resource_trustsec_vn_bulk_delete.go +++ b/ciscoise/resource_trustsec_vn_bulk_delete.go @@ -68,7 +68,8 @@ func resourceTrustsecVnBulkDelete() *schema.Resource { func resourceTrustsecVnBulkDeleteCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkDeleteVirtualNetworks create") log.Printf("[DEBUG] Missing BulkDeleteVirtualNetworks create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnBulkDeleteBulkDeleteVirtualNetworks(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn_bulk_update.go b/ciscoise/resource_trustsec_vn_bulk_update.go index b3729c66..47759858 100644 --- a/ciscoise/resource_trustsec_vn_bulk_update.go +++ b/ciscoise/resource_trustsec_vn_bulk_update.go @@ -90,7 +90,8 @@ func resourceTrustsecVnBulkUpdate() *schema.Resource { func resourceTrustsecVnBulkUpdateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkUpdateVirtualNetworks create") log.Printf("[DEBUG] Missing BulkUpdateVirtualNetworks create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnBulkUpdateBulkUpdateVirtualNetworks(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn_vlan_mapping.go b/ciscoise/resource_trustsec_vn_vlan_mapping.go index 958c179e..70e90fe8 100644 --- a/ciscoise/resource_trustsec_vn_vlan_mapping.go +++ b/ciscoise/resource_trustsec_vn_vlan_mapping.go @@ -47,48 +47,64 @@ func resourceTrustsecVnVLANMapping() *schema.Resource { Schema: map[string]*schema.Schema{ "id": &schema.Schema{ - Description: `Identifier of the VN-Vlan Mapping`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier of the VN-Vlan Mapping`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_data": &schema.Schema{ Description: `Flag which indicates whether the Vlan is data or voice type`, // Type: schema.TypeBool, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "is_default_vlan": &schema.Schema{ Description: `Flag which indicates if the Vlan is default`, // Type: schema.TypeBool, - Type: schema.TypeString, - ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), - Optional: true, + Type: schema.TypeString, + ValidateFunc: validateStringHasValueFunc([]string{"", "true", "false"}), + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "last_update": &schema.Schema{ - Description: `Timestamp for the last update of the VN-Vlan Mapping`, - Type: schema.TypeString, - Optional: true, + Description: `Timestamp for the last update of the VN-Vlan Mapping`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "max_value": &schema.Schema{ - Description: `Max value`, - Type: schema.TypeInt, - Optional: true, + Description: `Max value`, + Type: schema.TypeInt, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "name": &schema.Schema{ - Description: `Name of the Vlan`, - Type: schema.TypeString, - Optional: true, + Description: `Name of the Vlan`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vn_id": &schema.Schema{ - Description: `Identifier for the associated Virtual Network which is required unless its name is provided`, - Type: schema.TypeString, - Optional: true, + Description: `Identifier for the associated Virtual Network which is required unless its name is provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, "vn_name": &schema.Schema{ - Description: `Name of the associated Virtual Network to be used for identity if id is not provided`, - Type: schema.TypeString, - Optional: true, + Description: `Name of the associated Virtual Network to be used for identity if id is not provided`, + Type: schema.TypeString, + Optional: true, + DiffSuppressFunc: diffSupressOptional(), + Computed: true, }, }, }, @@ -148,8 +164,10 @@ func resourceTrustsecVnVLANMapping() *schema.Resource { func resourceTrustsecVnVLANMappingCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVnVLANMapping create") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client + isEnableAutoImport := clientConfig.EnableAutoImport var diags diag.Diagnostics resourceItem := *getResourceItem(d.Get("parameters")) @@ -166,25 +184,10 @@ func resourceTrustsecVnVLANMappingCreate(ctx context.Context, d *schema.Resource vvVnID := interfaceToString(vVnID) vVnName, _ := resourceItem["vn_name"] vvVnName := interfaceToString(vVnName) - if okID && vvID != "" { - getResponse2, _, err := client.VnVLANMapping.GetVnVLANMappingByID(vvID) - if err == nil && getResponse2 != nil { - resourceMap := make(map[string]string) - resourceMap["id"] = vvID - resourceMap["name"] = vvName - resourceMap["vn_id"] = vvVnID - resourceMap["vn_name"] = vvVnName - d.SetId(joinResourceID(resourceMap)) - return resourceTrustsecVnVLANMappingRead(ctx, d, m) - } - } else { - queryParams2 := isegosdk.GetVnVLANMappingsQueryParams{} - - response2, _, err := client.VnVLANMapping.GetVnVLANMappings(&queryParams2) - if response2 != nil && err == nil { - items2 := getAllItemsVnVLANMappingGetVnVLANMappings(m, response2, &queryParams2) - item2, err := searchVnVLANMappingGetVnVLANMappings(m, items2, vvName, vvVnID, vvVnName, vvID) - if err == nil && item2 != nil { + if isEnableAutoImport { + if okID && vvID != "" { + getResponse2, _, err := client.VnVLANMapping.GetVnVLANMappingByID(vvID) + if err == nil && getResponse2 != nil { resourceMap := make(map[string]string) resourceMap["id"] = vvID resourceMap["name"] = vvName @@ -193,6 +196,23 @@ func resourceTrustsecVnVLANMappingCreate(ctx context.Context, d *schema.Resource d.SetId(joinResourceID(resourceMap)) return resourceTrustsecVnVLANMappingRead(ctx, d, m) } + } else { + queryParams2 := isegosdk.GetVnVLANMappingsQueryParams{} + + response2, _, err := client.VnVLANMapping.GetVnVLANMappings(&queryParams2) + if response2 != nil && err == nil { + items2 := getAllItemsVnVLANMappingGetVnVLANMappings(m, response2, &queryParams2) + item2, err := searchVnVLANMappingGetVnVLANMappings(m, items2, vvName, vvVnID, vvVnName, vvID) + if err == nil && item2 != nil { + resourceMap := make(map[string]string) + resourceMap["id"] = vvID + resourceMap["name"] = vvName + resourceMap["vn_id"] = vvVnID + resourceMap["vn_name"] = vvVnName + d.SetId(joinResourceID(resourceMap)) + return resourceTrustsecVnVLANMappingRead(ctx, d, m) + } + } } } resp1, restyResp1, err := client.VnVLANMapping.CreateVnVLANMapping(request1) @@ -217,7 +237,8 @@ func resourceTrustsecVnVLANMappingCreate(ctx context.Context, d *schema.Resource func resourceTrustsecVnVLANMappingRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVnVLANMapping read for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -264,6 +285,12 @@ func resourceTrustsecVnVLANMappingRead(ctx context.Context, d *schema.ResourceDa err)) return diags } + if err := d.Set("parameters", vItem1); err != nil { + diags = append(diags, diagError( + "Failure when setting GetVnVLANMappings search response", + err)) + return diags + } } if selectedMethod == 2 { @@ -289,6 +316,12 @@ func resourceTrustsecVnVLANMappingRead(ctx context.Context, d *schema.ResourceDa err)) return diags } + if err := d.Set("parameters", vItem2); err != nil { + diags = append(diags, diagError( + "Failure when setting GetVnVLANMappingByID response", + err)) + return diags + } return diags } @@ -297,7 +330,8 @@ func resourceTrustsecVnVLANMappingRead(ctx context.Context, d *schema.ResourceDa func resourceTrustsecVnVLANMappingUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVnVLANMapping update for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -363,7 +397,8 @@ func resourceTrustsecVnVLANMappingUpdate(ctx context.Context, d *schema.Resource func resourceTrustsecVnVLANMappingDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning TrustsecVnVLANMapping delete for id=[%s]", d.Id()) - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics @@ -507,7 +542,8 @@ func getAllItemsVnVLANMappingGetVnVLANMappings(m interface{}, response *isegosdk } func searchVnVLANMappingGetVnVLANMappings(m interface{}, items []isegosdk.ResponseVnVLANMappingGetVnVLANMappingsResponse, name string, vnID string, vnName string, id string) (*[]isegosdk.ResponseVnVLANMappingGetVnVLANMappingByIDResponse, error) { - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var err error var foundItem *[]isegosdk.ResponseVnVLANMappingGetVnVLANMappingByIDResponse for _, item := range items { diff --git a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_create.go b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_create.go index c815f50b..d92483f2 100644 --- a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_create.go +++ b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_create.go @@ -121,7 +121,8 @@ func resourceTrustsecVnVLANMappingBulkCreate() *schema.Resource { func resourceTrustsecVnVLANMappingBulkCreateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkCreateVnVLANMappings create") log.Printf("[DEBUG] Missing BulkCreateVnVLANMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnVLANMappingBulkCreateBulkCreateVnVLANMappings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_delete.go b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_delete.go index 05df838f..500f64a2 100644 --- a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_delete.go +++ b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_delete.go @@ -68,7 +68,8 @@ func resourceTrustsecVnVLANMappingBulkDelete() *schema.Resource { func resourceTrustsecVnVLANMappingBulkDeleteCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkDeleteVnVLANMappings create") log.Printf("[DEBUG] Missing BulkDeleteVnVLANMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnVLANMappingBulkDeleteBulkDeleteVnVLANMappings(ctx, "parameters.0", d) diff --git a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_update.go b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_update.go index f15a2543..d431a484 100644 --- a/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_update.go +++ b/ciscoise/resource_trustsec_vn_vlan_mapping_bulk_update.go @@ -120,7 +120,8 @@ func resourceTrustsecVnVLANMappingBulkUpdate() *schema.Resource { func resourceTrustsecVnVLANMappingBulkUpdateCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { log.Printf("[DEBUG] Beginning BulkUpdateVnVLANMappings create") log.Printf("[DEBUG] Missing BulkUpdateVnVLANMappings create on Cisco ISE. It will only be create it on Terraform") - client := m.(*isegosdk.Client) + clientConfig := m.(ClientConfig) + client := clientConfig.Client var diags diag.Diagnostics request1 := expandRequestTrustsecVnVLANMappingBulkUpdateBulkUpdateVnVLANMappings(ctx, "parameters.0", d) diff --git a/ciscoise/utils.go b/ciscoise/utils.go index 0f477cea..fbb6c6af 100644 --- a/ciscoise/utils.go +++ b/ciscoise/utils.go @@ -48,6 +48,21 @@ func compareMacAddress(old_mac_address, new_mac_address string) bool { return strings.ToLower(oldClear) == strings.ToLower(newClear) } +func compareBoolean(new string, old string) bool { + oldBool, err := strconv.ParseBool(old) + newBool, err := strconv.ParseBool(new) + if err != nil { + return true + } + if oldBool == newBool { + return true + } + return false +} + +func compareOptional(new_value string, old_value string) bool { + return new_value == "" || new_value == old_value +} func fixKeyAccess(key string) string { return strings.Trim(key, ".") } diff --git a/docs/index.md b/docs/index.md index e6715625..aa0c4c8d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -48,6 +48,10 @@ provider "ciscoise" { # Timeout (in seconds) for the RESTful HTTP requests single_request_timeout = 60 # it can be set using the environment variable ISE_SINGLE_REQUEST_TIMEOUT + + # Boolean to enable or disable autoimport on resources + enable_auto_import = "false" + # it can be set using the environment variable ISE_ENABLE_AUTO_IMPORT } ``` @@ -64,3 +68,4 @@ provider "ciscoise" { - **use_api_gateway** (String) Flag to enable or disable the usage of the ISE's API Gateway. If not set, it uses the ISE_USE_API_GATEWAY environment variable; defaults to `false`. - **use_csrf_token** (String) Flag to enable or disable the usage of the X-CSRF-Token header. If not set, it uses the ISE_USE_CSRF_TOKEN environment varible; defaults to `false`. - **username** (String, Sensitive) Identity Services Engine username to authenticate. If not set, it uses the ISE_USERNAME environment variable. +- **enable_auto_import** (String) Flag to enable or disable terraform automatic import (Automatic import means that when Terraform attempts to create the resource, it will perform a get operation if it founds a matching resource, it will perform an import of the resource it found, this is a similar operation to the terraform import command.) in resources, this is a configuration added to the provider, it uses the ISE_ENABLE_AUTO_IMPORT environment varible; `true` to enable it, defaults to `false`. \ No newline at end of file diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 42f74870..a23f659e 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -31,4 +31,8 @@ provider "ciscoise" { # Timeout (in seconds) for the RESTful HTTP requests single_request_timeout = 60 # it can be set using the environment variable ISE_SINGLE_REQUEST_TIMEOUT + + # Boolean to enable or disable autoimport on resources + enable_auto_import = "false" + # it can be set using the environment variable ISE_ENABLE_AUTO_IMPORT } \ No newline at end of file diff --git a/examples/samples/data-sources/ciscoise_aci_bindings/main.tf b/examples/samples/data-sources/ciscoise_aci_bindings/main.tf index e922934d..e80ec632 100644 --- a/examples/samples/data-sources/ciscoise_aci_bindings/main.tf +++ b/examples/samples/data-sources/ciscoise_aci_bindings/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_aci_test_connectivity/main.tf b/examples/samples/data-sources/ciscoise_aci_test_connectivity/main.tf index c2494975..22258dfe 100644 --- a/examples/samples/data-sources/ciscoise_aci_test_connectivity/main.tf +++ b/examples/samples/data-sources/ciscoise_aci_test_connectivity/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_admin_user/main.tf b/examples/samples/data-sources/ciscoise_admin_user/main.tf index ff7e0867..cb940f9b 100644 --- a/examples/samples/data-sources/ciscoise_admin_user/main.tf +++ b/examples/samples/data-sources/ciscoise_admin_user/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_allowed_protocols/main.tf b/examples/samples/data-sources/ciscoise_allowed_protocols/main.tf index ede96edd..beb7f0a7 100644 --- a/examples/samples/data-sources/ciscoise_allowed_protocols/main.tf +++ b/examples/samples/data-sources/ciscoise_allowed_protocols/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_anc_policy/main.tf b/examples/samples/data-sources/ciscoise_anc_policy/main.tf index c49b1ab1..44b0126b 100644 --- a/examples/samples/data-sources/ciscoise_anc_policy/main.tf +++ b/examples/samples/data-sources/ciscoise_anc_policy/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_authorization_profile/main.tf b/examples/samples/data-sources/ciscoise_authorization_profile/main.tf index e8a1e8e2..f43ac2a2 100644 --- a/examples/samples/data-sources/ciscoise_authorization_profile/main.tf +++ b/examples/samples/data-sources/ciscoise_authorization_profile/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_certificate_template/main.tf b/examples/samples/data-sources/ciscoise_certificate_template/main.tf index 7b9c92bb..9f915d1c 100644 --- a/examples/samples/data-sources/ciscoise_certificate_template/main.tf +++ b/examples/samples/data-sources/ciscoise_certificate_template/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_csr/main.tf b/examples/samples/data-sources/ciscoise_csr/main.tf index efecaa67..1f09c407 100644 --- a/examples/samples/data-sources/ciscoise_csr/main.tf +++ b/examples/samples/data-sources/ciscoise_csr/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_csr_export/main.tf b/examples/samples/data-sources/ciscoise_csr_export/main.tf index 37da0d99..f2e357ed 100644 --- a/examples/samples/data-sources/ciscoise_csr_export/main.tf +++ b/examples/samples/data-sources/ciscoise_csr_export/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_deployment/main.tf b/examples/samples/data-sources/ciscoise_deployment/main.tf index b8ed717d..fc33fdd3 100644 --- a/examples/samples/data-sources/ciscoise_deployment/main.tf +++ b/examples/samples/data-sources/ciscoise_deployment/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_command_set/main.tf b/examples/samples/data-sources/ciscoise_device_administration_command_set/main.tf index 6236f8ab..1d2662b5 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_command_set/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_command_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authentication_rule/main.tf b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authentication_rule/main.tf index 07cdbfdc..0cbaed39 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authentication_rule/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authentication_rule/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authorization_rule/main.tf b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authorization_rule/main.tf index b35326a9..70f885f6 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authorization_rule/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_authorization_rule/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_policy_set/main.tf b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_policy_set/main.tf index b8569277..728925b1 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_conditions_for_policy_set/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_conditions_for_policy_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authentication/main.tf b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authentication/main.tf index bfd4ae3c..48d495a7 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authentication/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authentication/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authorization/main.tf b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authorization/main.tf index b4903b61..cd631c60 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authorization/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_authorization/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_policy_set/main.tf b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_policy_set/main.tf index 05c622df..3fbb5cb3 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_policy_set/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_dictionary_attributes_policy_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_global_exception_rules/main.tf b/examples/samples/data-sources/ciscoise_device_administration_global_exception_rules/main.tf index c1a82c50..a2fa2fba 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_global_exception_rules/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_global_exception_rules/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_identity_stores/main.tf b/examples/samples/data-sources/ciscoise_device_administration_identity_stores/main.tf index df5c93fb..692146bd 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_identity_stores/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_identity_stores/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_profiles/main.tf b/examples/samples/data-sources/ciscoise_device_administration_profiles/main.tf index a81f6a95..445772f3 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_profiles/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_profiles/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_device_administration_service_names/main.tf b/examples/samples/data-sources/ciscoise_device_administration_service_names/main.tf index f02eda6d..ef7c2f19 100644 --- a/examples/samples/data-sources/ciscoise_device_administration_service_names/main.tf +++ b/examples/samples/data-sources/ciscoise_device_administration_service_names/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_endpoint_get_rejected_endpoints/main.tf b/examples/samples/data-sources/ciscoise_endpoint_get_rejected_endpoints/main.tf index 27442509..c60795d7 100644 --- a/examples/samples/data-sources/ciscoise_endpoint_get_rejected_endpoints/main.tf +++ b/examples/samples/data-sources/ciscoise_endpoint_get_rejected_endpoints/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_guest_location/main.tf b/examples/samples/data-sources/ciscoise_guest_location/main.tf index 2487383f..3df1beae 100644 --- a/examples/samples/data-sources/ciscoise_guest_location/main.tf +++ b/examples/samples/data-sources/ciscoise_guest_location/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_guest_type/main.tf b/examples/samples/data-sources/ciscoise_guest_type/main.tf index 895739cb..5501a415 100644 --- a/examples/samples/data-sources/ciscoise_guest_type/main.tf +++ b/examples/samples/data-sources/ciscoise_guest_type/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_hotspot_portal/main.tf b/examples/samples/data-sources/ciscoise_hotspot_portal/main.tf index 4bdec7ea..643b9762 100644 --- a/examples/samples/data-sources/ciscoise_hotspot_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_hotspot_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_id_store_sequence/main.tf b/examples/samples/data-sources/ciscoise_id_store_sequence/main.tf index 41049571..fa0499ea 100644 --- a/examples/samples/data-sources/ciscoise_id_store_sequence/main.tf +++ b/examples/samples/data-sources/ciscoise_id_store_sequence/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_identity_group/main.tf b/examples/samples/data-sources/ciscoise_identity_group/main.tf index 96d9489b..305adf59 100644 --- a/examples/samples/data-sources/ciscoise_identity_group/main.tf +++ b/examples/samples/data-sources/ciscoise_identity_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt/main.tf b/examples/samples/data-sources/ciscoise_mnt/main.tf index 8252f5d6..4e7107a2 100644 --- a/examples/samples/data-sources/ciscoise_mnt/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_account_status/main.tf b/examples/samples/data-sources/ciscoise_mnt_account_status/main.tf index e0aa05fa..6569a3a5 100644 --- a/examples/samples/data-sources/ciscoise_mnt_account_status/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_account_status/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_athentication_status/main.tf b/examples/samples/data-sources/ciscoise_mnt_athentication_status/main.tf index 9c238648..605ac6db 100644 --- a/examples/samples/data-sources/ciscoise_mnt_athentication_status/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_athentication_status/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_session_active_count/main.tf b/examples/samples/data-sources/ciscoise_mnt_session_active_count/main.tf index bab5bf55..d4668158 100644 --- a/examples/samples/data-sources/ciscoise_mnt_session_active_count/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_session_active_count/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_session_active_list/main.tf b/examples/samples/data-sources/ciscoise_mnt_session_active_list/main.tf index ff7c2ad8..58959c8d 100644 --- a/examples/samples/data-sources/ciscoise_mnt_session_active_list/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_session_active_list/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_session_auth_list/main.tf b/examples/samples/data-sources/ciscoise_mnt_session_auth_list/main.tf index 6c891e65..a1a2fad7 100644 --- a/examples/samples/data-sources/ciscoise_mnt_session_auth_list/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_session_auth_list/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_session_posture_count/main.tf b/examples/samples/data-sources/ciscoise_mnt_session_posture_count/main.tf index e269b79b..96c69aa8 100644 --- a/examples/samples/data-sources/ciscoise_mnt_session_posture_count/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_session_posture_count/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_session_profiler_count/main.tf b/examples/samples/data-sources/ciscoise_mnt_session_profiler_count/main.tf index 7914ea5d..b456bdca 100644 --- a/examples/samples/data-sources/ciscoise_mnt_session_profiler_count/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_session_profiler_count/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_sessions_by_session_id/main.tf b/examples/samples/data-sources/ciscoise_mnt_sessions_by_session_id/main.tf index f2ae20ca..b92b359a 100644 --- a/examples/samples/data-sources/ciscoise_mnt_sessions_by_session_id/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_sessions_by_session_id/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_mnt_version/main.tf b/examples/samples/data-sources/ciscoise_mnt_version/main.tf index 48038e61..400b0a55 100644 --- a/examples/samples/data-sources/ciscoise_mnt_version/main.tf +++ b/examples/samples/data-sources/ciscoise_mnt_version/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_my_device_portal/main.tf b/examples/samples/data-sources/ciscoise_my_device_portal/main.tf index a2bb0b3f..e9371384 100644 --- a/examples/samples/data-sources/ciscoise_my_device_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_my_device_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_authentication_rules/main.tf b/examples/samples/data-sources/ciscoise_network_access_authentication_rules/main.tf index 32796964..5aebb111 100644 --- a/examples/samples/data-sources/ciscoise_network_access_authentication_rules/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_authentication_rules/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_authorization_rules/main.tf b/examples/samples/data-sources/ciscoise_network_access_authorization_rules/main.tf index f76143d6..54e0452e 100644 --- a/examples/samples/data-sources/ciscoise_network_access_authorization_rules/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_authorization_rules/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_conditions/main.tf b/examples/samples/data-sources/ciscoise_network_access_conditions/main.tf index 4377ea3a..a460752d 100644 --- a/examples/samples/data-sources/ciscoise_network_access_conditions/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_conditions/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_conditions_for_authentication_rule/main.tf b/examples/samples/data-sources/ciscoise_network_access_conditions_for_authentication_rule/main.tf index 4220ffd3..c59d1fd6 100644 --- a/examples/samples/data-sources/ciscoise_network_access_conditions_for_authentication_rule/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_conditions_for_authentication_rule/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_conditions_for_authorization_rule/main.tf b/examples/samples/data-sources/ciscoise_network_access_conditions_for_authorization_rule/main.tf index 5c2d74c9..e8794afc 100644 --- a/examples/samples/data-sources/ciscoise_network_access_conditions_for_authorization_rule/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_conditions_for_authorization_rule/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_conditions_for_policy_set/main.tf b/examples/samples/data-sources/ciscoise_network_access_conditions_for_policy_set/main.tf index 47aa168c..ed9f6b85 100644 --- a/examples/samples/data-sources/ciscoise_network_access_conditions_for_policy_set/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_conditions_for_policy_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_dictionary/main.tf b/examples/samples/data-sources/ciscoise_network_access_dictionary/main.tf index 003ad999..2e9cff94 100644 --- a/examples/samples/data-sources/ciscoise_network_access_dictionary/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_dictionary/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_dictionary_attribute/main.tf b/examples/samples/data-sources/ciscoise_network_access_dictionary_attribute/main.tf index 4461fc09..395bd4f2 100644 --- a/examples/samples/data-sources/ciscoise_network_access_dictionary_attribute/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_dictionary_attribute/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authentication/main.tf b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authentication/main.tf index 04f7402c..7be8adf6 100644 --- a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authentication/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authentication/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authorization/main.tf b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authorization/main.tf index 252eb597..e36c2a56 100644 --- a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authorization/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_authorization/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_policy_set/main.tf b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_policy_set/main.tf index bd33e1a2..c22d043e 100644 --- a/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_policy_set/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_dictionary_attributes_policy_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_identity_stores/main.tf b/examples/samples/data-sources/ciscoise_network_access_identity_stores/main.tf index 42b866eb..3db62443 100644 --- a/examples/samples/data-sources/ciscoise_network_access_identity_stores/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_identity_stores/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_network_condition/main.tf b/examples/samples/data-sources/ciscoise_network_access_network_condition/main.tf index b465acaa..eafc8a7d 100644 --- a/examples/samples/data-sources/ciscoise_network_access_network_condition/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_network_condition/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_profiles/main.tf b/examples/samples/data-sources/ciscoise_network_access_profiles/main.tf index dd39c94c..f236936e 100644 --- a/examples/samples/data-sources/ciscoise_network_access_profiles/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_profiles/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_security_groups/main.tf b/examples/samples/data-sources/ciscoise_network_access_security_groups/main.tf index 8d2dff4a..ec1e8102 100644 --- a/examples/samples/data-sources/ciscoise_network_access_security_groups/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_security_groups/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_service_name/main.tf b/examples/samples/data-sources/ciscoise_network_access_service_name/main.tf index eca688ec..d2c84bbe 100644 --- a/examples/samples/data-sources/ciscoise_network_access_service_name/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_service_name/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_access_time_date_conditions/main.tf b/examples/samples/data-sources/ciscoise_network_access_time_date_conditions/main.tf index ef5ded7d..f6b6fda9 100644 --- a/examples/samples/data-sources/ciscoise_network_access_time_date_conditions/main.tf +++ b/examples/samples/data-sources/ciscoise_network_access_time_date_conditions/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_device/main.tf b/examples/samples/data-sources/ciscoise_network_device/main.tf index 587ded62..b59b960f 100644 --- a/examples/samples/data-sources/ciscoise_network_device/main.tf +++ b/examples/samples/data-sources/ciscoise_network_device/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_network_device_group/main.tf b/examples/samples/data-sources/ciscoise_network_device_group/main.tf index 93921e14..2c89d783 100644 --- a/examples/samples/data-sources/ciscoise_network_device_group/main.tf +++ b/examples/samples/data-sources/ciscoise_network_device_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_node/main.tf b/examples/samples/data-sources/ciscoise_node/main.tf index c83f2a7d..959dc994 100644 --- a/examples/samples/data-sources/ciscoise_node/main.tf +++ b/examples/samples/data-sources/ciscoise_node/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_portal/main.tf b/examples/samples/data-sources/ciscoise_portal/main.tf index ff1e0065..11cf19e3 100644 --- a/examples/samples/data-sources/ciscoise_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_portal_theme/main.tf b/examples/samples/data-sources/ciscoise_portal_theme/main.tf index 997ebbbc..4b3a5bfd 100644 --- a/examples/samples/data-sources/ciscoise_portal_theme/main.tf +++ b/examples/samples/data-sources/ciscoise_portal_theme/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_profiler_profile/main.tf b/examples/samples/data-sources/ciscoise_profiler_profile/main.tf index 42661c18..1e1006be 100644 --- a/examples/samples/data-sources/ciscoise_profiler_profile/main.tf +++ b/examples/samples/data-sources/ciscoise_profiler_profile/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_radius_server_sequence/main.tf b/examples/samples/data-sources/ciscoise_radius_server_sequence/main.tf index 00a88d02..d12844ad 100644 --- a/examples/samples/data-sources/ciscoise_radius_server_sequence/main.tf +++ b/examples/samples/data-sources/ciscoise_radius_server_sequence/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_self_registered_portal/main.tf b/examples/samples/data-sources/ciscoise_self_registered_portal/main.tf index d02f0172..1826db39 100644 --- a/examples/samples/data-sources/ciscoise_self_registered_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_self_registered_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sg_acl/main.tf b/examples/samples/data-sources/ciscoise_sg_acl/main.tf index 45476726..72a8fabc 100644 --- a/examples/samples/data-sources/ciscoise_sg_acl/main.tf +++ b/examples/samples/data-sources/ciscoise_sg_acl/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sgt/main.tf b/examples/samples/data-sources/ciscoise_sgt/main.tf index a5971cb2..88bed6d1 100644 --- a/examples/samples/data-sources/ciscoise_sgt/main.tf +++ b/examples/samples/data-sources/ciscoise_sgt/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sms_provider/main.tf b/examples/samples/data-sources/ciscoise_sms_provider/main.tf index 9462b0e5..b0786dd7 100644 --- a/examples/samples/data-sources/ciscoise_sms_provider/main.tf +++ b/examples/samples/data-sources/ciscoise_sms_provider/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sponsor_group/main.tf b/examples/samples/data-sources/ciscoise_sponsor_group/main.tf index 83a72fc9..ffa2305e 100644 --- a/examples/samples/data-sources/ciscoise_sponsor_group/main.tf +++ b/examples/samples/data-sources/ciscoise_sponsor_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sponsor_group_member/main.tf b/examples/samples/data-sources/ciscoise_sponsor_group_member/main.tf index e38fe486..408d91b9 100644 --- a/examples/samples/data-sources/ciscoise_sponsor_group_member/main.tf +++ b/examples/samples/data-sources/ciscoise_sponsor_group_member/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sponsor_portal/main.tf b/examples/samples/data-sources/ciscoise_sponsor_portal/main.tf index abb7c19c..fc11aab8 100644 --- a/examples/samples/data-sources/ciscoise_sponsor_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_sponsor_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sponsored_guest_portal/main.tf b/examples/samples/data-sources/ciscoise_sponsored_guest_portal/main.tf index a69f277c..828dc0d4 100644 --- a/examples/samples/data-sources/ciscoise_sponsored_guest_portal/main.tf +++ b/examples/samples/data-sources/ciscoise_sponsored_guest_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sxp_connections/main.tf b/examples/samples/data-sources/ciscoise_sxp_connections/main.tf index 274c2736..4131338a 100644 --- a/examples/samples/data-sources/ciscoise_sxp_connections/main.tf +++ b/examples/samples/data-sources/ciscoise_sxp_connections/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sxp_local_bindings/main.tf b/examples/samples/data-sources/ciscoise_sxp_local_bindings/main.tf index ea512e36..e05a31b7 100644 --- a/examples/samples/data-sources/ciscoise_sxp_local_bindings/main.tf +++ b/examples/samples/data-sources/ciscoise_sxp_local_bindings/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_sxp_vpns/main.tf b/examples/samples/data-sources/ciscoise_sxp_vpns/main.tf index 3d8dd835..01b8363a 100644 --- a/examples/samples/data-sources/ciscoise_sxp_vpns/main.tf +++ b/examples/samples/data-sources/ciscoise_sxp_vpns/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_system_config_version/main.tf b/examples/samples/data-sources/ciscoise_system_config_version/main.tf index 1090a1f4..0c5db14a 100644 --- a/examples/samples/data-sources/ciscoise_system_config_version/main.tf +++ b/examples/samples/data-sources/ciscoise_system_config_version/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_tacacs_command_sets/main.tf b/examples/samples/data-sources/ciscoise_tacacs_command_sets/main.tf index 4c1e7288..b5267823 100644 --- a/examples/samples/data-sources/ciscoise_tacacs_command_sets/main.tf +++ b/examples/samples/data-sources/ciscoise_tacacs_command_sets/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_tacacs_profile/main.tf b/examples/samples/data-sources/ciscoise_tacacs_profile/main.tf index de12a6bc..4979bda2 100644 --- a/examples/samples/data-sources/ciscoise_tacacs_profile/main.tf +++ b/examples/samples/data-sources/ciscoise_tacacs_profile/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_tasks/main.tf b/examples/samples/data-sources/ciscoise_tasks/main.tf index aca61f3b..1c9032b7 100644 --- a/examples/samples/data-sources/ciscoise_tasks/main.tf +++ b/examples/samples/data-sources/ciscoise_tasks/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/data-sources/ciscoise_telemetry_info/main.tf b/examples/samples/data-sources/ciscoise_telemetry_info/main.tf index c97fe880..14f51729 100644 --- a/examples/samples/data-sources/ciscoise_telemetry_info/main.tf +++ b/examples/samples/data-sources/ciscoise_telemetry_info/main.tf @@ -2,7 +2,7 @@ terraform { # Section defining the providers to be searched and installed (if needed) required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" # This `source` is the local built version of the provider. # It will change once the provider is publish to registry.terraform.io (to "CiscoISE/ciscoise") source = "hashicorp.com/edu/ciscoise" diff --git a/examples/samples/data-sources/ciscoise_trusted_certificate_export/main.tf b/examples/samples/data-sources/ciscoise_trusted_certificate_export/main.tf index ef5bf1a7..6fa331ff 100644 --- a/examples/samples/data-sources/ciscoise_trusted_certificate_export/main.tf +++ b/examples/samples/data-sources/ciscoise_trusted_certificate_export/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_aci_settings/main.tf b/examples/samples/mixed/ciscoise_aci_settings/main.tf index 79df3ed4..0c02e5d2 100644 --- a/examples/samples/mixed/ciscoise_aci_settings/main.tf +++ b/examples/samples/mixed/ciscoise_aci_settings/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_active_directory/main.tf b/examples/samples/mixed/ciscoise_active_directory/main.tf index 79e1326f..19d0fc92 100644 --- a/examples/samples/mixed/ciscoise_active_directory/main.tf +++ b/examples/samples/mixed/ciscoise_active_directory/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_downloadable_acl/main.tf b/examples/samples/mixed/ciscoise_downloadable_acl/main.tf index f30bba07..1121378a 100644 --- a/examples/samples/mixed/ciscoise_downloadable_acl/main.tf +++ b/examples/samples/mixed/ciscoise_downloadable_acl/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_endpoint/main.tf b/examples/samples/mixed/ciscoise_endpoint/main.tf index 5dc79538..997f4e3c 100644 --- a/examples/samples/mixed/ciscoise_endpoint/main.tf +++ b/examples/samples/mixed/ciscoise_endpoint/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_guest_ssid/main.tf b/examples/samples/mixed/ciscoise_guest_ssid/main.tf index 5e394fac..90d73c4d 100644 --- a/examples/samples/mixed/ciscoise_guest_ssid/main.tf +++ b/examples/samples/mixed/ciscoise_guest_ssid/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_internal_user/main.tf b/examples/samples/mixed/ciscoise_internal_user/main.tf index 02a16972..b502b46f 100644 --- a/examples/samples/mixed/ciscoise_internal_user/main.tf +++ b/examples/samples/mixed/ciscoise_internal_user/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_mnt_failure_reasons/main.tf b/examples/samples/mixed/ciscoise_mnt_failure_reasons/main.tf index 8f9b9d20..e944f83b 100644 --- a/examples/samples/mixed/ciscoise_mnt_failure_reasons/main.tf +++ b/examples/samples/mixed/ciscoise_mnt_failure_reasons/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_native_supplicant_profile/main.tf b/examples/samples/mixed/ciscoise_native_supplicant_profile/main.tf index f4b5be16..e4ef09e8 100644 --- a/examples/samples/mixed/ciscoise_native_supplicant_profile/main.tf +++ b/examples/samples/mixed/ciscoise_native_supplicant_profile/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_repository/main.tf b/examples/samples/mixed/ciscoise_repository/main.tf index ef35579f..11ccf857 100644 --- a/examples/samples/mixed/ciscoise_repository/main.tf +++ b/examples/samples/mixed/ciscoise_repository/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_sg_mapping/main.tf b/examples/samples/mixed/ciscoise_sg_mapping/main.tf index 23f55226..af1c4c23 100644 --- a/examples/samples/mixed/ciscoise_sg_mapping/main.tf +++ b/examples/samples/mixed/ciscoise_sg_mapping/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_sg_mapping_group/main.tf b/examples/samples/mixed/ciscoise_sg_mapping_group/main.tf index 872e35bf..1bc4a598 100644 --- a/examples/samples/mixed/ciscoise_sg_mapping_group/main.tf +++ b/examples/samples/mixed/ciscoise_sg_mapping_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_tacacs_external_servers/main.tf b/examples/samples/mixed/ciscoise_tacacs_external_servers/main.tf index d3a48b7c..60f67897 100644 --- a/examples/samples/mixed/ciscoise_tacacs_external_servers/main.tf +++ b/examples/samples/mixed/ciscoise_tacacs_external_servers/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_tacacs_server_sequence/main.tf b/examples/samples/mixed/ciscoise_tacacs_server_sequence/main.tf index 62ce1c49..7fd6537d 100644 --- a/examples/samples/mixed/ciscoise_tacacs_server_sequence/main.tf +++ b/examples/samples/mixed/ciscoise_tacacs_server_sequence/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/mixed/ciscoise_trusted_certificate/main.tf b/examples/samples/mixed/ciscoise_trusted_certificate/main.tf index 3dda576b..65721a5d 100644 --- a/examples/samples/mixed/ciscoise_trusted_certificate/main.tf +++ b/examples/samples/mixed/ciscoise_trusted_certificate/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_active_directory_join_domain/resource.tf b/examples/samples/resources/ciscoise_active_directory_join_domain/resource.tf index 2611d7c3..aeaa4ffc 100644 --- a/examples/samples/resources/ciscoise_active_directory_join_domain/resource.tf +++ b/examples/samples/resources/ciscoise_active_directory_join_domain/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_active_directory_join_domain_with_all_nodes/resource.tf b/examples/samples/resources/ciscoise_active_directory_join_domain_with_all_nodes/resource.tf index 85197b9f..7807e31d 100644 --- a/examples/samples/resources/ciscoise_active_directory_join_domain_with_all_nodes/resource.tf +++ b/examples/samples/resources/ciscoise_active_directory_join_domain_with_all_nodes/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_active_directory_leave_domain/resource.tf b/examples/samples/resources/ciscoise_active_directory_leave_domain/resource.tf index 4bbd5863..68539b85 100644 --- a/examples/samples/resources/ciscoise_active_directory_leave_domain/resource.tf +++ b/examples/samples/resources/ciscoise_active_directory_leave_domain/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_active_directory_leave_domain_with_all_nodes/resource.tf b/examples/samples/resources/ciscoise_active_directory_leave_domain_with_all_nodes/resource.tf index 2f285386..0967780c 100644 --- a/examples/samples/resources/ciscoise_active_directory_leave_domain_with_all_nodes/resource.tf +++ b/examples/samples/resources/ciscoise_active_directory_leave_domain_with_all_nodes/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_allowed_protocols/main.tf b/examples/samples/resources/ciscoise_allowed_protocols/main.tf index 4841adcd..5c87102b 100644 --- a/examples/samples/resources/ciscoise_allowed_protocols/main.tf +++ b/examples/samples/resources/ciscoise_allowed_protocols/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_anc_endpoint/main.tf b/examples/samples/resources/ciscoise_anc_endpoint/main.tf index e8ba597c..df7ea020 100644 --- a/examples/samples/resources/ciscoise_anc_endpoint/main.tf +++ b/examples/samples/resources/ciscoise_anc_endpoint/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_anc_endpoint_bulk_request/resource.tf b/examples/samples/resources/ciscoise_anc_endpoint_bulk_request/resource.tf index 21b8816c..99841a6e 100644 --- a/examples/samples/resources/ciscoise_anc_endpoint_bulk_request/resource.tf +++ b/examples/samples/resources/ciscoise_anc_endpoint_bulk_request/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_anc_policy_bulk_request/resource.tf b/examples/samples/resources/ciscoise_anc_policy_bulk_request/resource.tf index 2afc8d58..a1fcb582 100644 --- a/examples/samples/resources/ciscoise_anc_policy_bulk_request/resource.tf +++ b/examples/samples/resources/ciscoise_anc_policy_bulk_request/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_authorization_profile/main.tf b/examples/samples/resources/ciscoise_authorization_profile/main.tf index b5317f27..0372f9ca 100644 --- a/examples/samples/resources/ciscoise_authorization_profile/main.tf +++ b/examples/samples/resources/ciscoise_authorization_profile/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_backup_restore/main.tf b/examples/samples/resources/ciscoise_backup_restore/main.tf index a7ce48a2..b06b5094 100644 --- a/examples/samples/resources/ciscoise_backup_restore/main.tf +++ b/examples/samples/resources/ciscoise_backup_restore/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_backup_schedule_config/resource.tf b/examples/samples/resources/ciscoise_backup_schedule_config/resource.tf index 0bcfb1be..5ead85c9 100644 --- a/examples/samples/resources/ciscoise_backup_schedule_config/resource.tf +++ b/examples/samples/resources/ciscoise_backup_schedule_config/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_backup_schedule_config_update/resource.tf b/examples/samples/resources/ciscoise_backup_schedule_config_update/resource.tf index b742a0f8..5817a71f 100644 --- a/examples/samples/resources/ciscoise_backup_schedule_config_update/resource.tf +++ b/examples/samples/resources/ciscoise_backup_schedule_config_update/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_bind_signed_certificate/resource.tf b/examples/samples/resources/ciscoise_bind_signed_certificate/resource.tf index c0b901fa..428e9e98 100644 --- a/examples/samples/resources/ciscoise_bind_signed_certificate/resource.tf +++ b/examples/samples/resources/ciscoise_bind_signed_certificate/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_authentication_reset_hitcount/resource.tf b/examples/samples/resources/ciscoise_device_administration_authentication_reset_hitcount/resource.tf index b9f4cb7b..c726d8da 100644 --- a/examples/samples/resources/ciscoise_device_administration_authentication_reset_hitcount/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_authentication_reset_hitcount/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_authentication_rules/main.tf b/examples/samples/resources/ciscoise_device_administration_authentication_rules/main.tf index cec9c7a1..6cc792ca 100644 --- a/examples/samples/resources/ciscoise_device_administration_authentication_rules/main.tf +++ b/examples/samples/resources/ciscoise_device_administration_authentication_rules/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_authorization_reset_hitcount/resource.tf b/examples/samples/resources/ciscoise_device_administration_authorization_reset_hitcount/resource.tf index d7fdefdf..cc1d2bec 100644 --- a/examples/samples/resources/ciscoise_device_administration_authorization_reset_hitcount/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_authorization_reset_hitcount/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_global_exception_rules/main.tf b/examples/samples/resources/ciscoise_device_administration_global_exception_rules/main.tf index 47466658..e749eb22 100644 --- a/examples/samples/resources/ciscoise_device_administration_global_exception_rules/main.tf +++ b/examples/samples/resources/ciscoise_device_administration_global_exception_rules/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_global_exception_rules_reset_hitcount/resource.tf b/examples/samples/resources/ciscoise_device_administration_global_exception_rules_reset_hitcount/resource.tf index 05ae8556..139563df 100644 --- a/examples/samples/resources/ciscoise_device_administration_global_exception_rules_reset_hitcount/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_global_exception_rules_reset_hitcount/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_local_exception_rules_reset_hitcount/resource.tf b/examples/samples/resources/ciscoise_device_administration_local_exception_rules_reset_hitcount/resource.tf index 7a19c0a1..a67ef23b 100644 --- a/examples/samples/resources/ciscoise_device_administration_local_exception_rules_reset_hitcount/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_local_exception_rules_reset_hitcount/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_network_conditions/main.tf b/examples/samples/resources/ciscoise_device_administration_network_conditions/main.tf index 7f491162..6c4b6c8a 100644 --- a/examples/samples/resources/ciscoise_device_administration_network_conditions/main.tf +++ b/examples/samples/resources/ciscoise_device_administration_network_conditions/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_policy_set/resource.tf b/examples/samples/resources/ciscoise_device_administration_policy_set/resource.tf index c8e5af48..cc352de0 100644 --- a/examples/samples/resources/ciscoise_device_administration_policy_set/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_policy_set/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_policy_set_reset_hitcount/resource.tf b/examples/samples/resources/ciscoise_device_administration_policy_set_reset_hitcount/resource.tf index 0d2de6e7..2d1ba81f 100644 --- a/examples/samples/resources/ciscoise_device_administration_policy_set_reset_hitcount/resource.tf +++ b/examples/samples/resources/ciscoise_device_administration_policy_set_reset_hitcount/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_device_administration_time_date_conditions/main.tf b/examples/samples/resources/ciscoise_device_administration_time_date_conditions/main.tf index 57356a45..84894038 100644 --- a/examples/samples/resources/ciscoise_device_administration_time_date_conditions/main.tf +++ b/examples/samples/resources/ciscoise_device_administration_time_date_conditions/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_egress_matrix_cell/main.tf b/examples/samples/resources/ciscoise_egress_matrix_cell/main.tf index c0dc2bd9..d15657f6 100644 --- a/examples/samples/resources/ciscoise_egress_matrix_cell/main.tf +++ b/examples/samples/resources/ciscoise_egress_matrix_cell/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_egress_matrix_cell_clear_all/resource.tf b/examples/samples/resources/ciscoise_egress_matrix_cell_clear_all/resource.tf index 725e027a..07916406 100644 --- a/examples/samples/resources/ciscoise_egress_matrix_cell_clear_all/resource.tf +++ b/examples/samples/resources/ciscoise_egress_matrix_cell_clear_all/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_endpoint_group/main.tf b/examples/samples/resources/ciscoise_endpoint_group/main.tf index 7d70d4b2..d7f79039 100644 --- a/examples/samples/resources/ciscoise_endpoint_group/main.tf +++ b/examples/samples/resources/ciscoise_endpoint_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_filter_policy/main.tf b/examples/samples/resources/ciscoise_filter_policy/main.tf index 18913afe..1ad0bd50 100644 --- a/examples/samples/resources/ciscoise_filter_policy/main.tf +++ b/examples/samples/resources/ciscoise_filter_policy/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_guest_smtp_notification_settings/main.tf b/examples/samples/resources/ciscoise_guest_smtp_notification_settings/main.tf index 6846e188..5a182b38 100644 --- a/examples/samples/resources/ciscoise_guest_smtp_notification_settings/main.tf +++ b/examples/samples/resources/ciscoise_guest_smtp_notification_settings/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_guest_user/main.tf b/examples/samples/resources/ciscoise_guest_user/main.tf index c6a8fb91..142b6fd3 100644 --- a/examples/samples/resources/ciscoise_guest_user/main.tf +++ b/examples/samples/resources/ciscoise_guest_user/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_identity_group/main.tf b/examples/samples/resources/ciscoise_identity_group/main.tf index 22d98207..cbfa98f8 100644 --- a/examples/samples/resources/ciscoise_identity_group/main.tf +++ b/examples/samples/resources/ciscoise_identity_group/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_ise_root_ca_regenerate/resource.tf b/examples/samples/resources/ciscoise_ise_root_ca_regenerate/resource.tf index 13cf3cda..35cdb7cc 100644 --- a/examples/samples/resources/ciscoise_ise_root_ca_regenerate/resource.tf +++ b/examples/samples/resources/ciscoise_ise_root_ca_regenerate/resource.tf @@ -3,7 +3,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_my_device_portal/main.tf b/examples/samples/resources/ciscoise_my_device_portal/main.tf index 80dfc487..2a648986 100644 --- a/examples/samples/resources/ciscoise_my_device_portal/main.tf +++ b/examples/samples/resources/ciscoise_my_device_portal/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_network_access_conditions/main.tf b/examples/samples/resources/ciscoise_network_access_conditions/main.tf index 0aa38614..87fdd601 100644 --- a/examples/samples/resources/ciscoise_network_access_conditions/main.tf +++ b/examples/samples/resources/ciscoise_network_access_conditions/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_network_access_dictionary_attribute/main.tf b/examples/samples/resources/ciscoise_network_access_dictionary_attribute/main.tf index ebfee8e1..693a2871 100644 --- a/examples/samples/resources/ciscoise_network_access_dictionary_attribute/main.tf +++ b/examples/samples/resources/ciscoise_network_access_dictionary_attribute/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_network_access_policy_set/main.tf b/examples/samples/resources/ciscoise_network_access_policy_set/main.tf index 85fb6c0a..31097063 100644 --- a/examples/samples/resources/ciscoise_network_access_policy_set/main.tf +++ b/examples/samples/resources/ciscoise_network_access_policy_set/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_node_deployment_sync/resource.tf b/examples/samples/resources/ciscoise_node_deployment_sync/resource.tf index db588909..c8a44860 100644 --- a/examples/samples/resources/ciscoise_node_deployment_sync/resource.tf +++ b/examples/samples/resources/ciscoise_node_deployment_sync/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_node_group_node/resource.tf b/examples/samples/resources/ciscoise_node_group_node/resource.tf index f6e44ae9..f652b256 100644 --- a/examples/samples/resources/ciscoise_node_group_node/resource.tf +++ b/examples/samples/resources/ciscoise_node_group_node/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_node_services_profiler_probe_config/main.tf b/examples/samples/resources/ciscoise_node_services_profiler_probe_config/main.tf index 611a5ed2..564be78b 100644 --- a/examples/samples/resources/ciscoise_node_services_profiler_probe_config/main.tf +++ b/examples/samples/resources/ciscoise_node_services_profiler_probe_config/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_portal_global_setting/main.tf b/examples/samples/resources/ciscoise_portal_global_setting/main.tf index 74534c67..3622c4d0 100644 --- a/examples/samples/resources/ciscoise_portal_global_setting/main.tf +++ b/examples/samples/resources/ciscoise_portal_global_setting/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_px_grid_settings_auto_approve/resource.tf b/examples/samples/resources/ciscoise_px_grid_settings_auto_approve/resource.tf index 30da0db2..9b15d694 100644 --- a/examples/samples/resources/ciscoise_px_grid_settings_auto_approve/resource.tf +++ b/examples/samples/resources/ciscoise_px_grid_settings_auto_approve/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_pxgrid_access_secret/resource.tf b/examples/samples/resources/ciscoise_pxgrid_access_secret/resource.tf index f18c287f..96caf1e3 100644 --- a/examples/samples/resources/ciscoise_pxgrid_access_secret/resource.tf +++ b/examples/samples/resources/ciscoise_pxgrid_access_secret/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_pxgrid_account_activate/resource.tf b/examples/samples/resources/ciscoise_pxgrid_account_activate/resource.tf index 26c1699b..26bb09e2 100644 --- a/examples/samples/resources/ciscoise_pxgrid_account_activate/resource.tf +++ b/examples/samples/resources/ciscoise_pxgrid_account_activate/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_pxgrid_service_reregister/resource.tf b/examples/samples/resources/ciscoise_pxgrid_service_reregister/resource.tf index fb773cac..963b689c 100644 --- a/examples/samples/resources/ciscoise_pxgrid_service_reregister/resource.tf +++ b/examples/samples/resources/ciscoise_pxgrid_service_reregister/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_radius_server_sequence/main.tf b/examples/samples/resources/ciscoise_radius_server_sequence/main.tf index a1d1a530..4594a01d 100644 --- a/examples/samples/resources/ciscoise_radius_server_sequence/main.tf +++ b/examples/samples/resources/ciscoise_radius_server_sequence/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_renew_certificate/resource.tf b/examples/samples/resources/ciscoise_renew_certificate/resource.tf index d7fe8276..ba3dc890 100644 --- a/examples/samples/resources/ciscoise_renew_certificate/resource.tf +++ b/examples/samples/resources/ciscoise_renew_certificate/resource.tf @@ -3,7 +3,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_resource_version/main.tf b/examples/samples/resources/ciscoise_resource_version/main.tf index f7a89a73..562d2a98 100644 --- a/examples/samples/resources/ciscoise_resource_version/main.tf +++ b/examples/samples/resources/ciscoise_resource_version/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_selfsigned_certificate_generate/resource.tf b/examples/samples/resources/ciscoise_selfsigned_certificate_generate/resource.tf index ed1573b7..5ad00a09 100644 --- a/examples/samples/resources/ciscoise_selfsigned_certificate_generate/resource.tf +++ b/examples/samples/resources/ciscoise_selfsigned_certificate_generate/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_sgt/main.tf b/examples/samples/resources/ciscoise_sgt/main.tf index 17b9603f..1ea13efb 100644 --- a/examples/samples/resources/ciscoise_sgt/main.tf +++ b/examples/samples/resources/ciscoise_sgt/main.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_sgt_2/resource.tf b/examples/samples/resources/ciscoise_sgt_2/resource.tf new file mode 100644 index 00000000..c7bf85ea --- /dev/null +++ b/examples/samples/resources/ciscoise_sgt_2/resource.tf @@ -0,0 +1,25 @@ +terraform { + required_providers { + ciscoise = { + version = "0.6.6-beta" + source = "hashicorp.com/edu/ciscoise" + } + } +} +# Configure provider with your Cisco Identity Services Engine SDK credentials +provider "ciscoise" { + enable_auto_import = "false" +} +resource "ciscoise_sgt" "example" { + provider = ciscoise + parameters { + + description = "Terraform created with updatieee" + #generation_id = "string123" + # id = "8ed911d4-b2aa-46b8-ba97-97684d88f1d5" + is_read_only = "false" + name = "TerraformSGT00000000" + propogate_to_apic = "true" + value = 111 + } +} \ No newline at end of file diff --git a/examples/samples/resources/ciscoise_tacacs_command_sets/resource.tf b/examples/samples/resources/ciscoise_tacacs_command_sets/resource.tf index c3ee3dad..1cf6d360 100644 --- a/examples/samples/resources/ciscoise_tacacs_command_sets/resource.tf +++ b/examples/samples/resources/ciscoise_tacacs_command_sets/resource.tf @@ -1,15 +1,15 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } } resource "ciscoise_tacacs_command_sets" "asa_read_only" { parameters { - description = "ASA Read Only" - name = "ASA Operator" + description = "ASA Read Only 2" + name = "ASA Operator 2" permit_unmatched = "false" commands { command_list { diff --git a/examples/samples/resources/ciscoise_trusted_certificate_import/resource.tf b/examples/samples/resources/ciscoise_trusted_certificate_import/resource.tf index 3f4706f8..59e980c6 100644 --- a/examples/samples/resources/ciscoise_trusted_certificate_import/resource.tf +++ b/examples/samples/resources/ciscoise_trusted_certificate_import/resource.tf @@ -2,7 +2,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_create/resource.tf b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_create/resource.tf index 89671267..05e8698b 100644 --- a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_create/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_create/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_delete/resource.tf b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_delete/resource.tf index edd5693c..747770cc 100644 --- a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_delete/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_delete/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_update/resource.tf b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_update/resource.tf index e7f50c8b..3d289d6f 100644 --- a/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_update/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_sg_vn_mapping_bulk_update/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_vn_bulk_create/resource.tf b/examples/samples/resources/ciscoise_trustsec_vn_bulk_create/resource.tf index f54dd952..fdf63416 100644 --- a/examples/samples/resources/ciscoise_trustsec_vn_bulk_create/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_vn_bulk_create/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_vn_bulk_delete/resource.tf b/examples/samples/resources/ciscoise_trustsec_vn_bulk_delete/resource.tf index 90c6f0d7..d7f16b0a 100644 --- a/examples/samples/resources/ciscoise_trustsec_vn_bulk_delete/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_vn_bulk_delete/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_vn_bulk_update/resource.tf b/examples/samples/resources/ciscoise_trustsec_vn_bulk_update/resource.tf index cec2c420..39825411 100644 --- a/examples/samples/resources/ciscoise_trustsec_vn_bulk_update/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_vn_bulk_update/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_delete/resource.tf b/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_delete/resource.tf index 7b02cf68..dfca9446 100644 --- a/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_delete/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_delete/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } } diff --git a/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_update/resource.tf b/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_update/resource.tf index a8e67176..edc0f929 100644 --- a/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_update/resource.tf +++ b/examples/samples/resources/ciscoise_trustsec_vn_vlan_mapping_bulk_update/resource.tf @@ -1,7 +1,7 @@ terraform { required_providers { ciscoise = { - version = "0.6.5-beta" + version = "0.6.6-beta" source = "hashicorp.com/edu/ciscoise" } }