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

fmc_port_group_objects cannot be created #132

Closed mmaciejc closed 10 months ago

mmaciejc commented 11 months ago

Portgroup cannot be created.

Example config: resource "fmc_port_group_objects" "portgroup" { name = "API_PortGroup" }

wrong status code: 400, error │ category: FRAMEWORK, error severity: ERROR, error messages: [{Invalid query parameter for the POST operation.}]

205101-retr0 commented 11 months ago

May I know which FMC version you are working with. I ran some tests on 7.3 and it worked fine. Also when I ran the example config script that you provided above, I encountered getting port group objects:

wrong status code: 400, error │ category: FRAMEWORK, error severity: ERROR, error messages: [{The group should have atleast one object reference or a literal as override is not enabled.}]

This was expected because there aren't any objects being provided in the group. But I didn't get the "Invalid query param", so it might be an issue with the version.

mmaciejc commented 11 months ago

I tested it on the 7.2.5

My config:

resource "fmc_port_objects" "ProtocolPortObject1" {
    name = "ProtocolPortObject1"
    port = "8007"
    protocol = "TCP"
}

resource "fmc_port_group_objects" "PortObjectGroup1" {
    name = "PortObjectGroup1"
    description = "Terraform port object group"
    objects {
        id = fmc_port_objects.ProtocolPortObject1.id
        type = fmc_port_objects.ProtocolPortObject1.type
    }
    depends_on = [
        fmc_port_objects.ProtocolPortObject1
    ]      
}
205101-retr0 commented 11 months ago

I see, this happens to be a minor bug in an api call which is already patched. It will be merged from develop into the main branch soon.

jeroenwittock commented 10 months ago

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

patrickboertje commented 10 months ago

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

@jeroenwittock can you confirm the fix is inside 1.4.6? Currently using 1.4.6 to use the port groups, but the issue still exists.

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)