Skip to content

Commit

Permalink
Merge pull request #45 from Freeaqingme/feat-no-merge
Browse files Browse the repository at this point in the history
resource_redirect/create: Explicitly disable 'merge' functionality.
  • Loading branch information
mbardelmeijer authored Apr 4, 2024
2 parents 1c871f4 + 359ac69 commit eb52506
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/provider/resource_redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/hashicorp/terraform-plugin-log/tflog"
"io"
"net/http"
"strings"
"time"

"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -113,6 +113,8 @@ func redirectTypeValidator(i interface{}, _ cty.Path) diag.Diagnostics {
// https://redirect.pizza/docs#tag/Redirects/operation/createRedirect
func resourceRedirectCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
data := hydrateHttpPersistData(d)
merge := false // Do not use the merge functionality for resources managed by Terraform
data.Merge = &merge
reqBody, _ := json.Marshal(data)

apiClientData := meta.(*apiClient)
Expand Down Expand Up @@ -264,6 +266,7 @@ type httpPersistData struct {
KeepQueryString bool `json:"keep_query_string"`
Tracking bool `json:"tracking"`
Tags []string `json:"tags"`
Merge *bool `json:"merge,omitempty"`
}

func hydrateHttpPersistData(d *schema.ResourceData) *httpPersistData {
Expand Down

0 comments on commit eb52506

Please sign in to comment.