From c16ccbfdd8e2c9e9511b5602141df1a9f4044faf Mon Sep 17 00:00:00 2001 From: SharmaRakeshKumar Date: Thu, 4 Jul 2024 00:01:36 -0600 Subject: [PATCH] Issue #437 - Update resource_opsgenie_service.go https://github.com/opsgenie/terraform-provider-opsgenie/issues/437 To achieve the team_id update, applying a quick solution - Deleting & creating service again, as there is no issue with service creation or deletion. Hence to apply a quick fix to the problem, we can delete and create the service again. --- opsgenie/resource_opsgenie_service.go | 46 +++++++++++++++------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/opsgenie/resource_opsgenie_service.go b/opsgenie/resource_opsgenie_service.go index 9aeefe24..0091285c 100644 --- a/opsgenie/resource_opsgenie_service.go +++ b/opsgenie/resource_opsgenie_service.go @@ -101,27 +101,31 @@ func resourceOpsGenieServiceRead(d *schema.ResourceData, meta interface{}) error } func resourceOpsGenieServiceUpdate(d *schema.ResourceData, meta interface{}) error { - client, err := service.NewClient(meta.(*OpsgenieClient).client.Config) - if err != nil { - return err - } - name := d.Get("name").(string) - description := d.Get("description").(string) - tags := flattenTags(d, "tags") - - log.Printf("[INFO] Updating OpsGenie service '%s'", name) - - updateRequest := &service.UpdateRequest{ - Id: d.Id(), - Name: name, - Description: description, - Tags: tags, - } - - _, err = client.Update(context.Background(), updateRequest) - if err != nil { - return err - } + + resourceOpsGenieServiceDelete(d, meta) + resourceOpsGenieServiceCreate(d, meta) + + // client, err := service.NewClient(meta.(*OpsgenieClient).client.Config) + // if err != nil { + // return err + // } + // name := d.Get("name").(string) + // description := d.Get("description").(string) + // tags := flattenTags(d, "tags") + + // log.Printf("[INFO] Updating OpsGenie service '%s'", name) + + // updateRequest := &service.UpdateRequest{ + // Id: d.Id(), + // Name: name, + // Description: description, + // Tags: tags, + // } + + // _, err = client.Update(context.Background(), updateRequest) + // if err != nil { + // return err + // } return nil }