Skip to content

Commit

Permalink
fix: use useStateForUnknown for hls_playlist_settings in channel …
Browse files Browse the repository at this point in the history
…resource
  • Loading branch information
thatsddr committed Jun 13, 2024
1 parent 561197c commit 8694b3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions awsmt/resource_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func (r *resourceChannel) Schema(_ context.Context, _ resource.SchemaRequest, re
"hls_playlist_settings": schema.SingleNestedAttribute{
Optional: true,
Attributes: map[string]schema.Attribute{
"ad_markup_type": optionalList,
"manifest_window_seconds": optionalInt64,
"ad_markup_type": optionalUnknownList,
"manifest_window_seconds": optionalUnknownInt64,
},
},
"manifest_name": requiredString,
Expand Down
15 changes: 14 additions & 1 deletion awsmt/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package awsmt

import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)

Expand Down Expand Up @@ -39,14 +42,24 @@ var optionalInt64 = schema.Int64Attribute{
Optional: true,
}

var optionalUnknownInt64 = schema.Int64Attribute{
Optional: true,
PlanModifiers: []planmodifier.Int64{
int64planmodifier.UseStateForUnknown(),
},
}

var optionalMap = schema.MapAttribute{
Optional: true,
ElementType: types.StringType,
}

var optionalList = schema.ListAttribute{
var optionalUnknownList = schema.ListAttribute{
Optional: true,
ElementType: types.StringType,
PlanModifiers: []planmodifier.List{
listplanmodifier.UseStateForUnknown(),
},
}

var optionalBool = schema.BoolAttribute{
Expand Down

0 comments on commit 8694b3d

Please sign in to comment.