Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fortios_switchcontroller_managedswitch issues when deploying #352

Open
cmitsolutions1 opened this issue Dec 22, 2024 · 1 comment
Open

Comments

@cmitsolutions1
Copy link

We are trying to leverage the below resource to configure the 8 port managed switch we have.

resource "fortios_switchcontroller_managedswitch" "managed-switch" {
for_each = var.managed_switches
switch_id = each.value.switch_id
sn = each.value.sn
name = each.value.name
fsw_wan1_peer = each.value.fsw_wan1_peer
fsw_wan1_admin = each.value.fsw_wan1_admin
poe_detection_type = each.value.poe_detection_type
max_allowed_trunk_members = each.value.max_allowed_trunk_members

dynamic "ports" {
for_each = each.value.ports
content {
port_name = ports.value.port_name
speed_mask = ports.value.speed_mask
vlan = ports.value.vlan
export_to = ports.value.export_to
untagged_vlans {
vlan_name = ports.value.untagged_vlans
}
allowed_vlans {
vlan_name = ports.value.allowed_vlans
}
}
}
}

We can confirm that we have the switch plugged in and is online, but when we run our plan we get the below error.

│ Error: Error creating SwitchControllerManagedSwitch resource: Internal Server Error - Internal error when processing the request (500)

│ with module.fortios["firewall"].fortios_switchcontroller_managedswitch.managed-switch["switch_2"],
│ on modules/forti_os/main.tf line 212, in resource "fortios_switchcontroller_managedswitch" "managed-switch":
│ 212: resource "fortios_switchcontroller_managedswitch" "managed-switch" {

@MaxxLiu22
Copy link

Hi @cmitsolutions1 ,

Thank you for raising this issue. If you would like to use Terraform to manage an existing object, you may need to import it first using a command like:

terraform import fortios_switchcontroller_managedswitch.trname S548DN4K16000129

Alternatively, you can define an import block in your .tf files, such as:

import {
  to = fortios_switchcontroller_managedswitch.trname
  id = "S548DN4K16000129"
}

Otherwise, Terraform will attempt to create a new object, which would duplicate the existing one and raise an error. Let me know if that doesn't solve your question.

Thanks,
Maxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants