CiscoDevNet / terraform-provider-fmc

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

Portgroup problem still present (should be fixed in 1.4.6) #152

Open patrickboertje opened 10 months ago

patrickboertje commented 10 months ago

The port group problem, available before version 1.4.6 seems still present.

Original issue in https://github.com/CiscoDevNet/terraform-provider-fmc/issues/132#issuecomment-1798051806

{
    "resource": {
      "fmc_port_objects": {
        "TCP-443": {
          "name": "TCP-443",
          "port": 443,
          "protocol": "TCP"
        }
      }
    }
  },
  {
    "resource": {
      "fmc_port_objects": {
        "TCP-80": {
          "name": "TCP-80",
          "port": 80,
          "protocol": "TCP"
        }
      }
    }
  },
  {
    "resource": {
      "fmc_port_group_objects": {
        "Web": {
          "name": "Web",
          "description": "Web poorten",
          "objects": [
            {
              "id": "${fmc_port_objects.TCP-443.id}",
              "type": "${fmc_port_objects.TCP-443.type}"
            },
            {
              "id": "${fmc_port_objects.TCP-80.id}",
              "type": "${fmc_port_objects.TCP-80.type}"
            }
          ]
        }
      }
    }
  }
╷
│ Error: unable to create port group object
│ 
│   with fmc_port_group_objects.Web,
│   on fmcObjects.tf.json line 76, in [6].resource.fmc_port_group_objects.Web:
│   76:         }
│ 
│ getting port group objects: https://10.192.13.100/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/object/portobjectgroups?limit=1000 - wrong status code: 400, error category:
│ FRAMEWORK, error severity: ERROR, error messages: [{Invalid query parameter for the POST operation.}]
╵
mike-guy commented 6 months ago

Same issue for me - blocking planned client work.

Testing using dCloud on FMC version 7.2.0 (build 82)

mxkrzak commented 3 months ago

@jeroenwittock fix still not in 1.4.6 nor 1.4.8 I have found in develop branch there is correct URL in line 51 url := fmt.Sprintf("%s/object/portobjectgroups", v.domainBaseURL) however main has URL that causes the issue url := fmt.Sprintf("%s/object/portobjectgroups?limit=1000", v.domainBaseURL) POST method seems to not support limit

mxkrzak commented 3 months ago

there is yet another issue related to that, in datasource fmc_port_group_object is working incorrectly when there are more than 25 groups in FMC, this is comes from the fact that function GetFmcPortGroupObjectByName does not take into consideration paging or returned objects limits. By default GetFmcPortGroupObjectByName returns 25 objects so something like limit=1000 would be required at least