Skip to content

Commit cae1caa

Browse files
authored
Merge pull request #1015 from terraform-providers/release_merge_v3.70.0
Candidate for release_v3.70.0
2 parents 94faeb6 + 33c93ea commit cae1caa

File tree

113 files changed

+9361
-2733
lines changed

Some content is hidden

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

113 files changed

+9361
-2733
lines changed

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
## 3.70.0 (Unreleased)
2+
3+
### Added
4+
- Support for non-default profiles for credentials
5+
- Support for limits and usage data source in KMS
6+
- Support for Allowing resources to be moved between compartments in dataflow application
7+
- Support for `InstancePrincipal` and `InstancePrincipalWithCerts` auth mode in Resource discovery
8+
29
## 3.69.0 (April 01, 2020)
310

411
### Added
@@ -23,9 +30,6 @@
2330
- Support for VM 20c Preview in DBAAS
2431
- Support for console connection for db nodes in BM and VM db systems
2532

26-
### Fixed
27-
- Fixed load balancer listener to write default hostnames in state [Github issue #975](https://github.com/terraform-providers/terraform-provider-oci/issues/975)
28-
2933
## 3.66.0 (March 11, 2020)
3034

3135
### Added

examples/api_gateway/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ data "oci_functions_applications" "test_applications" {
266266
state = "${var.application_state}"
267267
}
268268

269-
# Terraform will take 40 minutes after destroying a function due to a known service issue.
270-
# please refer: https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionsdeleting.htm
271269
resource "oci_functions_function" "test_function" {
272270
#Required
273271
application_id = "${oci_functions_application.test_application.id}"

examples/functions/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ data "oci_functions_applications" "test_applications" {
6969
state = "${var.application_state}"
7070
}
7171

72-
# Terraform will take 40 minutes after destroying a function due to a known service issue.
73-
# please refer: https://docs.cloud.oracle.com/iaas/Content/Functions/Tasks/functionsdeleting.htm
7472
resource "oci_functions_function" "test_function" {
7573
#Required
7674
application_id = "${oci_functions_application.test_application.id}"

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 v17.2.0+incompatible
9+
github.com/oracle/oci-go-sdk v17.3.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: 186 additions & 0 deletions
Large diffs are not rendered by default.

oci/core_volume_attachment_resource.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ func CoreVolumeAttachmentResource() *schema.Resource {
3535
ForceNew: true,
3636
DiffSuppressFunc: EqualIgnoreCaseSuppressDiff,
3737
ValidateFunc: validation.StringInSlice([]string{
38+
"emulated",
3839
"iscsi",
3940
"paravirtualized",
4041
}, true),
@@ -242,6 +243,50 @@ func (s *CoreVolumeAttachmentResourceCrud) Delete() error {
242243

243244
func (s *CoreVolumeAttachmentResourceCrud) SetData() error {
244245
switch v := (*s.Res).(type) {
246+
case oci_core.EmulatedVolumeAttachment:
247+
s.D.Set("attachment_type", "emulated")
248+
249+
if v.AvailabilityDomain != nil {
250+
s.D.Set("availability_domain", *v.AvailabilityDomain)
251+
}
252+
253+
if v.CompartmentId != nil {
254+
s.D.Set("compartment_id", *v.CompartmentId)
255+
}
256+
257+
if v.Device != nil {
258+
s.D.Set("device", *v.Device)
259+
}
260+
261+
if v.DisplayName != nil {
262+
s.D.Set("display_name", *v.DisplayName)
263+
}
264+
265+
if v.Id != nil {
266+
s.D.Set("id", *v.Id)
267+
}
268+
269+
if v.InstanceId != nil {
270+
s.D.Set("instance_id", *v.InstanceId)
271+
}
272+
273+
if v.IsPvEncryptionInTransitEnabled != nil {
274+
s.D.Set("is_pv_encryption_in_transit_enabled", *v.IsPvEncryptionInTransitEnabled)
275+
}
276+
277+
if v.IsReadOnly != nil {
278+
s.D.Set("is_read_only", *v.IsReadOnly)
279+
}
280+
281+
s.D.Set("state", v.LifecycleState)
282+
283+
if v.TimeCreated != nil {
284+
s.D.Set("time_created", v.TimeCreated.String())
285+
}
286+
287+
if v.VolumeId != nil {
288+
s.D.Set("volume_id", *v.VolumeId)
289+
}
245290
case oci_core.IScsiVolumeAttachment:
246291
s.D.Set("attachment_type", "iscsi")
247292

@@ -367,6 +412,33 @@ func (s *CoreVolumeAttachmentResourceCrud) populateTopLevelPolymorphicAttachVolu
367412
attachmentType = "" // default value
368413
}
369414
switch strings.ToLower(attachmentType) {
415+
case strings.ToLower("emulated"):
416+
details := oci_core.AttachEmulatedVolumeDetails{}
417+
if device, ok := s.D.GetOkExists("device"); ok {
418+
tmp := device.(string)
419+
details.Device = &tmp
420+
}
421+
if displayName, ok := s.D.GetOkExists("display_name"); ok {
422+
tmp := displayName.(string)
423+
details.DisplayName = &tmp
424+
}
425+
if instanceId, ok := s.D.GetOkExists("instance_id"); ok {
426+
tmp := instanceId.(string)
427+
details.InstanceId = &tmp
428+
}
429+
if isReadOnly, ok := s.D.GetOkExists("is_read_only"); ok {
430+
tmp := isReadOnly.(bool)
431+
details.IsReadOnly = &tmp
432+
}
433+
if isShareable, ok := s.D.GetOkExists("is_shareable"); ok {
434+
tmp := isShareable.(bool)
435+
details.IsShareable = &tmp
436+
}
437+
if volumeId, ok := s.D.GetOkExists("volume_id"); ok {
438+
tmp := volumeId.(string)
439+
details.VolumeId = &tmp
440+
}
441+
request.AttachVolumeDetails = details
370442
case strings.ToLower("iscsi"):
371443
details := oci_core.AttachIScsiVolumeDetails{}
372444
if useChap, ok := s.D.GetOkExists("use_chap"); ok {

oci/core_volume_attachments_data_source.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,50 @@ func (s *CoreVolumeAttachmentsDataSourceCrud) SetData() error {
119119
for _, r := range s.Res.Items {
120120
result := map[string]interface{}{}
121121
switch v := (r).(type) {
122+
case oci_core.EmulatedVolumeAttachment:
123+
result["attachment_type"] = "emulated"
124+
125+
if v.AvailabilityDomain != nil {
126+
result["availability_domain"] = string(*v.AvailabilityDomain)
127+
}
128+
129+
if v.CompartmentId != nil {
130+
result["compartment_id"] = string(*v.CompartmentId)
131+
}
132+
133+
if v.Device != nil {
134+
result["device"] = string(*v.Device)
135+
}
136+
137+
if v.DisplayName != nil {
138+
result["display_name"] = string(*v.DisplayName)
139+
}
140+
141+
if v.Id != nil {
142+
result["id"] = string(*v.Id)
143+
}
144+
145+
if v.InstanceId != nil {
146+
result["instance_id"] = string(*v.InstanceId)
147+
}
148+
149+
if v.IsPvEncryptionInTransitEnabled != nil {
150+
result["is_pv_encryption_in_transit_enabled"] = bool(*v.IsPvEncryptionInTransitEnabled)
151+
}
152+
153+
if v.IsReadOnly != nil {
154+
result["is_read_only"] = bool(*v.IsReadOnly)
155+
}
156+
157+
result["state"] = string(v.LifecycleState)
158+
159+
if v.TimeCreated != nil {
160+
result["time_created"] = v.TimeCreated.String()
161+
}
162+
163+
if v.VolumeId != nil {
164+
result["volume_id"] = string(*v.VolumeId)
165+
}
122166
case oci_core.IScsiVolumeAttachment:
123167
result["attachment_type"] = "iscsi"
124168

oci/crud_helpers.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,26 @@ func elaspedInMillisecond(start time.Time) int64 {
812812
return time.Since(start).Nanoseconds() / int64(time.Millisecond)
813813
}
814814

815-
func WaitForWorkRequestWithErrorHandling(workRequestClient *oci_work_requests.WorkRequestClient, workRequestId *string, entityType string, action oci_work_requests.WorkRequestResourceActionTypeEnum,
815+
func WaitForWorkRequestWithErrorHandling(workRequestClient *oci_work_requests.WorkRequestClient, workRequestIds *string, entityType string, action oci_work_requests.WorkRequestResourceActionTypeEnum,
816816
timeout time.Duration, disableFoundRetries bool) (*string, error) {
817-
return WaitForWorkRequest(workRequestClient, workRequestId, entityType, action, timeout, disableFoundRetries, true)
817+
var identifier *string
818+
workRequestIdsSet := map[string]bool{}
819+
820+
for _, wId := range strings.Split(strings.TrimSpace(*workRequestIds), ",") {
821+
if wId != "" {
822+
workRequestIdsSet[strings.TrimSpace(wId)] = true
823+
}
824+
}
825+
826+
for wId := range workRequestIdsSet {
827+
id, err := WaitForWorkRequest(workRequestClient, &wId, entityType, action, timeout, disableFoundRetries, true)
828+
if err != nil {
829+
return nil, err
830+
}
831+
identifier = id
832+
}
833+
return identifier, nil
834+
818835
}
819836

820837
func WaitForWorkRequest(workRequestClient *oci_work_requests.WorkRequestClient, workRequestId *string, entityType string, action oci_work_requests.WorkRequestResourceActionTypeEnum,

oci/dataflow_application_resource.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func DataflowApplicationResource() *schema.Resource {
3030
"compartment_id": {
3131
Type: schema.TypeString,
3232
Required: true,
33-
ForceNew: true,
3433
},
3534
"display_name": {
3635
Type: schema.TypeString,
@@ -357,6 +356,15 @@ func (s *DataflowApplicationResourceCrud) Get() error {
357356
}
358357

359358
func (s *DataflowApplicationResourceCrud) Update() error {
359+
if compartment, ok := s.D.GetOkExists("compartment_id"); ok && s.D.HasChange("compartment_id") {
360+
oldRaw, newRaw := s.D.GetChange("compartment_id")
361+
if newRaw != "" && oldRaw != "" {
362+
err := s.updateCompartment(compartment)
363+
if err != nil {
364+
return err
365+
}
366+
}
367+
}
360368
request := oci_dataflow.UpdateApplicationRequest{}
361369

362370
tmp := s.D.Id()
@@ -598,3 +606,21 @@ func ApplicationParameterToMap(obj oci_dataflow.ApplicationParameter) map[string
598606

599607
return result
600608
}
609+
610+
func (s *DataflowApplicationResourceCrud) updateCompartment(compartment interface{}) error {
611+
changeCompartmentRequest := oci_dataflow.ChangeApplicationCompartmentRequest{}
612+
613+
idTmp := s.D.Id()
614+
changeCompartmentRequest.ApplicationId = &idTmp
615+
616+
compartmentTmp := compartment.(string)
617+
changeCompartmentRequest.CompartmentId = &compartmentTmp
618+
619+
changeCompartmentRequest.RequestMetadata.RetryPolicy = getRetryPolicy(s.DisableNotFoundRetries, "dataflow")
620+
621+
_, err := s.Client.ChangeApplicationCompartment(context.Background(), changeCompartmentRequest)
622+
if err != nil {
623+
return err
624+
}
625+
return nil
626+
}

oci/dataflow_application_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ func TestDataflowApplicationResource_basic(t *testing.T) {
7474
compartmentId := getEnvSettingWithBlankDefault("compartment_ocid")
7575
compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId)
7676

77+
compartmentIdU := getEnvSettingWithDefault("compartment_id_for_update", compartmentId)
78+
compartmentIdUVariableStr := fmt.Sprintf("variable \"compartment_id_for_update\" { default = \"%s\" }\n", compartmentIdU)
7779
fileUri := getEnvSettingWithBlankDefault("dataflow_file_uri")
7880
fileUriUpdated := getEnvSettingWithBlankDefault("dataflow_file_uri_updated")
7981
fileUriVariableStr := fmt.Sprintf("variable \"dataflow_file_uri\" { default = \"%s\" }\n", fileUri)
@@ -164,6 +166,48 @@ func TestDataflowApplicationResource_basic(t *testing.T) {
164166
),
165167
},
166168

169+
// verify update to the compartment (the compartment will be switched back in the next step)
170+
{
171+
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + ApplicationResourceDependencies + fileUriVariableStr + warehouseBucketUriVariableStr + logsBucketUriVariableStr +
172+
generateResourceFromRepresentationMap("oci_dataflow_application", "test_application", Optional, Create,
173+
representationCopyWithNewProperties(dataFlowApplicationRepresentation, map[string]interface{}{
174+
"compartment_id": Representation{repType: Required, create: `${var.compartment_id_for_update}`},
175+
})),
176+
Check: resource.ComposeAggregateTestCheckFunc(
177+
resource.TestCheckResourceAttr(resourceName, "arguments.#", "1"),
178+
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentIdU),
179+
resource.TestCheckResourceAttr(resourceName, "configuration.%", "1"),
180+
resource.TestCheckResourceAttr(resourceName, "defined_tags.%", "1"),
181+
resource.TestCheckResourceAttr(resourceName, "description", "description"),
182+
resource.TestCheckResourceAttr(resourceName, "display_name", "test_wordcount_app"),
183+
resource.TestCheckResourceAttr(resourceName, "driver_shape", "VM.Standard2.1"),
184+
resource.TestCheckResourceAttr(resourceName, "executor_shape", "VM.Standard2.1"),
185+
resource.TestCheckResourceAttrSet(resourceName, "file_uri"),
186+
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
187+
resource.TestCheckResourceAttrSet(resourceName, "id"),
188+
resource.TestCheckResourceAttr(resourceName, "language", "PYTHON"),
189+
resource.TestCheckResourceAttrSet(resourceName, "logs_bucket_uri"),
190+
resource.TestCheckResourceAttr(resourceName, "num_executors", "1"),
191+
resource.TestCheckResourceAttrSet(resourceName, "owner_principal_id"),
192+
resource.TestCheckResourceAttr(resourceName, "parameters.#", "1"),
193+
resource.TestCheckResourceAttr(resourceName, "parameters.0.name", "name"),
194+
resource.TestCheckResourceAttr(resourceName, "parameters.0.value", "value"),
195+
resource.TestCheckResourceAttr(resourceName, "spark_version", "2.4"),
196+
resource.TestCheckResourceAttrSet(resourceName, "state"),
197+
resource.TestCheckResourceAttrSet(resourceName, "time_created"),
198+
resource.TestCheckResourceAttrSet(resourceName, "time_updated"),
199+
resource.TestCheckResourceAttrSet(resourceName, "warehouse_bucket_uri"),
200+
201+
func(s *terraform.State) (err error) {
202+
resId2, err = fromInstanceState(s, resourceName, "id")
203+
if resId != resId2 {
204+
return fmt.Errorf("resource recreated when it was supposed to be updated")
205+
}
206+
return err
207+
},
208+
),
209+
},
210+
167211
// verify updates to updatable parameters
168212
{
169213
Config: config + compartmentIdVariableStr + fileUriVariableStr + classNameStrUpdated + fileUriVariableStrUpdated + logsBucketUriVariableStr + warehouseBucketUriVariableStr + dataFlowApplicationResourceDependencies +

0 commit comments

Comments
 (0)