terraform-provider-jamfpro icon indicating copy to clipboard operation
terraform-provider-jamfpro copied to clipboard

Unable to manage Computer Groups created with provider v0.0.49 and prior

Open smithjw opened this issue 9 months ago • 0 comments

Receiving an error about being unable to update Computer Groups created with older versions of the provider. The error message refers to not being able to have the computers dict when is_smart is true, but I'm wondering if this is actually to do with a new check introduced to look at groups with associated sites?

Terraform config (v0.0.49):

resource "jamfpro_computer_group" "config_scope_managed_devices" {
  name     = "Config Scope - Managed macOS Devices (tf)"
  is_smart = true
  criteria {
    name        = "MDM Capability"
    priority    = 0
    search_type = "is"
    value       = "Yes"
  }
  criteria {
    and_or      = "and"
    name        = "Model"
    priority    = 1
    search_type = "like"
    value       = "Mac"
  }
}

I don't use sites, but there is reference to site in the state (namely an id of -1 and name of None) Output of terraform state show 'jamfpro_computer_group.config_scope_managed_devices'

# jamfpro_computer_group.config_scope_managed_devices:
resource "jamfpro_computer_group" "config_scope_managed_devices" {
    id       = "3"
    is_smart = true
    name     = "Config Scope - Managed macOS Devices (tf)"

    criteria {
        and_or        = "and"
        closing_paren = false
        name          = "MDM Capability"
        opening_paren = false
        priority      = 0
        search_type   = "is"
        value         = "Yes"
    }
    criteria {
        and_or        = "and"
        closing_paren = false
        name          = "Model"
        opening_paren = false
        priority      = 1
        search_type   = "like"
        value         = "Mac"
    }

    site {
        id   = -1
        name = "None"
    }
}

Proceed to update provider to v0.0.52, run the command terraform plan -target='jamfpro_computer_group.config_scope_managed_devices', then receive the error:

jamfpro_computer_group.config_scope_managed_devices: Refreshing state... [id=3]
Planning failed. Terraform encountered an error while generating this plan.

│ Error: 'computers' field is not allowed when 'is_smart' is true
│ 
│   with jamfpro_computer_group.config_scope_managed_devices,
│   on computer_groups-general.tf line 1, in resource "jamfpro_computer_group" "config_scope_managed_devices":
│    1: resource "jamfpro_computer_group" "config_scope_managed_devices" {

smithjw avatar May 01 '24 03:05 smithjw