@@ -52,7 +52,6 @@ func resourceDomain() *schema.Resource {
52
52
53
53
name := d .Id ()
54
54
ds , err := findDomainByName (ctx , conn , name )
55
-
56
55
if err != nil {
57
56
return nil , fmt .Errorf ("reading OpenSearch Domain (%s): %w" , name , err )
58
57
}
@@ -172,6 +171,47 @@ func resourceDomain() *schema.Resource {
172
171
},
173
172
},
174
173
},
174
+ "aiml_options" : {
175
+ Type : schema .TypeList ,
176
+ Optional : true ,
177
+ Computed : true ,
178
+ MaxItems : 1 ,
179
+ Elem : & schema.Resource {
180
+ Schema : map [string ]* schema.Schema {
181
+ "natural_language_query_generation_options" : {
182
+ Type : schema .TypeList ,
183
+ Optional : true ,
184
+ Computed : true ,
185
+ MaxItems : 1 ,
186
+ Elem : & schema.Resource {
187
+ Schema : map [string ]* schema.Schema {
188
+ "desired_state" : {
189
+ Type : schema .TypeString ,
190
+ Optional : true ,
191
+ Computed : true ,
192
+ ValidateDiagFunc : enum .Validate [awstypes.NaturalLanguageQueryGenerationDesiredState ](),
193
+ },
194
+ },
195
+ },
196
+ },
197
+ "s3_vectors_engine" : {
198
+ Type : schema .TypeList ,
199
+ Optional : true ,
200
+ Computed : true ,
201
+ MaxItems : 1 ,
202
+ Elem : & schema.Resource {
203
+ Schema : map [string ]* schema.Schema {
204
+ names .AttrEnabled : {
205
+ Type : schema .TypeBool ,
206
+ Computed : true ,
207
+ Optional : true ,
208
+ },
209
+ },
210
+ },
211
+ },
212
+ },
213
+ },
214
+ },
175
215
names .AttrARN : {
176
216
Type : schema .TypeString ,
177
217
Computed : true ,
@@ -716,6 +756,10 @@ func resourceDomainCreate(ctx context.Context, d *schema.ResourceData, meta any)
716
756
input .AdvancedSecurityOptions = expandAdvancedSecurityOptions (v .([]any ))
717
757
}
718
758
759
+ if v , ok := d .GetOk ("aiml_options" ); ok && len (v .([]any )) > 0 && v .([]any )[0 ] != nil {
760
+ input .AIMLOptions = expandAIMLOptionsInput (v .([]any )[0 ].(map [string ]any ))
761
+ }
762
+
719
763
if v , ok := d .GetOk ("auto_tune_options" ); ok && len (v .([]any )) > 0 {
720
764
input .AutoTuneOptions = expandAutoTuneOptionsInput (v .([]any )[0 ].(map [string ]any ))
721
765
}
@@ -831,7 +875,6 @@ func resourceDomainCreate(ctx context.Context, d *schema.ResourceData, meta any)
831
875
},
832
876
domainErrorRetryable ,
833
877
)
834
-
835
878
if err != nil {
836
879
return sdkdiag .AppendErrorf (diags , "creating OpenSearch Domain (%s): %s" , name , err )
837
880
}
@@ -854,7 +897,6 @@ func resourceDomainCreate(ctx context.Context, d *schema.ResourceData, meta any)
854
897
},
855
898
domainErrorRetryable ,
856
899
)
857
-
858
900
if err != nil {
859
901
return sdkdiag .AppendErrorf (diags , "updating OpenSearch Domain (%s) Config: %s" , d .Id (), err )
860
902
}
@@ -887,7 +929,6 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta any) d
887
929
output , err := conn .DescribeDomainConfig (ctx , & opensearch.DescribeDomainConfigInput {
888
930
DomainName : aws .String (name ),
889
931
})
890
-
891
932
if err != nil {
892
933
return sdkdiag .AppendErrorf (diags , "reading OpenSearch Domain (%s) Config: %s" , d .Id (), err )
893
934
}
@@ -916,6 +957,13 @@ func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta any) d
916
957
return sdkdiag .AppendErrorf (diags , "setting advanced_security_options: %s" , err )
917
958
}
918
959
}
960
+ if ds .AIMLOptions != nil {
961
+ if err := d .Set ("aiml_options" , []any {flattenAIMLOptionsOutput (ds .AIMLOptions )}); err != nil {
962
+ return sdkdiag .AppendErrorf (diags , "setting aiml_options: %s" , err )
963
+ }
964
+ } else {
965
+ d .Set ("aiml_options" , nil )
966
+ }
919
967
d .Set (names .AttrARN , ds .ARN )
920
968
if v := dc .AutoTuneOptions ; v != nil {
921
969
if err := d .Set ("auto_tune_options" , []any {flattenAutoTuneOptions (v .Options )}); err != nil {
@@ -1044,6 +1092,12 @@ func resourceDomainUpdate(ctx context.Context, d *schema.ResourceData, meta any)
1044
1092
input .AdvancedSecurityOptions = expandAdvancedSecurityOptions (d .Get ("advanced_security_options" ).([]any ))
1045
1093
}
1046
1094
1095
+ if d .HasChange ("aiml_options" ) {
1096
+ if v , ok := d .GetOk ("aiml_options" ); ok && len (v .([]any )) > 0 && v .([]any )[0 ] != nil {
1097
+ input .AIMLOptions = expandAIMLOptionsInput (v .([]any )[0 ].(map [string ]any ))
1098
+ }
1099
+ }
1100
+
1047
1101
if d .HasChange ("auto_tune_options" ) {
1048
1102
input .AutoTuneOptions = expandAutoTuneOptions (d .Get ("auto_tune_options" ).([]any )[0 ].(map [string ]any ))
1049
1103
}
@@ -1172,7 +1226,6 @@ func resourceDomainUpdate(ctx context.Context, d *schema.ResourceData, meta any)
1172
1226
},
1173
1227
domainErrorRetryable ,
1174
1228
)
1175
-
1176
1229
if err != nil {
1177
1230
return sdkdiag .AppendErrorf (diags , "updating OpenSearch Domain (%s) Config: %s" , d .Id (), err )
1178
1231
}
@@ -1188,7 +1241,6 @@ func resourceDomainUpdate(ctx context.Context, d *schema.ResourceData, meta any)
1188
1241
}
1189
1242
1190
1243
_ , err := conn .UpgradeDomain (ctx , & input )
1191
-
1192
1244
if err != nil {
1193
1245
return sdkdiag .AppendErrorf (diags , "upgrading OpenSearch Domain (%s): %s" , d .Id (), err )
1194
1246
}
0 commit comments