CiscoDevNet / terraform-provider-fmc

Terraform Provider for FMC
https://registry.terraform.io/providers/CiscoDevNet/fmc/latest/docs
Mozilla Public License 2.0
16 stars 31 forks source link

if the object: resource "fmc_staticIPv4_route" will be removed from FMC GUI terraform will not reapply it. #135

Closed mmaciejc closed 1 year ago

mmaciejc commented 1 year ago

I have tested it on FMC (7.2.5):

This is my configuration:

resource "fmc_staticIPv4_route" "StaticRoute1" {
    device_id = fmc_devices.Device1.id
    interface_name = "Outside"
    is_tunneled = false
    metric_value = 1
    selected_networks {
        id = data.fmc_network_objects.any.id
        type = data.fmc_network_objects.any.type
        name = data.fmc_network_objects.any.name
    }
    gateway {
        object {
            id = fmc_host_objects.Host3.id
            type = fmc_host_objects.Host3.type
            name = fmc_host_objects.Host3.name
        }
    }
    depends_on = [
        data.fmc_network_objects.any, fmc_host_objects.Host2, fmc_devices.Device1, fmc_device_physical_interfaces.PhysicalInterface1
    ]        
}

Once I remove object on FMC I have error:

 - wrong status code: 404, error category: FRAMEWORK, error severity: ERROR, error messages: [{Resource not found. Please check the UUID passed in url.}] - id:
│ 005056B0-6958-0ed3-0000-004294978619

Workaround: List the objects with:

terraform state list
data.fmc_network_objects.any
fmc_device_physical_interfaces.PhysicalInterface1
fmc_devices.Device1
fmc_host_objects.Host3
fmc_staticIPv4_route.StaticRoute1

and remove the object: terraform state rm fmc_staticIPv4_route.StaticRoute1

jeroenwittock commented 1 year ago

This should be fixed in version 1.4.6 which will become available in the next hour.