6060 "master_node" : acctest.RepresentationGroup {RepType : acctest .Required , Group : bdsInstanceNodeFlexShapeRepresentation },
6161 "util_node" : acctest.RepresentationGroup {RepType : acctest .Required , Group : bdsInstanceNodeFlexShapeRepresentation },
6262 "worker_node" : acctest.RepresentationGroup {RepType : acctest .Required , Group : bdsInstanceNodesOdhWorkerRepresentation },
63- "bootstrap_script_url" : acctest.Representation {RepType : acctest .Optional , Create : `${var.bootstrap_script_url}` },
63+ "bootstrap_script_url" : acctest.Representation {RepType : acctest .Optional , Create : `${var.bootstrap_script_url}` , Update : `${var.bootstrap_script_urlU}` },
6464 "compute_only_worker_node" : acctest.RepresentationGroup {RepType : acctest .Required , Group : bdsInstanceNodeFlexShapeRepresentation },
6565 "edge_node" : acctest.RepresentationGroup {RepType : acctest .Required , Group : bdsInstanceNodeFlexShapeRepresentation },
6666
@@ -167,6 +167,9 @@ func TestResourceBdsOdhInstance(t *testing.T) {
167167 bootstrapScriptUrl := utils .GetEnvSettingWithBlankDefault ("bootstrap_script_url" )
168168 bootstrapScriptUrlVariableStr := fmt .Sprintf ("variable \" bootstrap_script_url\" { default = \" %s\" }\n " , bootstrapScriptUrl )
169169
170+ bootstrapScriptUrlU := utils .GetEnvSettingWithBlankDefault ("bootstrap_script_urlU" )
171+ bootstrapScriptUrlUVariableStr := fmt .Sprintf ("variable \" bootstrap_script_urlU\" { default = \" %s\" }\n " , bootstrapScriptUrlU )
172+
170173 resourceName := "oci_bds_bds_instance.test_bds_instance"
171174 datasourceName := "data.oci_bds_bds_instances.test_bds_instances"
172175 singularDatasourceName := "data.oci_bds_bds_instance.test_bds_instance"
@@ -177,10 +180,42 @@ func TestResourceBdsOdhInstance(t *testing.T) {
177180 acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Optional , acctest .Create , bdsInstanceOdhRepresentation ), "bds" , "bdsInstanceOdh" , t )
178181
179182 acctest .ResourceTest (t , testAccCheckBdsBdsInstanceOdhDestroy , []resource.TestStep {
180- // verify Create, cluster will be force stopped after create
183+
184+ // verify Create with required fields
181185 {
182186 Config : config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
183- acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Required , acctest .Create ,
187+ acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Required , acctest .Create , bdsInstanceOdhRepresentation ),
188+ Check : resource .ComposeAggregateTestCheckFunc (
189+ resource .TestCheckResourceAttr (resourceName , "cluster_admin_password" , "T3JhY2xlVGVhbVVTQSExMjM=" ),
190+ resource .TestCheckResourceAttrSet (resourceName , "cluster_public_key" ),
191+ resource .TestCheckResourceAttr (resourceName , "cluster_version" , "ODH1" ),
192+ resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
193+ resource .TestCheckResourceAttr (resourceName , "is_high_availability" , "true" ),
194+ resource .TestCheckResourceAttr (resourceName , "is_secure" , "true" ),
195+ resource .TestCheckResourceAttr (resourceName , "nodes.#" , "11" ),
196+ resource .TestCheckResourceAttrSet (resourceName , "nodes.0.node_type" ),
197+ resource .TestCheckResourceAttrSet (resourceName , "nodes.0.shape" ),
198+ resource .TestCheckResourceAttrSet (resourceName , "nodes.0.subnet_id" ),
199+
200+ func (s * terraform.State ) (err error ) {
201+ resId , err = acctest .FromInstanceState (s , resourceName , "id" )
202+ if isEnableExportCompartment , _ := strconv .ParseBool (utils .GetEnvSettingWithDefault ("enable_export_compartment" , "true" )); isEnableExportCompartment {
203+ if errExport := resourcediscovery .TestExportCompartmentWithResourceName (& resId , & compartmentId , resourceName ); errExport != nil {
204+ return errExport
205+ }
206+ }
207+ return err
208+ },
209+ ),
210+ },
211+ // delete before next Create
212+ {
213+ Config : config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr ,
214+ },
215+ // verify Create, cluster will be force stopped after create
216+ {
217+ Config : config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr +
218+ acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Optional , acctest .Create ,
184219 acctest .RepresentationCopyWithNewProperties (bdsInstanceOdhRepresentation , map [string ]interface {}{
185220 "is_force_stop_jobs" : acctest.Representation {RepType : acctest .Required , Create : `true` },
186221 "state" : acctest.Representation {RepType : acctest .Required , Create : `INACTIVE` },
@@ -207,8 +242,8 @@ func TestResourceBdsOdhInstance(t *testing.T) {
207242
208243 // start the cluster
209244 {
210- Config : config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
211- acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Required , acctest .Create ,
245+ Config : config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr +
246+ acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Optional , acctest .Create ,
212247 acctest .RepresentationCopyWithNewProperties (bdsInstanceOdhRepresentation , map [string ]interface {}{
213248 "is_force_stop_jobs" : acctest.Representation {RepType : acctest .Required , Create : `true` },
214249 "state" : acctest.Representation {RepType : acctest .Required , Create : `ACTIVE` },
@@ -335,7 +370,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
335370
336371 // verify updates to updatable parameters, add a worker, update compute worker flex->regular, update util regular -> flex
337372 {
338- Config : config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies +
373+ Config : config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies +
339374 acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Optional , acctest .Update , bdsInstanceOdhWithRegularComputeAndFlexMasterUtilRepresentation ),
340375 Check : resource .ComposeAggregateTestCheckFunc (
341376 resource .TestCheckResourceAttr (resourceName , "cluster_admin_password" , "T3JhY2xlVGVhbVVTQSExMjM=" ),
@@ -384,7 +419,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
384419 {
385420 Config : config +
386421 acctest .GenerateDataSourceFromRepresentationMap ("oci_bds_bds_instances" , "test_bds_instances" , acctest .Optional , acctest .Update , bdsInstanceOdhDataSourceRepresentation ) +
387- compartmentIdVariableStr + kmsKeyIdUVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
422+ compartmentIdVariableStr + kmsKeyIdUVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + BdsInstanceOdhResourceDependencies +
388423 acctest .GenerateResourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Optional , acctest .Update , bdsInstanceOdhWithRegularComputeAndFlexMasterUtilRepresentation ),
389424 Check : resource .ComposeAggregateTestCheckFunc (
390425 resource .TestCheckResourceAttr (datasourceName , "compartment_id" , compartmentId ),
@@ -409,7 +444,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
409444 {
410445 Config : config +
411446 acctest .GenerateDataSourceFromRepresentationMap ("oci_bds_bds_instance" , "test_bds_instance" , acctest .Required , acctest .Create , bdsInstanceOdhSingularDataSourceRepresentation ) +
412- compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhWithRegularComputeWorkerResourceConfig ,
447+ compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + BdsInstanceOdhWithRegularComputeWorkerResourceConfig ,
413448 Check : resource .ComposeAggregateTestCheckFunc (
414449 resource .TestCheckResourceAttrSet (singularDatasourceName , "bds_instance_id" ),
415450
0 commit comments