From 3e18afb144ccc49bdfcbba48fa1895ab8b6e4f3b Mon Sep 17 00:00:00 2001 From: Utkarsh Raj Date: Mon, 14 Oct 2024 16:08:19 +0200 Subject: [PATCH] fix data source block --- .../resources/scratchpad/resource.tf | 92 ++++++++++++++----- zendesk/data_source_zendesk_ticket_field.go | 3 +- 2 files changed, 72 insertions(+), 23 deletions(-) diff --git a/examples_scratchpad/resources/scratchpad/resource.tf b/examples_scratchpad/resources/scratchpad/resource.tf index 00f76ca9..5415346e 100644 --- a/examples_scratchpad/resources/scratchpad/resource.tf +++ b/examples_scratchpad/resources/scratchpad/resource.tf @@ -24,12 +24,12 @@ resource "zendesk_dynamic_content" "better" { name = "better" } -resource "zendesk_dynamic_content_variant" "better_content" { - content = "Some data here is template good" - locale_id = 1 - default = true - dynamic_content_item_id = 18847895265170 -} +# resource "zendesk_dynamic_content_variant" "better_content" { +# content = "Some data here is template good" +# locale_id = 1 +# default = true +# dynamic_content_item_id = 18847895265170 +# } resource "zendesk_dynamic_content_variant" "foobaranother" { content = "foo bar is here right??? new" @@ -54,33 +54,38 @@ resource "zendesk_macro" "temp_utkarsh_test_macro" { restrictions = [18651233156242, 17784599337874] } +data "zendesk_ticket_field" "assignee" { + type = "assignee" +} + resource "zendesk_ticket_field" "checkbox-field3" { title = "Checkbox Field (this is a test)" type = "regexp" regexp_for_validation = "^foobar$" - description = "test here something" + description = "tesft here something" agent_description = "agent description change here" required = true } -resource "zendesk_user_field" "tagger-field" { - title = "Tagger Field" - type = "dropdown" - key = "foobar" - custom_field_option { - id = 20907892899730 - name = "option b here foo bar" - value = "optb" - } - custom_field_option { - id = 20909205605650 - name = "option a" - value = "opta" - } +# resource "zendesk_user_field" "tagger-field" { +# title = "Tagger Field" +# type = "dropdown" +# key = "foobar" +# custom_field_option { +# id = 20907892899730 +# name = "option b here foo bar" +# value = "optb" +# } +# custom_field_option { +# id = 20909205605650 +# name = "option a" +# value = "opta" +# } -} + +# } resource "zendesk_webhook" "example-basic-auth-webhook" { @@ -119,9 +124,24 @@ resource "zendesk_webhook" "example-basic-auth-webhook" { # resource "zendesk_ticket_form" "form-1" { # name = "Form 1" +# agent_conditions { +# parent_field_id = 360000035929 +# value = "foobar" +# child_fields { +# id = 33735105 +# is_required = false +# required_on_statuses { +# type = "SOME_STATUSES" +# statuses = ["new"] +# } +# } +# } + # ticket_field_ids = [ # 20713391817234, # 20713391818514, +# 360000035929, +# 33735105, # 20713412708626, # 20713391817490, # 20713391816338, @@ -136,3 +156,31 @@ resource "zendesk_webhook" "example-basic-auth-webhook" { # ] # } + + +resource "zendesk_automation" "auto-close-automation" { + title = "Close ticket 4 days after status is set to solved" + active = true + + all { + field = "status" + operator = "is" + value = "new" + } + any { + field = "status" + operator = "is" + value = "new" + } + + any { + field = "current_tags" + operator = "includes" + value = "wiedervorlage_aktiv" + } + + action { + field = "status" + value = "closed" + } +} diff --git a/zendesk/data_source_zendesk_ticket_field.go b/zendesk/data_source_zendesk_ticket_field.go index 4446f597..537fd534 100644 --- a/zendesk/data_source_zendesk_ticket_field.go +++ b/zendesk/data_source_zendesk_ticket_field.go @@ -7,12 +7,13 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/nukosuke/go-zendesk/zendesk" + "github.com/nukosuke/terraform-provider-zendesk/zendesk/client" ) func dataSourceZendeskTicketField() *schema.Resource { return &schema.Resource{ ReadContext: func(ctx context.Context, data *schema.ResourceData, i interface{}) diag.Diagnostics { - zd := i.(*zendesk.Client) + zd := i.(*client.Client) return readTicketFieldDataSource(ctx, data, zd) },