Skip to content

Commit a008df5

Browse files
authored
Merge pull request #967 from terraform-providers/release_merge_v3.61.0
Candidate for release_v3.61.0
2 parents ff3ca7d + d1e31cd commit a008df5

File tree

114 files changed

+10535
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+10535
-24
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
## 3.60.1 (Unreleased)
1+
## 3.61.0 (Unreleased)
2+
3+
### Added
4+
- Support for Data Science service
5+
- Support for Data Catalog Cloud Service
6+
- Support for Data Flow Service
7+
8+
### Fixed
9+
- Address issue where budget resource `time_spend_computed` attribute results in error [Github issue #966](https://github.com/terraform-providers/terraform-provider-oci/issues/966)
10+
211
## 3.60.0 (January 29, 2020)
312

413
### Added

examples/datascience/main.tf

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
// These variables would commonly be defined as environment variables or sourced in a .env file
4+
5+
variable "tenancy_ocid" {}
6+
variable "user_ocid" {}
7+
variable "fingerprint" {}
8+
variable "private_key_path" {}
9+
variable "compartment_ocid" {}
10+
variable "region" {}
11+
12+
provider "oci" {
13+
region = "${var.region}"
14+
tenancy_ocid = "${var.tenancy_ocid}"
15+
user_ocid = "${var.user_ocid}"
16+
fingerprint = "${var.fingerprint}"
17+
private_key_path = "${var.private_key_path}"
18+
}
19+
20+
data "oci_datascience_notebook_session_shapes" "tf_notebook_session_shapes" {
21+
compartment_id = "${var.compartment_ocid}"
22+
}
23+
24+
variable "artifact_content_length" {}
25+
26+
variable "model_artifact" {}
27+
28+
variable "shape" {}
29+
30+
resource "oci_datascience_project" "tf_project" {
31+
#Required
32+
compartment_id = "${var.compartment_ocid}"
33+
34+
#Optional
35+
#defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.project_defined_tags_value}")}"
36+
#description = "${var.project_description}"
37+
#display_name = "${var.project_display_name}"
38+
#freeform_tags = "${var.project_freeform_tags}"
39+
}
40+
41+
data "oci_datascience_projects" "tf_projects" {
42+
#Required
43+
compartment_id = "${var.compartment_ocid}"
44+
45+
#Optional
46+
#created_by = "${var.project_created_by}"
47+
#display_name = "${var.project_display_name}"
48+
#id = "${var.project_id}"
49+
#state = "${var.project_state}"
50+
}
51+
52+
resource "oci_datascience_notebook_session" "tf_notebook_session" {
53+
#Required
54+
compartment_id = "${var.compartment_ocid}"
55+
56+
notebook_session_configuration_details {
57+
#Required
58+
shape = "${var.shape}"
59+
subnet_id = "${oci_core_subnet.tf_subnet.id}"
60+
61+
#Optional
62+
#block_storage_size_in_gbs = "${var.notebook_session_notebook_session_configuration_details_block_storage_size_in_gbs}"
63+
}
64+
65+
project_id = "${oci_datascience_project.tf_project.id}"
66+
67+
#Optional
68+
#defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.notebook_session_defined_tags_value}")}"
69+
#display_name = "${var.notebook_session_display_name}"
70+
#freeform_tags = "${var.notebook_session_freeform_tags}"
71+
}
72+
73+
data "oci_datascience_notebook_sessions" "tf_notebook_sessions" {
74+
#Required
75+
compartment_id = "${var.compartment_ocid}"
76+
77+
#Optional
78+
#created_by = "${var.notebook_session_created_by}"
79+
#display_name = "${var.notebook_session_display_name}"
80+
#id = "${var.notebook_session_id}"
81+
#project_id = "${oci_datascience_project.tf_project.id}"
82+
#state = "${var.notebook_session_state}"
83+
}
84+
85+
resource "oci_datascience_model" "tf_model" {
86+
#Required
87+
artifact_content_length = "${var.artifact_content_length}"
88+
model_artifact = "${var.model_artifact}"
89+
compartment_id = "${var.compartment_ocid}"
90+
project_id = "${oci_datascience_project.tf_project.id}"
91+
92+
#Optional
93+
#defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.model_defined_tags_value}")}"
94+
#description = "${var.model_description}"
95+
#display_name = "${var.model_display_name}"
96+
#freeform_tags = "${var.model_freeform_tags}"
97+
}
98+
99+
data "oci_datascience_models" "tf_models" {
100+
#Required
101+
compartment_id = "${var.compartment_ocid}"
102+
103+
#Optional
104+
#created_by = "${var.model_created_by}"
105+
#display_name = "${var.model_display_name}"
106+
#id = "${var.model_id}"
107+
#project_id = "${oci_datascience_project.tf_project.id}"
108+
#state = "${var.model_state}"
109+
}
110+
111+
resource "oci_datascience_model_provenance" "tf_model_provenance" {
112+
#Required
113+
model_id = "${oci_datascience_model.tf_model.id}"
114+
115+
#Optional
116+
#git_branch = "${var.model_provenance_git_branch}"
117+
#git_commit = "${var.model_provenance_git_commit}"
118+
#repository_url = "${var.model_provenance_repository_url}"
119+
#script_dir = "${var.model_provenance_script_dir}"
120+
#training_script = "${var.model_provenance_training_script}"
121+
}
122+
123+
data "oci_datascience_model_provenance" "tf_model_provenance" {
124+
#Required
125+
model_id = "${oci_datascience_model.tf_model.id}"
126+
}
127+
128+
resource "oci_core_subnet" "tf_subnet" {
129+
cidr_block = "10.0.1.0/24"
130+
compartment_id = "${var.compartment_ocid}"
131+
vcn_id = "${oci_core_vcn.tf_vcn.id}"
132+
}
133+
134+
resource "oci_core_vcn" "tf_vcn" {
135+
cidr_block = "10.0.0.0/16"
136+
compartment_id = "${var.compartment_ocid}"
137+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
77
github.com/hashicorp/terraform v0.12.4-0.20190628193153-a74738cd35fc
88
github.com/mitchellh/cli v1.0.0
9-
github.com/oracle/oci-go-sdk v15.3.0+incompatible
9+
github.com/oracle/oci-go-sdk v15.4.0+incompatible
1010
github.com/stretchr/objx v0.1.1 // indirect
1111
github.com/stretchr/testify v1.3.0
1212
gopkg.in/yaml.v2 v2.2.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ github.com/oracle/oci-go-sdk v15.2.0+incompatible h1:I//vgQYMUJ3M1tHJP7JaxhKD+wV
348348
github.com/oracle/oci-go-sdk v15.2.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
349349
github.com/oracle/oci-go-sdk v15.3.0+incompatible h1:b3/jwxjLAvx1992VxahQhtjjhREiF5SiBmRGb2fs3rM=
350350
github.com/oracle/oci-go-sdk v15.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
351+
github.com/oracle/oci-go-sdk v15.4.0+incompatible h1:340zNuNGctKSrh/hX9dgfstETssSysphXSHXcht+bZo=
352+
github.com/oracle/oci-go-sdk v15.4.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
351353
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y=
352354
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
353355
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=

oci/budget_budget_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (s *BudgetBudgetDataSourceCrud) SetData() error {
113113
}
114114

115115
if s.Res.TimeSpendComputed != nil {
116-
s.D.Set("time_spend_computed", *s.Res.TimeSpendComputed)
116+
s.D.Set("time_spend_computed", s.Res.TimeSpendComputed.String())
117117
}
118118

119119
if s.Res.TimeUpdated != nil {

oci/budget_budget_resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func (s *BudgetBudgetResourceCrud) SetData() error {
385385
}
386386

387387
if s.Res.TimeSpendComputed != nil {
388-
s.D.Set("time_spend_computed", *s.Res.TimeSpendComputed)
388+
s.D.Set("time_spend_computed", s.Res.TimeSpendComputed.String())
389389
}
390390

391391
if s.Res.TimeUpdated != nil {

oci/budget_budgets_data_source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (s *BudgetBudgetsDataSourceCrud) SetData() error {
166166
}
167167

168168
if r.TimeSpendComputed != nil {
169-
budget["time_spend_computed"] = *r.TimeSpendComputed
169+
budget["time_spend_computed"] = r.TimeSpendComputed.String()
170170
}
171171

172172
if r.TimeUpdated != nil {
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
package oci
4+
5+
import (
6+
"context"
7+
8+
"github.com/hashicorp/terraform/helper/schema"
9+
oci_datascience "github.com/oracle/oci-go-sdk/datascience"
10+
)
11+
12+
func DatascienceModelDataSource() *schema.Resource {
13+
fieldMap := make(map[string]*schema.Schema)
14+
fieldMap["model_id"] = &schema.Schema{
15+
Type: schema.TypeString,
16+
Required: true,
17+
}
18+
return GetSingularDataSourceItemSchema(DatascienceModelResource(), fieldMap, readSingularDatascienceModel)
19+
}
20+
21+
func readSingularDatascienceModel(d *schema.ResourceData, m interface{}) error {
22+
sync := &DatascienceModelDataSourceCrud{}
23+
sync.D = d
24+
sync.Client = m.(*OracleClients).dataScienceClient
25+
26+
return ReadResource(sync)
27+
}
28+
29+
type DatascienceModelDataSourceCrud struct {
30+
D *schema.ResourceData
31+
Client *oci_datascience.DataScienceClient
32+
Res *oci_datascience.GetModelResponse
33+
ArtifactHeadRes *HeadModelArtifact
34+
}
35+
36+
func (s *DatascienceModelDataSourceCrud) VoidState() {
37+
s.D.SetId("")
38+
}
39+
40+
func (s *DatascienceModelDataSourceCrud) Get() error {
41+
request := oci_datascience.GetModelRequest{}
42+
43+
if modelId, ok := s.D.GetOkExists("model_id"); ok {
44+
tmp := modelId.(string)
45+
request.ModelId = &tmp
46+
}
47+
48+
request.RequestMetadata.RetryPolicy = getRetryPolicy(false, "datascience")
49+
50+
response, err := s.Client.GetModel(context.Background(), request)
51+
if err != nil {
52+
return err
53+
}
54+
55+
s.Res = &response
56+
headModelArtifactRequest := oci_datascience.HeadModelArtifactRequest{}
57+
58+
if modelId, ok := s.D.GetOkExists("model_id"); ok {
59+
tmp := modelId.(string)
60+
headModelArtifactRequest.ModelId = &tmp
61+
}
62+
63+
headModelArtifactRequest.RequestMetadata.RetryPolicy = getRetryPolicy(false, "datascience")
64+
65+
headModelArtifactResponse, err := s.Client.HeadModelArtifact(context.Background(), headModelArtifactRequest)
66+
if err != nil {
67+
return err
68+
}
69+
70+
s.ArtifactHeadRes = &HeadModelArtifact{
71+
ContentLength: headModelArtifactResponse.ContentLength,
72+
ContentDisposition: headModelArtifactResponse.ContentDisposition,
73+
ContentMd5: headModelArtifactResponse.ContentMd5,
74+
LastModified: headModelArtifactResponse.LastModified,
75+
}
76+
return nil
77+
}
78+
79+
func (s *DatascienceModelDataSourceCrud) SetData() error {
80+
if s.Res == nil {
81+
return nil
82+
}
83+
84+
s.D.SetId(*s.Res.Id)
85+
86+
if s.Res.CompartmentId != nil {
87+
s.D.Set("compartment_id", *s.Res.CompartmentId)
88+
}
89+
90+
if s.Res.CreatedBy != nil {
91+
s.D.Set("created_by", *s.Res.CreatedBy)
92+
}
93+
94+
if s.Res.DefinedTags != nil {
95+
s.D.Set("defined_tags", definedTagsToMap(s.Res.DefinedTags))
96+
}
97+
98+
if s.Res.Description != nil {
99+
s.D.Set("description", *s.Res.Description)
100+
}
101+
102+
if s.Res.DisplayName != nil {
103+
s.D.Set("display_name", *s.Res.DisplayName)
104+
}
105+
106+
s.D.Set("freeform_tags", s.Res.FreeformTags)
107+
108+
if s.Res.ProjectId != nil {
109+
s.D.Set("project_id", *s.Res.ProjectId)
110+
}
111+
112+
s.D.Set("state", s.Res.LifecycleState)
113+
114+
if s.Res.TimeCreated != nil {
115+
s.D.Set("time_created", s.Res.TimeCreated.String())
116+
}
117+
118+
if s.ArtifactHeadRes.ContentDisposition != nil {
119+
s.D.Set("artifact_content_disposition", *s.ArtifactHeadRes.ContentDisposition)
120+
}
121+
122+
if s.ArtifactHeadRes.ContentLength != nil {
123+
s.D.Set("artifact_content_length", *s.ArtifactHeadRes.ContentLength)
124+
}
125+
126+
if s.ArtifactHeadRes.ContentMd5 != nil {
127+
s.D.Set("artifact_content_md5", *s.ArtifactHeadRes.ContentMd5)
128+
}
129+
130+
if s.ArtifactHeadRes.LastModified != nil {
131+
s.D.Set("artifact_last_modified", s.ArtifactHeadRes.LastModified.String())
132+
}
133+
134+
return nil
135+
}

0 commit comments

Comments
 (0)