Skip to content

Provider sees the changes in ips sensor entries but it doesn't apply them in state #424

@Vokunne

Description

@Vokunne

Hi there,

I've faced the issue when changes for ips sensor entries (at least, for "os" "severity" "application" & "exampt_ip" variables) in "fortios_ips_sensor" terraform resource don't record into the terraform state file.

Terraform: 1.15.5
Provider: 1.24.1
FortiOS: 7.4.12

What's going wrong.
At apply stage terraform says:

  module.ips.test-sensors["test"] will be updated in-place
  ~ resource "fortios_ips_sensor" "test-sensors" {
        id                      = "test"
        name                = "test"
        # (9 unchanged attributes hidden)
      ~ entries {
            id                 = 1
          ~ os               = "Linux BSD" -> "BSD Linux"
            # (19 unchanged attributes hidden)
          - exempt_ip {
              - dst_ip = "10.0.1.0 255.255.255.224" -> null
              - id         = 1 -> null
              - src_ip  = "10.0.1.10 255.255.255.255" -> null
            }
          - exempt_ip {
              - dst_ip = "10.0.1.13 255.255.255.255" -> null
              - id         = 2 -> null
              - src_ip  = "10.0.13.16 255.255.255.240" -> null
            }
            # (2 unchanged blocks hidden)
        }
      ~ entries {
          ~ application        = "Oracle MSSQL MySQL DB2 PostgreSQL" -> "DB2 MSSQL MySQL Oracle PostgreSQL"
            id                         = 2
          ~ severity              = "high critical" -> "critical high"
            # (18 unchanged attributes hidden)
        }
        # (1 unchanged block hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

After "apply", the terraform state contains the same values as they were before "apply" command:

"module": **********,
      "mode": "managed",
      "type": "fortios_ips_sensor",
      "name": **********
      "provider": **********,
      "instances": [
        {
          "index_key": "test",
          "schema_version": 0,
          "attributes": {
            "block_malicious_url": "enable",
            "comment": "This is a test IPS sensor",
            "dynamic_sort_subtable": "false",
            "entries": [
              {
                "action": "pass",
                "application": "all",
                "cve": [],
                "default_action": "pass",
                "default_status": "enable",
                "exempt_ip": [          <---------- This exampt_ip had to be deleted during the last apply, but it still exist
                  {
                    "dst_ip": "10.0.1.0 255.255.255.224",
                    "id": 1,
                    "src_ip": "10.0.1.10 255.255.255.255"
                  },
                  {
                    "dst_ip": "10.0.1.13 255.255.255.255",
                    "id": 2,
                    "src_ip": "10.0.13.16 255.255.255.240"
                  }
                ],
                "id": 1,   
                "last_modified": "",
                "location": "all",
                "log": "enable",
                "log_attack_context": "enable",
                "log_packet": "disable",
                "os": "Linux BSD",       <----------- Must be changed to "BSD Linux"
                "protocol": "all",
                "quarantine": "none",
                "quarantine_expiry": "1h",
                "quarantine_log": "disable",
                "rate_count": 0,
                "rate_duration": 60,
                "rate_mode": "continuous",
                "rate_track": "none",
                "rule": [],
                "severity": "all",
                "status": "enable",
                "vuln_type": [
                  {
                    "id": 11
                  },
                  {
                    "id": 12
                  }
                ]
              },
              {
                "action": "reset",
                "application": "Oracle MSSQL MySQL DB2 PostgreSQL", <------- Must be changed to "DB2 MSSQL MySQL Oracle PostgreSQL"
                "cve": [],
                "default_action": "pass",
                "default_status": "enable",
                "exempt_ip": [],
                "id": 2,
                "last_modified": "",
                "location": "server",
                "log": "enable",
                "log_attack_context": "enable",
                "log_packet": "disable",
                "os": "Linux",
                "protocol": "MSSQL SSH SSL",
                "quarantine": "attacker",
                "quarantine_expiry": "1h",
                "quarantine_log": "enable",
                "rate_count": 0,
                "rate_duration": 60,
                "rate_mode": "continuous",
                "rate_track": "none",
                "rule": [],
                "severity": "high critical",        <--------- Must be changed to "critical high"
                "status": "enable",
                "vuln_type": []
              }

I tried to use update_if_exist = true, but regretfully, nothing happened. Is it a bug or I missed something? Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions