fortinetdev / terraform-provider-fortiswitch

Mozilla Public License 2.0
0 stars 0 forks source link

Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil. #3

Open donnieelmore opened 2 weeks ago

donnieelmore commented 2 weeks ago

When running a terraform plan I receive the following:

│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port2,
│   on switch.tf line 13, in resource "fortiswitch_switch_physicalport" "port2":
│   13: resource "fortiswitch_switch_physicalport" "port2" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port3,
│   on switch.tf line 24, in resource "fortiswitch_switch_physicalport" "port3":
│   24: resource "fortiswitch_switch_physicalport" "port3" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port4,
│   on switch.tf line 35, in resource "fortiswitch_switch_physicalport" "port4":
│   35: resource "fortiswitch_switch_physicalport" "port4" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port5,
│   on switch.tf line 46, in resource "fortiswitch_switch_physicalport" "port5":
│   46: resource "fortiswitch_switch_physicalport" "port5" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port6,
│   on switch.tf line 57, in resource "fortiswitch_switch_physicalport" "port6":
│   57: resource "fortiswitch_switch_physicalport" "port6" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port7,
│   on switch.tf line 68, in resource "fortiswitch_switch_physicalport" "port7":
│   68: resource "fortiswitch_switch_physicalport" "port7" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port8,
│   on switch.tf line 79, in resource "fortiswitch_switch_physicalport" "port8":
│   79: resource "fortiswitch_switch_physicalport" "port8" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port9,
│   on switch.tf line 90, in resource "fortiswitch_switch_physicalport" "port9":
│   90: resource "fortiswitch_switch_physicalport" "port9" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port10,
│   on switch.tf line 101, in resource "fortiswitch_switch_physicalport" "port10":
│  101: resource "fortiswitch_switch_physicalport" "port10" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port14,
│   on switch.tf line 145, in resource "fortiswitch_switch_physicalport" "port14":
│  145: resource "fortiswitch_switch_physicalport" "port14" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port16,
│   on switch.tf line 167, in resource "fortiswitch_switch_physicalport" "port16":
│  167: resource "fortiswitch_switch_physicalport" "port16" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port17,
│   on switch.tf line 178, in resource "fortiswitch_switch_physicalport" "port17":
│  178: resource "fortiswitch_switch_physicalport" "port17" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port18,
│   on switch.tf line 189, in resource "fortiswitch_switch_physicalport" "port18":
│  189: resource "fortiswitch_switch_physicalport" "port18" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port19,
│   on switch.tf line 200, in resource "fortiswitch_switch_physicalport" "port19":
│  200: resource "fortiswitch_switch_physicalport" "port19" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port20,
│   on switch.tf line 211, in resource "fortiswitch_switch_physicalport" "port20":
│  211: resource "fortiswitch_switch_physicalport" "port20" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port22,
│   on switch.tf line 233, in resource "fortiswitch_switch_physicalport" "port22":
│  233: resource "fortiswitch_switch_physicalport" "port22" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port23,
│   on switch.tf line 243, in resource "fortiswitch_switch_physicalport" "port23":
│  243: resource "fortiswitch_switch_physicalport" "port23" {
│ 
╵
╷
│ Error: Error reading SwitchPhysicalPort resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_switch_physicalport.port24,
│   on switch.tf line 253, in resource "fortiswitch_switch_physicalport" "port24":
│  253: resource "fortiswitch_switch_physicalport" "port24" {
│ 
╵
╷
│ Error: Error reading SystemGlobal resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_system_global.global,
│   on system.tf line 9, in resource "fortiswitch_system_global" "global":
│    9: resource "fortiswitch_system_global" "global" {
│ 
╵
╷
│ Error: Error reading SystemInterface resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_system_interface.internal,
│   on system.tf line 22, in resource "fortiswitch_system_interface" "internal":
│   22: resource "fortiswitch_system_interface" "internal" {
│ 
╵
╷
│ Error: Error reading SystemInterface resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_system_interface.mgmt,
│   on system.tf line 49, in resource "fortiswitch_system_interface" "mgmt":
│   49: resource "fortiswitch_system_interface" "mgmt" {
│ 
╵
╷
│ Error: Error reading SystemDns resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_system_dns.dns,
│   on system.tf line 81, in resource "fortiswitch_system_dns" "dns":
│   81: resource "fortiswitch_system_dns" "dns" {
│ 
╵
╷
│ Error: Error reading SystemSnmpCommunity resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_systemsnmp_community.snmp,
│   on system.tf line 88, in resource "fortiswitch_systemsnmp_community" "snmp":
│   88: resource "fortiswitch_systemsnmp_community" "snmp" {
│ 
╵
╷
│ Error: Error reading SystemSnmpSysinfo resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_systemsnmp_sysinfo.snmp_settings,
│   on system.tf line 98, in resource "fortiswitch_systemsnmp_sysinfo" "snmp_settings":
│   98: resource "fortiswitch_systemsnmp_sysinfo" "snmp_settings" {
│ 
╵
╷
│ Error: Error reading SystemAccprofile resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_system_accprofile.super_admin,
│   on system.tf line 118, in resource "fortiswitch_system_accprofile" "super_admin":
│  118: resource "fortiswitch_system_accprofile" "super_admin" {
│ 
╵
╷
│ Error: Error reading SystemCertificateCa resource: cannot send request Host is unreachable. HTTP response is nil.
│ 
│   with fortiswitch_systemcertificate_ca.certificate_ca,
│   on system.tf line 128, in resource "fortiswitch_systemcertificate_ca" "certificate_ca":
│  128: resource "fortiswitch_systemcertificate_ca" "certificate_ca" {

The error messages change resource each time it is run. I am using GitLab as a backend and my provider block looks like:

provider "fortiswitch" {
  hostname = "$redacted"
  username = module.global_variables.switch001_credentials.username
  password = module.global_variables.switch001_credentials.password
  cabundlefile = "ca.crt"
}

Any ideas?

donnieelmore commented 2 weeks ago

Update: I am able to workaround this by using the -parallelism=1 flag

MaxxLiu22 commented 2 weeks ago

Hi @donnieelmore ,

Thank you for bringing this issue to our attention. I was able to reproduce it, and it appears that the problem stems from the FSW admin concurrent limitation. The default parallelism value in Terraform is set to 10, which may cause some admin sessions to reach the maximum concurrent limit for FSW. Based on my testing, setting the parallelism to 3 seems to be the optimal value for now. I have reported this to the development team for further suggestions.

Thanks, Maxx