@@ -88,6 +88,15 @@ func (r *resourceMemoryStrategy) Schema(ctx context.Context, request resource.Sc
8888 CustomType : fwtypes .SetOfStringType ,
8989 Required : true ,
9090 },
91+ names .AttrType : schema.StringAttribute {
92+ Required : true ,
93+ CustomType : fwtypes .StringEnumType [awstypes.MemoryStrategyType ](),
94+ PlanModifiers : []planmodifier.String {
95+ stringplanmodifier .RequiresReplace (),
96+ },
97+ },
98+ },
99+ Blocks : map [string ]schema.Block {
91100 "reflection_configuration" : schema.ListNestedBlock {
92101 CustomType : fwtypes.NewListNestedObjectTypeOf [reflectionConfigurationModel ](ctx ),
93102 Validators : []validator.List {
@@ -102,15 +111,6 @@ func (r *resourceMemoryStrategy) Schema(ctx context.Context, request resource.Sc
102111 },
103112 },
104113 },
105- names .AttrType : schema.StringAttribute {
106- Required : true ,
107- CustomType : fwtypes .StringEnumType [awstypes.MemoryStrategyType ](),
108- PlanModifiers : []planmodifier.String {
109- stringplanmodifier .RequiresReplace (),
110- },
111- },
112- },
113- Blocks : map [string ]schema.Block {
114114 names .AttrConfiguration : schema.ListNestedBlock {
115115 CustomType : fwtypes.NewListNestedObjectTypeOf [customConfigurationModel ](ctx ),
116116 Validators : []validator.List {
@@ -163,29 +163,29 @@ func (r *resourceMemoryStrategy) Schema(ctx context.Context, request resource.Sc
163163 },
164164 },
165165 },
166- "reflection" : schema.ListNestedBlock {
167- CustomType : fwtypes.NewListNestedObjectTypeOf [reflectionOverrideModel ](ctx ),
168- Validators : []validator.List {
169- listvalidator .SizeAtMost (1 ),
170- },
171- PlanModifiers : []planmodifier.List {
172- errorIfSingleBlockRemoved ("reflection" ),
173- },
174- NestedObject : schema.NestedBlockObject {
175- Attributes : map [string ]schema.Attribute {
176- "append_to_prompt" : schema.StringAttribute {
177- Required : true ,
178- },
179- "model_id" : schema.StringAttribute {
180- Required : true ,
181- },
182- "namespace_templates" : schema.ListAttribute {
183- CustomType : fwtypes .ListOfStringType ,
184- Optional : true ,
185- },
166+ "reflection" : schema.ListNestedBlock {
167+ CustomType : fwtypes.NewListNestedObjectTypeOf [reflectionOverrideModel ](ctx ),
168+ Validators : []validator.List {
169+ listvalidator .SizeAtMost (1 ),
170+ },
171+ PlanModifiers : []planmodifier.List {
172+ errorIfSingleBlockRemoved ("reflection" ),
173+ },
174+ NestedObject : schema.NestedBlockObject {
175+ Attributes : map [string ]schema.Attribute {
176+ "append_to_prompt" : schema.StringAttribute {
177+ Required : true ,
178+ },
179+ "model_id" : schema.StringAttribute {
180+ Required : true ,
181+ },
182+ "namespace_templates" : schema.ListAttribute {
183+ CustomType : fwtypes .ListOfStringType ,
184+ Optional : true ,
186185 },
187186 },
188187 },
188+ },
189189 },
190190 },
191191 },
@@ -297,7 +297,6 @@ func (r *resourceMemoryStrategy) ValidateConfig(ctx context.Context, request res
297297 }
298298 }
299299 }
300- }
301300}
302301
303302func (r * resourceMemoryStrategy ) Create (ctx context.Context , request resource.CreateRequest , response * resource.CreateResponse ) {
@@ -363,7 +362,7 @@ func (r *resourceMemoryStrategy) Create(ctx context.Context, request resource.Cr
363362 if episodicReflection , ok := found .Configuration .Reflection .(* awstypes.ReflectionConfigurationMemberEpisodicReflectionConfiguration ); ok {
364363 var rc reflectionConfigurationModel
365364 if episodicReflection .Value .NamespaceTemplates != nil {
366- rc .NamespaceTemplates , _ = fwtypes . ListOfStringValueFrom (ctx , episodicReflection .Value .NamespaceTemplates )
365+ rc .NamespaceTemplates = fwflex . FlattenFrameworkStringValueListOfString (ctx , episodicReflection .Value .NamespaceTemplates )
367366 }
368367 plan .ReflectionConfiguration , _ = fwtypes .NewListNestedObjectValueOfPtr (ctx , & rc )
369368 }
@@ -425,7 +424,7 @@ func (r *resourceMemoryStrategy) Read(ctx context.Context, request resource.Read
425424 if episodicReflection , ok := out .Configuration .Reflection .(* awstypes.ReflectionConfigurationMemberEpisodicReflectionConfiguration ); ok {
426425 var rc reflectionConfigurationModel
427426 if episodicReflection .Value .NamespaceTemplates != nil {
428- rc .NamespaceTemplates , _ = fwtypes . ListOfStringValueFrom (ctx , episodicReflection .Value .NamespaceTemplates )
427+ rc .NamespaceTemplates = fwflex . FlattenFrameworkStringValueListOfString (ctx , episodicReflection .Value .NamespaceTemplates )
429428 }
430429 state .ReflectionConfiguration , _ = fwtypes .NewListNestedObjectValueOfPtr (ctx , & rc )
431430 }
@@ -681,16 +680,16 @@ func findMemoryStrategyByTwoPartKey(ctx context.Context, conn *bedrockagentcorec
681680
682681type memoryStrategyResourceModel struct {
683682 framework.WithRegionModel
684- Configuration fwtypes.ListNestedObjectValueOf [customConfigurationModel ] `tfsdk:"configuration"`
685- Description types.String `tfsdk:"description"`
686- MemoryExecutionRoleARN fwtypes.ARN `tfsdk:"memory_execution_role_arn"`
687- MemoryStrategyID types.String `tfsdk:"memory_strategy_id"`
688- MemoryID types.String `tfsdk:"memory_id"`
689- Name types.String `tfsdk:"name"`
690- Namespaces fwtypes.SetOfString `tfsdk:"namespaces"`
691- ReflectionConfiguration fwtypes.ListNestedObjectValueOf [reflectionConfigurationModel ] `tfsdk:"reflection_configuration"`
692- Type fwtypes.StringEnum [awstypes.MemoryStrategyType ] `tfsdk:"type"`
693- Timeouts timeouts.Value `tfsdk:"timeouts"`
683+ Configuration fwtypes.ListNestedObjectValueOf [customConfigurationModel ] `tfsdk:"configuration"`
684+ Description types.String `tfsdk:"description"`
685+ MemoryExecutionRoleARN fwtypes.ARN `tfsdk:"memory_execution_role_arn"`
686+ MemoryStrategyID types.String `tfsdk:"memory_strategy_id"`
687+ MemoryID types.String `tfsdk:"memory_id"`
688+ Name types.String `tfsdk:"name"`
689+ Namespaces fwtypes.SetOfString `tfsdk:"namespaces"`
690+ ReflectionConfiguration fwtypes.ListNestedObjectValueOf [reflectionConfigurationModel ] `tfsdk:"reflection_configuration"`
691+ Type fwtypes.StringEnum [awstypes.MemoryStrategyType ] `tfsdk:"type"`
692+ Timeouts timeouts.Value `tfsdk:"timeouts"`
694693}
695694
696695func (m * memoryStrategyResourceModel ) GetIdentifier () string {
@@ -815,10 +814,10 @@ func (m memoryStrategyResourceModel) expandToModifyMemoryStrategyInput(ctx conte
815814}
816815
817816type customConfigurationModel struct {
818- Type fwtypes.StringEnum [awstypes.OverrideType ] `tfsdk:"type"`
819- Consolidation fwtypes.ListNestedObjectValueOf [overrideDetailsModel ] `tfsdk:"consolidation"`
820- Extraction fwtypes.ListNestedObjectValueOf [overrideDetailsModel ] `tfsdk:"extraction"`
821- Reflection fwtypes.ListNestedObjectValueOf [reflectionOverrideModel ] `tfsdk:"reflection"`
817+ Type fwtypes.StringEnum [awstypes.OverrideType ] `tfsdk:"type"`
818+ Consolidation fwtypes.ListNestedObjectValueOf [overrideDetailsModel ] `tfsdk:"consolidation"`
819+ Extraction fwtypes.ListNestedObjectValueOf [overrideDetailsModel ] `tfsdk:"extraction"`
820+ Reflection fwtypes.ListNestedObjectValueOf [reflectionOverrideModel ] `tfsdk:"reflection"`
822821}
823822
824823var (
@@ -860,6 +859,7 @@ func (m *customConfigurationModel) Flatten(ctx context.Context, v any) (diags di
860859 return diags
861860 }
862861 }
862+ }
863863
864864 if t .Reflection != nil {
865865 switch rt := t .Reflection .(type ) {
@@ -880,8 +880,6 @@ func (m *customConfigurationModel) Flatten(ctx context.Context, v any) (diags di
880880 }
881881 }
882882 }
883- }
884- }
885883 default :
886884 diags .AddError (
887885 "Unsupported Type" ,
@@ -973,7 +971,6 @@ func (m customConfigurationModel) expandToModifyStrategyConfiguration(ctx contex
973971 }
974972 }
975973
976-
977974 var reflection * reflectionOverrideModel
978975 if ! m .Reflection .IsNull () {
979976 reflection , d = m .Reflection .ToPtr (ctx )
0 commit comments