Interesting issues here. If I import a smart group into my state, that import will also end up including the computers {} block of every device that is currently in that Smart Group leading to errors when trying to plan/apply changes.
Create simple group resource
group.tf
resource "jamfpro_computer_group" "device_compliance_applicable_devices" {
name = "Device Compliance Status - Applicable Devices"
is_smart = true
computers {}
criteria {
name = "Model"
priority = 1
search_type = "like"
value = "Mac"
}
}
import existing group into state terraform import jamfpro_computer_group.device_compliance_applicable_devices GROUP_ID
Run plan with targeting terraform plan -target=jamfpro_computer_group.device_compliance_applicable_devices
Error: 'computers' field is not allowed when 'is_smart' is true
│
│ with jamfpro_computer_group.device_compliance_applicable_devices,
│ on computer_groups-device_compliance.tf line 1, in resource "jamfpro_computer_group" "device_compliance_applicable_devices":
│ 1: resource "jamfpro_computer_group" "device_compliance_applicable_devices" {
Inspecting state shows the following terraform state show jamfpro_computer_group.device_compliance_applicable_devices
# jamfpro_computer_group.device_compliance_applicable_devices:
resource "jamfpro_computer_group" "device_compliance_applicable_devices" {
id = "16"
is_smart = true
name = "Device Compliance Status - Applicable Devices"
computers {
alt_mac_address = "*******"
id = 2
mac_address = "*******"
name = "Admin’s Virtual Machine"
serial_number = "*******"
}
criteria {
and_or = "and"
closing_paren = false
name = "Model"
opening_paren = false
priority = 0
search_type = "like"
value = "Mac"
}
site {
id = -1
name = "None"
}
}
Interesting issues here. If I import a smart group into my state, that import will also end up including the
computers {}
block of every device that is currently in that Smart Group leading to errors when trying to plan/apply changes.Create simple group resource group.tf
import existing group into state
terraform import jamfpro_computer_group.device_compliance_applicable_devices GROUP_ID
Run
plan
with targetingterraform plan -target=jamfpro_computer_group.device_compliance_applicable_devices
terraform state show jamfpro_computer_group.device_compliance_applicable_devices