Closed ecanault closed 1 month ago
Fixed as part of PR #202 . Fields were previously required and have been made optional. Default values are sent if these fields are not populated by the hcl. Additionally added logic to the stating of scripts so that we only state the categroy_id and category_name if they are not defaults, else ignore.
Thanks for the update, but it seems there's still an issue.
It's OK on the Terraform side:
> jamfpro_script.object["AFA7A12B-A770-44C7-9FF2-9E026C7DE79E"]
{
"category_id" = tostring(null)
"category_name" = "Configuration"
"id" = "21"
"info" = ""
"name" = "s_run_0touch_reset.sh"
"notes" = "https://github.com/jamf/DEPNotify-Starter/blob/master/depNotifyReset.sh"
"os_requirements" = ""
"parameter10" = ""
"parameter11" = ""
"parameter4" = ""
"parameter5" = ""
"parameter6" = ""
"parameter7" = ""
"parameter8" = ""
"parameter9" = ""
"priority" = "AFTER"
"script_contents" = <<-EOT
[...]
EOT
"timeouts" = null /* object */
}
And there is no update of the object in a terraform plan
.
But categories are not set in Jamf Pro. Below are the views from the GUI and from the API perspectives:
<?xml version="1.0" encoding="UTF-8"?>
<script>
<id>21</id>
<name>s_run_0touch_reset.sh</name>
<category>No category assigned</category>
<filename>s_run_0touch_reset.sh</filename>
<info/>
<notes>https://github.com/jamf/DEPNotify-Starter/blob/master/depNotifyReset.sh</notes>
<priority>After</priority>
<parameters/>
<os_requirements/>
<script_contents>
[...]
</script_contents>
<script_contents_encoded>[...]</script_contents_encoded>
</script>
Regards, Emmanuel
Up
@ShocOne
hi there ,
in my hcl example
resource "jamfpro_script" "jamfpro_script_001" {
name = "tf-localtest-add-or-remove-group-membership-v4.0"
script_contents = file("${path.module}/support_files/scripts/Add or Remove Group Membership.zsh")
category_id = "5"
os_requirements = "13"
priority = "BEFORE"
info = "Adds target user or group to specified group membership, or removes said membership."
notes = "Jamf Pro script parameters: 4 -> 7"
parameter4 = "100" // targetID
parameter5 = "group" // Target Type - Must be either "user" or "group"
parameter6 = "someGroupName" // targetMembership
parameter7 = "add" // Script Action - Must be either "add" or "remove"
}
the category assigns just fine
and i don't get any false positives for terraform plans
in your example remove the category_name field as it is computed and see if that resolves your issue
Hi,
Yes! 🙂
It works using category_id
instead of category_name
.
Thanks a lot, this one can be closed too!
Hi,
When creating a new script, here is the result of
terraform plan
:After
terraform apply
, if I launch anotherterraform plan
without any changes:And when I have a look in the
terraform console
:Regards, Emmanuel