1+ // Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+ // Licensed under the Mozilla Public License v2.0
3+
4+ variable "tenancy_ocid" {
5+
6+ }
7+ variable "user_ocid" {
8+
9+ }
10+ variable "fingerprint" {
11+
12+ }
13+ variable "private_key_path" {
14+
15+ }
16+ variable "region" {
17+ default = " us-ashburn-1"
18+ }
19+ variable "compartment_ocid" {
20+ default = " ocid1.tenancy.oc1..aaaaaaaahzy3x4boh7ipxyft2rowu2xeglvanlfewudbnueugsieyuojkldq"
21+ }
22+
23+ variable "pipeline_configuration_details_command_line_arguments" {
24+ default = " commandLineArguments"
25+
26+ }
27+
28+ variable "pipeline_configuration_details_environment_variables" {
29+ default = {
30+ " environmentVariables" : " environmentVariables"
31+ }
32+ }
33+
34+ variable "pipeline_configuration_details_maximum_runtime_in_minutes" {
35+ default = 20
36+ }
37+
38+ variable "pipeline_configuration_details_type" {
39+ default = " DEFAULT"
40+ }
41+
42+ variable "pipeline_defined_tags_value" {
43+ default = " value"
44+ }
45+
46+ variable "pipeline_description" {
47+ default = " description"
48+ }
49+
50+ variable "pipeline_display_name" {
51+ default = " displayName"
52+ }
53+
54+ variable "pipeline_freeform_tags" {
55+ default = { " Department" = " Finance" }
56+ }
57+
58+ variable "pipeline_id" {
59+ default = " id"
60+ }
61+
62+ variable "pipeline_infrastructure_configuration_details_block_storage_size_in_gbs" {
63+ default = 50
64+ }
65+
66+ variable "pipeline_infrastructure_configuration_details_shape_config_details_memory_in_gbs" {
67+ default = 1.0
68+ }
69+
70+ variable "pipeline_infrastructure_configuration_details_shape_config_details_ocpus" {
71+ default = 1.0
72+ }
73+
74+ variable "pipeline_log_configuration_details_enable_auto_log_creation" {
75+ default = true
76+ }
77+
78+ variable "pipeline_log_configuration_details_enable_logging" {
79+ default = true
80+ }
81+
82+ variable "pipeline_state" {
83+ default = " AVAILABLE"
84+ }
85+
86+ variable "pipeline_step_details_depends_on" {
87+ default = []
88+ }
89+
90+ variable "pipeline_step_details_description" {
91+ default = " description"
92+ }
93+
94+ variable "pipeline_step_details_is_artifact_uploaded" {
95+ default = false
96+ }
97+
98+ variable "pipeline_step_details_step_configuration_details_command_line_arguments" {
99+ default = " commandLineArguments"
100+ }
101+
102+ variable "pipeline_step_details_step_configuration_details_environment_variables" {
103+ default = {
104+ " environmentVariables" : " environmentVariables"
105+ }
106+ }
107+
108+ variable "pipeline_step_details_step_configuration_details_maximum_runtime_in_minutes" {
109+ default = 10
110+ }
111+
112+ variable "pipeline_step_details_step_infrastructure_configuration_details_block_storage_size_in_gbs" {
113+ default = 50
114+ }
115+
116+ variable "pipeline_step_details_step_infrastructure_configuration_details_shape_config_details_memory_in_gbs" {
117+ default = 1.0
118+ }
119+
120+ variable "pipeline_step_details_step_infrastructure_configuration_details_shape_config_details_ocpus" {
121+ default = 1.0
122+ }
123+
124+ variable "pipeline_step_details_step_name" {
125+ default = " stepName"
126+ }
127+
128+ variable "pipeline_step_details_step_type" {
129+ default = " CUSTOM_SCRIPT"
130+ }
131+
132+
133+
134+ provider "oci" {
135+ tenancy_ocid = var. tenancy_ocid
136+ user_ocid = var. user_ocid
137+ fingerprint = var. fingerprint
138+ private_key_path = var. private_key_path
139+ region = var. region
140+ }
141+
142+ resource "oci_datascience_project" "pipeline" {
143+ compartment_id = var. compartment_ocid
144+ }
145+
146+ resource "oci_logging_log_group" "pipeline" {
147+ compartment_id = var. compartment_ocid
148+ display_name = " pipelines"
149+ }
150+
151+
152+ resource "oci_datascience_pipeline" "test_pipeline" {
153+ # Required
154+ compartment_id = var. compartment_ocid
155+ project_id = oci_datascience_project. pipeline . id
156+ delete_related_pipeline_runs = true
157+ step_details {
158+ # Required
159+ step_name = var. pipeline_step_details_step_name
160+ step_type = var. pipeline_step_details_step_type
161+
162+ # Optional
163+ depends_on = var. pipeline_step_details_depends_on
164+ description = var. pipeline_step_details_description
165+ is_artifact_uploaded = var. pipeline_step_details_is_artifact_uploaded
166+ # No Job Id for CUSTOM_SCRIPT
167+ # job_id = oci_datascience_job.test_job.id
168+ step_configuration_details {
169+
170+ # Optional
171+ command_line_arguments = var. pipeline_step_details_step_configuration_details_command_line_arguments
172+ environment_variables = var. pipeline_step_details_step_configuration_details_environment_variables
173+ maximum_runtime_in_minutes = var. pipeline_step_details_step_configuration_details_maximum_runtime_in_minutes
174+ }
175+ step_infrastructure_configuration_details {
176+
177+ # Optional
178+ block_storage_size_in_gbs = var. pipeline_step_details_step_infrastructure_configuration_details_block_storage_size_in_gbs
179+ # shape_config_details {
180+
181+ # #Optional
182+ # memory_in_gbs = var.pipeline_step_details_step_infrastructure_configuration_details_shape_config_details_memory_in_gbs
183+ # ocpus = var.pipeline_step_details_step_infrastructure_configuration_details_shape_config_details_ocpus
184+ # }
185+ shape_name = " VM.Standard2.1"
186+ }
187+ }
188+
189+ # Optional in ML_JOB step type, mandatory for CUSTOM_SCRIPT step type
190+ step_artifact {
191+ step_name = " stepName"
192+ pipeline_step_artifact = " ${ path . root } /pipeline-artifact.py"
193+ artifact_content_length = 1380
194+ artifact_content_disposition = " attachment; filename=pipeline_artifact.py"
195+ }
196+
197+ # Optional
198+ configuration_details {
199+ # Required
200+ type = var. pipeline_configuration_details_type
201+
202+ # Optional
203+ command_line_arguments = var. pipeline_configuration_details_command_line_arguments
204+ environment_variables = var. pipeline_configuration_details_environment_variables
205+ maximum_runtime_in_minutes = var. pipeline_configuration_details_maximum_runtime_in_minutes
206+ }
207+ # defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.pipeline_defined_tags_value)
208+ description = var. pipeline_description
209+ display_name = var. pipeline_display_name
210+ # freeform_tags = var.pipeline_freeform_tags
211+ infrastructure_configuration_details {
212+ # Required
213+ block_storage_size_in_gbs = var. pipeline_infrastructure_configuration_details_block_storage_size_in_gbs
214+ shape_name = " VM.Standard2.1"
215+ # Optional ONLY required if the shape is a flex shape
216+ # shape_config_details {
217+
218+ # #Optional
219+ # memory_in_gbs = var.pipeline_infrastructure_configuration_details_shape_config_details_memory_in_gbs
220+ # ocpus = var.pipeline_infrastructure_configuration_details_shape_config_details_ocpus
221+ # }
222+ }
223+ log_configuration_details {
224+
225+ # Optional
226+ enable_auto_log_creation = var. pipeline_log_configuration_details_enable_auto_log_creation
227+ enable_logging = var. pipeline_log_configuration_details_enable_logging
228+ log_group_id = oci_logging_log_group. pipeline . id
229+ # log_id = oci_logging_log.test_log.id
230+ }
231+ }
232+
233+ resource "oci_logging_log_group" "pipeline_run" {
234+ compartment_id = var. compartment_ocid
235+ display_name = " pipeline_run"
236+ }
237+
238+ resource "oci_datascience_pipeline_run" "test_pipeline_run" {
239+ # Required
240+ compartment_id = var. compartment_ocid
241+ pipeline_id = oci_datascience_pipeline. test_pipeline . id
242+ delete_related_job_runs = true
243+
244+ # Optional
245+ configuration_override_details {
246+ # Required
247+ type = " DEFAULT"
248+
249+ # Optional
250+ command_line_arguments = " CommandLineArgumentsOverride"
251+ environment_variables = {" environmentVariablesOverride" : " environmentVariablesOverride" }
252+ maximum_runtime_in_minutes = 30
253+ }
254+ display_name = " DisplayName1"
255+ log_configuration_override_details {
256+
257+ # Optional
258+ enable_auto_log_creation = true
259+ enable_logging = true
260+ log_group_id = oci_logging_log_group. pipeline_run . id
261+ # log_id = oci_logging_log.test_log.id
262+ }
263+ project_id = oci_datascience_project. pipeline . id
264+ step_override_details {
265+ # Required
266+ step_configuration_details {
267+
268+ # Optional
269+ command_line_arguments = " CommandLineArgumentsStepOverride"
270+ environment_variables = {" environmentVariablesStepOverride" : " environmentVariablesStepOverride" }
271+ maximum_runtime_in_minutes = 30
272+ }
273+ step_name = " stepName"
274+ }
275+ }
0 commit comments