Skip to content

Commit

Permalink
Enabled the attribute private for dynatrace_document
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawa12 committed Aug 28, 2024
1 parent 8374181 commit 11f04b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 7 additions & 6 deletions dynatrace/api/documents/document/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"mime/multipart"
"net/http"
"os"
"strconv"
"sync"

"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/api"
Expand Down Expand Up @@ -141,11 +142,11 @@ func (me *service) Create(ctx context.Context, v *documents.Document) (*api.Stub
return nil, err
}

// if !v.IsPrivate {
// if err = me.update(ctx, stub.ID, v); err != nil {
// return nil, err
// }
// }
if !v.IsPrivate {
if err = me.update(ctx, stub.ID, v); err != nil {
return nil, err
}
}
return stub, nil
}

Expand Down Expand Up @@ -186,7 +187,7 @@ func (me *service) update(_ context.Context, id string, v *documents.Document) (

writer.WriteField("type", v.Type)
writer.WriteField("name", v.Name)
// writer.WriteField("isPrivate", strconv.FormatBool(v.IsPrivate))
writer.WriteField("isPrivate", strconv.FormatBool(v.IsPrivate))

part, err := writer.CreatePart(map[string][]string{
"Content-Type": {"application/json"},
Expand Down
9 changes: 4 additions & 5 deletions dynatrace/api/documents/document/settings/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ func (me *Document) Schema() map[string]*schema.Schema {
ValidateDiagFunc: ValidateMaxLength(200),
},
"private": {
Type: schema.TypeBool,
Description: "Specifies whether the document is private or readable by everybody. This attribute is currently getting ignored until all Dynatrace Environments are guaranteed to support for it",
Optional: true,
Default: false,
DiffSuppressFunc: func(k, oldValue, newValue string, d *schema.ResourceData) bool { return true },
Type: schema.TypeBool,
Description: "Specifies whether the document is private or readable by everybody. This attribute is currently getting ignored until all Dynatrace Environments are guaranteed to support for it",
Optional: true,
Default: false,
},
"type": {
Type: schema.TypeString,
Expand Down

0 comments on commit 11f04b7

Please sign in to comment.