@@ -51,19 +51,33 @@ var (
5151"dedicated_ai_cluster_id" : acctest.Representation {RepType : acctest .Required , Create : `${oci_generative_ai_dedicated_ai_cluster.test_dedicated_ai_cluster.id}` },
5252"model_id" : acctest.Representation {RepType : acctest .Required , Create : `${local.servering_model_id}` },
5353"content_moderation_config" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : GenerativeAiEndpointContentModerationConfigRepresentation },
54- // "defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
54+ //"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
5555"description" : acctest.Representation {RepType : acctest .Optional , Create : `description` , Update : `description2` },
5656"display_name" : acctest.Representation {RepType : acctest .Optional , Create : `displayName` , Update : `displayName2` },
5757"freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Accounting" }},
5858}
5959GenerativeAiEndpointContentModerationConfigRepresentation = map [string ]interface {}{
60- "is_enabled" : acctest.Representation {RepType : acctest .Optional , Create : `false` , Update : `true` },
60+ "is_enabled" : acctest.Representation {RepType : acctest .Required , Create : `false` , Update : `true` },
61+ "mode" : acctest.Representation {RepType : acctest .Optional , Create : `INFORM` , Update : `BLOCK` },
62+ "model_id" : acctest.Representation {RepType : acctest .Optional , Create : `${local.servering_model_id}` },
6163}
6264
63- GenerativeAiEndpointResourceDependencies = acctest .GenerateResourceFromRepresentationMap ("oci_generative_ai_dedicated_ai_cluster" , "test_dedicated_ai_cluster" , acctest .Required , acctest .Create , GenerativeAiHostingDedicatedAiClusterRepresentation ) +
65+ GenerativeAiEndpointResourceDependencies = acctest .GenerateResourceFromRepresentationMap ("oci_generative_ai_dedicated_ai_cluster" , "test_dedicated_ai_cluster" , acctest .Required , acctest .Create , DedicatedAiClusterRepresentation ) +
6466servingModelDependencies
6567// DefinedTagsDependencies + - no test in home region
6668
69+ DedicatedAiClusterRepresentation = map [string ]interface {}{
70+ "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
71+ "type" : acctest.Representation {RepType : acctest .Required , Create : `HOSTING` },
72+ "unit_count" : acctest.Representation {RepType : acctest .Required , Create : `1` , Update : `2` },
73+ "unit_shape" : acctest.Representation {RepType : acctest .Required , Create : `LARGE_COHERE_V3` },
74+ "defined_tags" : acctest.Representation {RepType : acctest .Optional , Create : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}` , Update : `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}` },
75+ "description" : acctest.Representation {RepType : acctest .Optional , Create : `description` , Update : `description2` },
76+ "display_name" : acctest.Representation {RepType : acctest .Optional , Create : `displayName` , Update : `displayName2` },
77+ "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Accounting" }},
78+ "lifecycle" : acctest.RepresentationGroup {RepType : acctest .Required , Group : generativeaiDatasetIgnoreDefinedTagsChangesRep },
79+ }
80+
6781servingModelDependencies = `
6882locals {
6983
8498 display_name = "cohere.command-a-03-2025"
8599}
86100`
101+
102+ GenerativeAiEndpointModelRepresentation = map [string ]interface {}{
103+ "base_model_id" : acctest.Representation {RepType : acctest .Required , Create : `${local.servering_model_id}` },
104+ "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
105+ //"defined_tags": acctest.Representation{RepType: acctest.Optional, Create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, Update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
106+ "description" : acctest.Representation {RepType : acctest .Optional , Create : `description` , Update : `description2` },
107+ "display_name" : acctest.Representation {RepType : acctest .Optional , Create : `displayName` , Update : `displayName2` },
108+ "freeform_tags" : acctest.Representation {RepType : acctest .Optional , Create : map [string ]string {"Department" : "Finance" }, Update : map [string ]string {"Department" : "Accounting" }},
109+ "vendor" : acctest.Representation {RepType : acctest .Optional , Create : `vendor` },
110+ "version" : acctest.Representation {RepType : acctest .Optional , Create : generativeAiVersion , Update : generativeAiVersion2 },
111+ }
87112)
88113
89114// issue-routing-tag: generative_ai/default
@@ -137,6 +162,8 @@ func TestGenerativeAiEndpointResource_basic(t *testing.T) {
137162resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
138163resource .TestCheckResourceAttr (resourceName , "content_moderation_config.#" , "1" ),
139164resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.is_enabled" , "false" ),
165+ resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.mode" , "INFORM" ),
166+ resource .TestCheckResourceAttrSet (resourceName , "content_moderation_config.0.model_id" ),
140167resource .TestCheckResourceAttrSet (resourceName , "dedicated_ai_cluster_id" ),
141168resource .TestCheckResourceAttr (resourceName , "description" , "description" ),
142169resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName" ),
@@ -169,6 +196,8 @@ func TestGenerativeAiEndpointResource_basic(t *testing.T) {
169196resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentIdU ),
170197resource .TestCheckResourceAttr (resourceName , "content_moderation_config.#" , "1" ),
171198resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.is_enabled" , "false" ),
199+ resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.mode" , "INFORM" ),
200+ resource .TestCheckResourceAttrSet (resourceName , "content_moderation_config.0.model_id" ),
172201resource .TestCheckResourceAttrSet (resourceName , "dedicated_ai_cluster_id" ),
173202resource .TestCheckResourceAttr (resourceName , "description" , "description" ),
174203resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName" ),
@@ -196,6 +225,8 @@ func TestGenerativeAiEndpointResource_basic(t *testing.T) {
196225resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
197226resource .TestCheckResourceAttr (resourceName , "content_moderation_config.#" , "1" ),
198227resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.is_enabled" , "true" ),
228+ resource .TestCheckResourceAttr (resourceName , "content_moderation_config.0.mode" , "BLOCK" ),
229+ resource .TestCheckResourceAttrSet (resourceName , "content_moderation_config.0.model_id" ),
199230resource .TestCheckResourceAttrSet (resourceName , "dedicated_ai_cluster_id" ),
200231resource .TestCheckResourceAttr (resourceName , "description" , "description2" ),
201232resource .TestCheckResourceAttr (resourceName , "display_name" , "displayName2" ),
@@ -237,9 +268,10 @@ func TestGenerativeAiEndpointResource_basic(t *testing.T) {
237268compartmentIdVariableStr + GenerativeAiEndpointResourceConfig ,
238269Check : acctest .ComposeAggregateTestCheckFuncWrapper (
239270resource .TestCheckResourceAttrSet (singularDatasourceName , "endpoint_id" ),
240- resource . TestCheckResourceAttr ( singularDatasourceName , "compartment_id" , compartmentId ),
271+
241272resource .TestCheckResourceAttr (singularDatasourceName , "content_moderation_config.#" , "1" ),
242273resource .TestCheckResourceAttr (singularDatasourceName , "content_moderation_config.0.is_enabled" , "true" ),
274+ resource .TestCheckResourceAttr (singularDatasourceName , "content_moderation_config.0.mode" , "BLOCK" ),
243275resource .TestCheckResourceAttr (singularDatasourceName , "description" , "description2" ),
244276resource .TestCheckResourceAttr (singularDatasourceName , "display_name" , "displayName2" ),
245277resource .TestCheckResourceAttr (singularDatasourceName , "freeform_tags.%" , "1" ),
@@ -251,11 +283,14 @@ func TestGenerativeAiEndpointResource_basic(t *testing.T) {
251283},
252284// verify resource import
253285{
254- Config : config + GenerativeAiEndpointRequiredOnlyResource ,
255- ImportState : true ,
256- ImportStateVerify : true ,
257- ImportStateVerifyIgnore : []string {},
258- ResourceName : resourceName ,
286+ Config : config + GenerativeAiEndpointRequiredOnlyResource ,
287+ ImportState : true ,
288+ ImportStateVerify : true ,
289+ ImportStateVerifyIgnore : []string {
290+ "compartment_id" ,
291+ "previous_state" ,
292+ },
293+ ResourceName : resourceName ,
259294},
260295})
261296}
@@ -364,7 +399,7 @@ func getGenerativeAiEndpointIds(compartment string) ([]string, error) {
364399}
365400
366401func GenerativeAiEndpointSweepWaitCondition (response common.OCIOperationResponse ) bool {
367- // Only stop if the resource is ACTIVE beyond 3 mins. As there could be an issue for the sweeper to delete the resource and manual intervention required.
402+ // Only stop if the resource is active beyond 3 mins. As there could be an issue for the sweeper to delete the resource and manual intervention required.
368403if endpointResponse , ok := response .Response .(oci_generative_ai.GetEndpointResponse ); ok {
369404return endpointResponse .LifecycleState != oci_generative_ai .EndpointLifecycleStateDeleted
370405}
0 commit comments