Skip to content

Commit 6dd8e5d

Browse files
Sriram AnanthakrishnanJulia3072
authored andcommitted
Added - Support for ODSC - Nested Resource Principal Support
1 parent 5176eab commit 6dd8e5d

13 files changed

+131
-44
lines changed

examples/datascience/job/job.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ resource "oci_datascience_job" "job" {
6464
artifact_content_length = 1380
6565
artifact_content_disposition = "attachment; filename=job_artifact.py"
6666
delete_related_job_runs = true
67+
# optional parameter
68+
# opc_parent_rpt_url = ""
6769

6870
job_configuration_details {
6971
job_type = "DEFAULT"

examples/datascience/model_deployment/model_deployment.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ variable "model_egress_id" {
211211
resource "oci_datascience_model_deployment" "tf_model_deployment" {
212212
# Required
213213
compartment_id = var.compartment_ocid
214+
# optional parameter
215+
# opc_parent_rpt_url = ""
214216
model_deployment_configuration_details {
215217
# Required
216218
deployment_type = var.model_deployment_model_deployment_configuration_details_deployment_type

examples/datascience/pipeline/pipeline.tf

Lines changed: 90 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ resource "oci_datascience_pipeline" "test_pipeline" {
160160
compartment_id = var.compartment_ocid
161161
project_id = oci_datascience_project.pipeline.id
162162
delete_related_pipeline_runs = true
163+
# optional parameter
164+
# opc_parent_rpt_url = ""
163165
step_details {
164166
#Required
165167
step_name = var.pipeline_step_details_step_name
@@ -228,7 +230,7 @@ resource "oci_datascience_pipeline" "test_pipeline" {
228230
}
229231
log_configuration_details {
230232

231-
#Optional
233+
# Optional
232234
enable_auto_log_creation = var.pipeline_log_configuration_details_enable_auto_log_creation
233235
enable_logging = var.pipeline_log_configuration_details_enable_logging
234236
log_group_id = oci_logging_log_group.pipeline.id
@@ -320,7 +322,7 @@ resource "oci_datascience_pipeline_run" "test_pipeline_run" {
320322
#Optional
321323
log_configuration_override_details {
322324

323-
#Optional
325+
# Optional
324326
enable_auto_log_creation = true
325327
enable_logging = true
326328
log_group_id = oci_logging_log_group.pipeline_run.id
@@ -340,38 +342,90 @@ resource "oci_datascience_pipeline_run" "test_pipeline_run" {
340342
}
341343
}
342344

343-
resource "oci_datascience_pipeline_run" "test_pipeline_run_byoc" {
344-
#Required
345-
compartment_id = var.compartment_ocid
346-
pipeline_id = oci_datascience_pipeline.test_pipeline_byoc.id
347-
delete_related_job_runs = true
348-
349-
display_name = "DisplayNameContainer"
350-
#Optional
351-
log_configuration_override_details {
352-
353-
#Optional
354-
enable_auto_log_creation = false
355-
enable_logging = false
356-
// log_group_id = oci_logging_log_group.pipeline_run.id
357-
# log_id = oci_logging_log.test_log.id
358-
}
359-
project_id = oci_datascience_project.pipeline.id
360-
step_override_details {
361-
#Required
362-
step_configuration_details {
363345

364-
#Optional
365-
command_line_arguments = "CommandLineArgumentsStepOverride"
366-
environment_variables = {"environmentVariablesStepOverride":"environmentVariablesStepOverride"}
367-
maximum_runtime_in_minutes = 30
368-
}
369-
step_name = "stepName"
370-
step_container_configuration_details {
371-
container_type = "OCIR_CONTAINER"
372-
image = "iad.ocir.io/ociodscdev/nested-rp-public-python-sdk-1:1.0"
373-
cmd = ["hello_world.py"]
374-
entrypoint = ["python3"]
375-
}
376-
}
377-
}
346+
## for 2 steps additional example
347+
# locals {
348+
# steps = {
349+
# "step1" = {
350+
# step_name = var.ml_pipeline_step1_name
351+
# step_type = "ML_JOB"
352+
353+
# #Optional
354+
# depends_on = []
355+
# is_artifact_uploaded = "false"
356+
# job_id = var.job_id
357+
# step_configuration_maximum_runtime_in_minutes = 30
358+
# }
359+
# # if step_type = "CUSTOM_SCRIPT" step artifact block has to be added
360+
# # as shown above
361+
# "step2" = {
362+
# step_name = var.ml_pipeline_step2_name
363+
# step_type = "ML_JOB"
364+
365+
# #Optional
366+
# depends_on = [var.ml_pipeline_step1_name]
367+
# is_artifact_uploaded = "true"
368+
# job_id = var.job_id
369+
# step_configuration_maximum_runtime_in_minutes = 30
370+
# }
371+
# }
372+
# }
373+
374+
# resource "oci_datascience_pipeline" "test_pipeline" {
375+
# #Required
376+
# compartment_id = var.compartment_ocid
377+
# project_id = var.project_ocid
378+
379+
380+
# dynamic "step_details" {
381+
# for_each = [for s in local.steps: {
382+
# step_name = s.step_name
383+
# step_type = s.step_type
384+
# step_configuration_maximum_runtime_in_minutes = s.step_configuration_maximum_runtime_in_minutes
385+
# depends_on = s.depends_on
386+
# is_artifact_uploaded = s.is_artifact_uploaded
387+
# job_id = s.job_id
388+
# }]
389+
# content {
390+
# #Required
391+
# step_name = step_details.value["step_name"]
392+
# step_type = step_details.value["step_type"]
393+
394+
# #Optional
395+
# depends_on = step_details.value["depends_on"] == [] ? null : step_details.value["depends_on"]
396+
# is_artifact_uploaded = step_details.value["is_artifact_uploaded"]
397+
# job_id = step_details.value["job_id"]
398+
# step_configuration_details {
399+
# maximum_runtime_in_minutes = step_details.value["step_configuration_maximum_runtime_in_minutes"]
400+
# }
401+
# step_infrastructure_configuration_details {
402+
403+
# #Optional
404+
# block_storage_size_in_gbs = var.block_storage_size_in_gbs
405+
# shape_name = var.shape_name
406+
# }
407+
# }
408+
# }
409+
# #Optional
410+
# configuration_details {
411+
# #Required
412+
# type = "DEFAULT"
413+
# maximum_runtime_in_minutes = 30
414+
# }
415+
416+
# description = var.ml_pipeline_name
417+
# display_name = var.ml_pipeline_name
418+
419+
# infrastructure_configuration_details {
420+
# #Required
421+
# block_storage_size_in_gbs = var.block_storage_size_in_gbs
422+
# shape_name = var.shape_name
423+
# }
424+
# log_configuration_details {
425+
426+
# enable_auto_log_creation = "false"
427+
# enable_logging = "true"
428+
# log_group_id = var.data_science_log_group_id
429+
# log_id = var.data_science_job_log_id
430+
# }
431+
# }

internal/integrationtest/datascience_job_run_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ var (
8484
DatascienceJobRunResourceDependencies = acctest.GenerateDataSourceFromRepresentationMap("oci_core_shapes", "test_shapes", acctest.Required, acctest.Create, CoreCoreShapeDataSourceRepresentation) +
8585
acctest.GenerateResourceFromRepresentationMap("oci_datascience_job", "test_job", acctest.Required, acctest.Create, mlJobWithArtifactNoLogging) +
8686
acctest.GenerateResourceFromRepresentationMap("oci_datascience_project", "test_project", acctest.Required, acctest.Create, DatascienceDatascienceJobShapeDataSourceRepresentation) +
87-
acctest.GenerateResourceFromRepresentationMap("oci_core_subnet", "test_subnet", acctest.Required, acctest.Create, CoreSubnetRepresentation) +
88-
acctest.GenerateResourceFromRepresentationMap("oci_core_vcn", "test_vcn", acctest.Required, acctest.Create, CoreVcnRepresentation) +
8987
DefinedTagsDependencies
9088
)
9189

@@ -168,7 +166,7 @@ func TestDatascienceJobRunResource_basic(t *testing.T) {
168166

169167
func(s *terraform.State) (err error) {
170168
resId, err = acctest.FromInstanceState(s, resourceName, "id")
171-
if isEnableExportCompartment, _ := strconv.ParseBool(utils.GetEnvSettingWithDefault("enable_export_compartment", "true")); isEnableExportCompartment {
169+
if isEnableExportCompartment, _ := strconv.ParseBool(utils.GetEnvSettingWithDefault("enable_export_compartment", "false")); isEnableExportCompartment {
172170
if errExport := resourcediscovery.TestExportCompartmentWithResourceName(&resId, &compartmentId, resourceName); errExport != nil {
173171
return errExport
174172
}

internal/service/datascience/datascience_job_run_resource.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ func DatascienceJobRunResource() *schema.Resource {
219219
},
220220
},
221221
},
222+
"opc_parent_rpt_url": {
223+
Type: schema.TypeString,
224+
Optional: true,
225+
},
222226

223227
// Computed
224228
"created_by": {
@@ -518,6 +522,11 @@ func (s *DatascienceJobRunResourceCrud) Create() error {
518522
}
519523
}
520524

525+
if opcParentRptUrl, ok := s.D.GetOkExists("opc_parent_rpt_url"); ok {
526+
tmp := opcParentRptUrl.(string)
527+
request.OpcParentRptUrl = &tmp
528+
}
529+
521530
if projectId, ok := s.D.GetOkExists("project_id"); ok {
522531
tmp := projectId.(string)
523532
request.ProjectId = &tmp

internal/service/datascience/datascience_model_deployment_resource.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ func DatascienceModelDeploymentResource() *schema.Resource {
490490
Computed: true,
491491
Elem: schema.TypeString,
492492
},
493+
"opc_parent_rpt_url": {
494+
Type: schema.TypeString,
495+
Optional: true,
496+
},
493497
"state": {
494498
Type: schema.TypeString,
495499
Optional: true,
@@ -727,6 +731,11 @@ func (s *DatascienceModelDeploymentResourceCrud) Create() error {
727731
}
728732
}
729733

734+
if opcParentRptUrl, ok := s.D.GetOkExists("opc_parent_rpt_url"); ok {
735+
tmp := opcParentRptUrl.(string)
736+
request.OpcParentRptUrl = &tmp
737+
}
738+
730739
if projectId, ok := s.D.GetOkExists("project_id"); ok {
731740
tmp := projectId.(string)
732741
request.ProjectId = &tmp

internal/service/datascience/datascience_pipeline_resource.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ func DatasciencePipelineResource() *schema.Resource {
7171
"depends_on": {
7272
Type: schema.TypeList,
7373
Optional: true,
74-
Computed: true,
7574
ForceNew: true,
7675
Elem: &schema.Schema{
7776
Type: schema.TypeString,
@@ -86,7 +85,6 @@ func DatasciencePipelineResource() *schema.Resource {
8685
Type: schema.TypeBool,
8786
Optional: true,
8887
Computed: true,
89-
ForceNew: true,
9088
},
9189
"job_id": {
9290
Type: schema.TypeString,
@@ -329,8 +327,6 @@ func DatasciencePipelineResource() *schema.Resource {
329327
Optional: true,
330328
Computed: true,
331329
ForceNew: true,
332-
MaxItems: 1,
333-
MinItems: 1,
334330
Elem: &schema.Resource{
335331
Schema: map[string]*schema.Schema{
336332
"pipeline_step_artifact": {
@@ -348,7 +344,6 @@ func DatasciencePipelineResource() *schema.Resource {
348344
"artifact_content_disposition": {
349345
Type: schema.TypeString,
350346
Optional: true,
351-
Computed: true,
352347
ForceNew: true,
353348
},
354349
// Computed

internal/service/datascience/datascience_pipeline_run_resource.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@ func DatasciencePipelineRunResource() *schema.Resource {
157157
},
158158
},
159159
},
160+
"opc_parent_rpt_url": {
161+
Type: schema.TypeString,
162+
Optional: true,
163+
},
160164
"step_override_details": {
161165
Type: schema.TypeList,
162166
Optional: true,
@@ -535,6 +539,12 @@ func (s *DatasciencePipelineRunResourceCrud) Create() error {
535539
}
536540
}
537541

542+
if opcParentRptUrl, ok := s.D.GetOkExists("opc_parent_rpt_url"); ok {
543+
tmp := opcParentRptUrl.(string)
544+
log.Printf("[INFO] Received opc_parent_rpt_url with value:%s", opcParentRptUrl)
545+
request.OpcParentRptUrl = &tmp
546+
}
547+
538548
if pipelineId, ok := s.D.GetOkExists("pipeline_id"); ok {
539549
tmp := pipelineId.(string)
540550
request.PipelineId = &tmp

website/docs/d/datascience_pipeline.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The following attributes are exported:
5959
* `log_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the log.
6060
* `project_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the project to associate the pipeline with.
6161
* `state` - The current state of the pipeline.
62+
* `delete_related_pipeline_runs` - If set to true will delete pipeline runs which are in a terminal state.
6263
* `step_details` - Array of step details for each step.
6364
* `depends_on` - The list of step names this current step depends on for execution.
6465
* `description` - A short description of the step.

website/docs/d/datascience_pipeline_run.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The following attributes are exported:
6060
* `pipeline_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the pipeline for which pipeline run is created.
6161
* `project_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the project to associate the pipeline run with.
6262
* `state` - The current state of the pipeline run.
63+
* `delete_related_job_runs` - If set to true will delete related job runs.
6364
* `step_override_details` - Array of step override details. Only Step Configuration is allowed to be overridden.
6465
* `step_configuration_details` - The configuration details of a step.
6566
* `command_line_arguments` - The command line arguments to set for step.

0 commit comments

Comments
 (0)