Skip to content

Commit

Permalink
fix: incorrect template version persisted after update (problem #2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mamacdon-surveymonkey committed Mar 1, 2022
1 parent eeb4e3c commit b77a717
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/provider/resource_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,6 @@ func publishTemplate(ctx context.Context, d *schema.ResourceData, client *sp.Cli
if err != nil {
return err
}

// ensure the read looks for published templates
d.Set("draft", false)
} else {
// ensure the read looks for draft templates
d.Set("draft", true)
}

return nil
Expand All @@ -221,6 +215,9 @@ func resourceTemplateCreate(ctx context.Context, d *schema.ResourceData, m inter
return diag.FromErr(err)
}

// Ensure the read looks for the correct copy of the template
d.Set("draft", !template.Published)

d.SetId(id)

return resourceTemplateRead(ctx, d, m)
Expand Down Expand Up @@ -263,6 +260,9 @@ func resourceTemplateUpdate(ctx context.Context, d *schema.ResourceData, m inter
return diag.FromErr(err)
}

// Ensure the read looks for the correct copy of the template
d.Set("draft", !published)

return resourceTemplateRead(ctx, d, m)
}

Expand Down

0 comments on commit b77a717

Please sign in to comment.