PaloAltoNetworks / terraform-provider-scm

The Terraform provider for Strata Cloud Manager
Apache License 2.0
7 stars 2 forks source link

scm_hip_object disk backup fails to create when specifying not_available attribute #12

Closed ancoleman closed 6 months ago

ancoleman commented 6 months ago

Describe the bug

_scm_hipobject resource when leveraging the attribute not_available fails to accept this value gracefully.

Configuration being used:

 terraform-disk-bkp:
    folder: Shared
    description: "Check if disk backup is enabled and configured correctly"
    disk_backup:
      criteria:
        is_installed: true # Boolean only values
        is_enabled: "yes" # Boolean only values
        last_backup_time:
          not_available:
      vendor:
        - name: "Apple Inc."
          product:
            - "Time Machine"

Resource is built this way:

resource "scm_hip_object" "this" {
  for_each             = try(var.objects, {})
  folder               = try(each.value.folder, null) # Fail if no folder
  name                 = each.key
  description          = try(each.value.description, null)
  anti_malware         = try(each.value.anti_malware, null)
  certificate          = try(each.value.certificate, null)
  custom_checks        = try(each.value.custom_checks, null)
  data_loss_prevention = try(each.value.data_loss_prevention, null)
  disk_backup          = try(each.value.disk_backup, null)
  disk_encryption      = try(each.value.disk_encryption, null)
  firewall             = try(each.value.firewall, null)
  host_info            = try(each.value.host_info, null)
  mobile_device        = try(each.value.mobile_device, null)
  network_info         = try(each.value.network_info, null)
  patch_management     = try(each.value.patch_management, null)
  device               = try(each.value.device, null)
  snippet              = try(each.value.snippet, null)
}

Expected behavior

You should be able to specify not_available

Current behavior

╷
│ Error: Invalid Attribute Combination
│ 
│   with module.hip_with_yaml.scm_hip_object.this["terraform-disk-bkp"],
│   on ../../modules/hip/main.tf line 1, in resource "scm_hip_object" "this":
│    1: resource "scm_hip_object" "this" {
│ 
│ No attribute specified when one (and only one) of
│ [disk_backup.criteria.last_backup_time.not_available,disk_backup.criteria.last_backup_time.not_available.<.not_within,disk_backup.criteria.last_backup_time.not_available.<.within]
│ is required
╵

Possible solution

Steps to reproduce

  1. Use the same configuration as my yaml example

Context

Your Environment

shinmog commented 6 months ago

not_available is a boolean value, closing this issue