Skip to content

Commit 931b55d

Browse files
authored
Merge pull request #1142 from terraform-providers/release_merge_v3.89.0
Release merge v3.89.0
2 parents 4d8c08e + 7f6f9c2 commit 931b55d

File tree

113 files changed

+1921
-385
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

+1921
-385
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
## 3.89.0 (Unreleased)
2+
3+
### Added
4+
- Object Lifecycle Management support for Multipart Uploads Cleanup
5+
- Support for Autonomous JSON database added
6+
- Support resource discovery for Blockchain resources
7+
- Support Data Catalog 1.0.3 Release
8+
- Support for change network access in Autonomous Database private endpoint
9+
10+
### Fixed
11+
- Fix cross-region copy work request lookup for `oci_objectstorage_object`
12+
213
## 3.88.0 (August 05, 2020)
314

415
### Added

examples/database/adb/autonomous_database.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ resource "oci_database_autonomous_database" "autonomous_database" {
4141
whitelisted_ips = ["1.1.1.1/28"]
4242
}
4343

44+
resource "oci_database_autonomous_database" "test_autonomous_database" {
45+
admin_password = "${random_string.autonomous_database_admin_password.result}"
46+
compartment_id = "${var.compartment_ocid}"
47+
cpu_core_count = "1"
48+
data_storage_size_in_tbs = "1"
49+
db_name = "adbdb11"
50+
db_version = "19c"
51+
db_workload = "AJD"
52+
license_model = "LICENSE_INCLUDED"
53+
is_free_tier = "false"
54+
}
55+
4456
resource "oci_database_autonomous_database_backup" "autonomous_database_backup" {
4557
#Required
4658
autonomous_database_id = "${oci_database_autonomous_database.autonomous_database.id}"

examples/datacatalog/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ data "oci_datacatalog_catalogs" test_oci_datacatalog_catalogs {
3939

4040
resource "oci_datacatalog_data_asset" test_oci_datacatalog_dataAsset {
4141
display_name = "test_data_assets"
42-
type_key = "${data.oci_datacatalog_catalog_types.test_catalog_types_dataAsset.type_collection.0.key}"
42+
type_key = "${data.oci_datacatalog_catalog_types.test_catalog_types_dataAsset.type_collection.0.items.0.key}"
4343
catalog_id = "${oci_datacatalog_catalog.test_oci_datacatalog_catalog.id}"
4444

4545
properties {
@@ -52,7 +52,7 @@ resource "oci_datacatalog_data_asset" test_oci_datacatalog_dataAsset {
5252
#
5353
resource "oci_datacatalog_connection" test_connection {
5454
catalog_id = "${oci_datacatalog_catalog.test_oci_datacatalog_catalog.id}"
55-
type_key = "${data.oci_datacatalog_catalog_types.test_catalog_types_connection.type_collection.0.key}"
55+
type_key = "${data.oci_datacatalog_catalog_types.test_catalog_types_connection.type_collection.0.items.0.key}"
5656
data_asset_key = "${oci_datacatalog_data_asset.test_oci_datacatalog_dataAsset.id}"
5757
display_name = "connection_name"
5858

examples/load_balancer/lb_full/lb_full.tf

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,18 @@ resource "oci_load_balancer" "lb1" {
232232
display_name = "lb1"
233233
}
234234

235+
resource "oci_load_balancer" "lb2" {
236+
shape = "100Mbps"
237+
compartment_id = "${var.compartment_ocid}"
238+
239+
subnet_ids = [
240+
"${oci_core_subnet.subnet1.id}",
241+
"${oci_core_subnet.subnet2.id}",
242+
]
243+
244+
display_name = "lb1"
245+
}
246+
235247
resource "oci_load_balancer_backend_set" "lb-bes1" {
236248
name = "lb-bes1"
237249
load_balancer_id = "${oci_load_balancer.lb1.id}"
@@ -245,6 +257,19 @@ resource "oci_load_balancer_backend_set" "lb-bes1" {
245257
}
246258
}
247259

260+
resource "oci_load_balancer_backend_set" "lb-bes2" {
261+
name = "lb-bes1"
262+
load_balancer_id = "${oci_load_balancer.lb2.id}"
263+
policy = "ROUND_ROBIN"
264+
265+
health_checker {
266+
port = "80"
267+
protocol = "TCP"
268+
response_body_regex = ".*"
269+
url_path = "/"
270+
}
271+
}
272+
248273
resource "oci_load_balancer_certificate" "lb-cert1" {
249274
load_balancer_id = "${oci_load_balancer.lb1.id}"
250275
ca_certificate = "-----BEGIN CERTIFICATE-----\nMIIC9jCCAd4CCQD2rPUVJETHGzANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQGEwJV\nUzELMAkGA1UECAwCV0ExEDAOBgNVBAcMB1NlYXR0bGUxDzANBgNVBAoMBk9yYWNs\nZTAeFw0xOTAxMTcyMjU4MDVaFw0yMTAxMTYyMjU4MDVaMD0xCzAJBgNVBAYTAlVT\nMQswCQYDVQQIDAJXQTEQMA4GA1UEBwwHU2VhdHRsZTEPMA0GA1UECgwGT3JhY2xl\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA30+wt7OlUB/YpmWbTRkx\nnLG0lKWiV+oupNKj8luXmC5jvOFTUejt1pQhpA47nCqywlOAfk2N8hJWTyJZUmKU\n+DWVV2So2B/obYxpiiyWF2tcF/cYi1kBYeAIu5JkVFwDe4ITK/oQUFEhIn3Qg/oC\nMQ2985/MTdCXONgnbmePU64GrJwfvOeJcQB3VIL1BBfISj4pPw5708qTRv5MJBOO\njLKRM68KXC5us4879IrSA77NQr1KwjGnQlykyCgGvvgwgrUTd5c/dH8EKrZVcFi6\nytM66P/1CTpk1YpbI4gqiG0HBbuXG4JRIjyzW4GT4JXeSjgvrkIYL8k/M4Az1WEc\n2wIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAuI53m8Va6EafDi6GQdQrzNNQFCAVQ\nxIABAB0uaSYCs3H+pqTktHzOrOluSUEogXRl0UU5/OuvxAz4idA4cfBdId4i7AcY\nqZsBjA/xqH/rxR3pcgfaGyxQzrUsJFf0ZwnzqYJs7fUvuatHJYi/cRBxrKR2+4Oj\nlUbb9TSmezlzHK5CaD5XzN+lZqbsSvN3OQbOryJCbtjZVQFGZ1SmL6OLrwpbBKuP\nn2ob+gaP57YSzO3zk1NDXMlQPHRsdSOqocyKx8y+7J0g6MqPvBzIe+wI3QW85MQY\nj1/IHmj84LNGp7pHCyiYx/oI+00gRch04H2pJv0TP3sAQ37gplBwDrUo\n-----END CERTIFICATE-----"
@@ -316,12 +341,11 @@ resource "oci_load_balancer_listener" "lb-listener2" {
316341
}
317342

318343
resource "oci_load_balancer_listener" "lb-listener3" {
319-
load_balancer_id = "${oci_load_balancer.lb1.id}"
344+
load_balancer_id = "${oci_load_balancer.lb2.id}"
320345
name = "tcp"
321-
default_backend_set_name = "${oci_load_balancer_backend_set.lb-bes1.name}"
346+
default_backend_set_name = "${oci_load_balancer_backend_set.lb-bes2.name}"
322347
port = 80
323348
protocol = "TCP"
324-
rule_set_names = ["${oci_load_balancer_rule_set.test_rule_set.name}"]
325349

326350
connection_configuration {
327351
idle_timeout_in_seconds = "2"

examples/object_storage/bucket.tf

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,6 @@ resource "oci_objectstorage_bucket" "bucket_with_versioning" {
2020
versioning = "Suspended"
2121
}
2222

23-
resource "oci_objectstorage_object_lifecycle_policy" "lifecyclePolicy1" {
24-
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
25-
bucket = "${oci_objectstorage_bucket.bucket1.name}"
26-
27-
#Optional
28-
rules {
29-
#Required
30-
action = "ARCHIVE"
31-
is_enabled = "true"
32-
name = "test-rule-1"
33-
time_amount = "10"
34-
time_unit = "DAYS"
35-
36-
#Optional
37-
object_name_filter {
38-
#Optional
39-
inclusion_prefixes = ["my-test"]
40-
}
41-
}
42-
}
43-
4423
data "oci_objectstorage_bucket_summaries" "buckets1" {
4524
compartment_id = "${var.compartment_ocid}"
4625
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
@@ -55,17 +34,6 @@ output buckets {
5534
value = "${data.oci_objectstorage_bucket_summaries.buckets1.bucket_summaries}"
5635
}
5736

58-
data "oci_objectstorage_object_lifecycle_policy" "lifecyclePolicies1" {
59-
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
60-
bucket = "${oci_objectstorage_bucket.bucket1.name}"
61-
62-
depends_on = ["oci_objectstorage_object_lifecycle_policy.lifecyclePolicy1"]
63-
}
64-
65-
output lifecyclePolicies1 {
66-
value = "${data.oci_objectstorage_object_lifecycle_policy.lifecyclePolicies1.rules}"
67-
}
68-
6937
data "oci_objectstorage_object_versions" "test_object_versions1" {
7038
#Required
7139
bucket = "${oci_objectstorage_bucket.bucket1.name}"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
/*
5+
* This example shows how to add lifeCyclePolicyRules to a bucket
6+
*/
7+
8+
variable "tenancy_ocid" {}
9+
variable "user_ocid" {}
10+
variable "fingerprint" {}
11+
variable "private_key_path" {}
12+
variable "region" {}
13+
variable "compartment_ocid" {}
14+
15+
data "oci_objectstorage_namespace" "ns" {
16+
#Optional
17+
compartment_id = "${var.compartment_ocid}"
18+
}
19+
20+
resource "oci_objectstorage_bucket" "bucket_with_lifeCyclePolicyRule" {
21+
compartment_id = "${var.compartment_ocid}"
22+
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
23+
name = "tf-example-bucket-lifecyclerule"
24+
access_type = "NoPublicAccess"
25+
}
26+
27+
resource "oci_objectstorage_object_lifecycle_policy" "lifecyclePolicy" {
28+
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
29+
bucket = "${oci_objectstorage_bucket.bucket_with_lifeCyclePolicyRule.name}"
30+
31+
#Optional
32+
rules {
33+
#Required
34+
action = "ARCHIVE"
35+
is_enabled = "true"
36+
name = "test-rule-1"
37+
time_amount = "10"
38+
time_unit = "DAYS"
39+
40+
#Optional
41+
object_name_filter {
42+
#Optional
43+
inclusion_prefixes = ["my-test"]
44+
}
45+
46+
target = "objects"
47+
}
48+
49+
#Optional
50+
rules {
51+
#Required
52+
action = "ABORT"
53+
is_enabled = "true"
54+
name = "test-rule-1"
55+
time_amount = "10"
56+
time_unit = "DAYS"
57+
58+
#Optional
59+
target = "multipart-uploads"
60+
}
61+
}
62+
63+
data "oci_objectstorage_object_lifecycle_policy" "lifecyclePolicies" {
64+
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
65+
bucket = "${oci_objectstorage_bucket.bucket_with_lifeCyclePolicyRule.name}"
66+
67+
depends_on = ["oci_objectstorage_object_lifecycle_policy.lifecyclePolicy"]
68+
}
69+
70+
output lifecyclePolicies {
71+
value = "${data.oci_objectstorage_object_lifecycle_policy.lifecyclePolicies.rules}"
72+
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ require (
77
github.com/hashicorp/hcl2 v0.0.0-20190618163856-0b64543c968c
88
github.com/hashicorp/terraform v0.12.4-0.20190628193153-a74738cd35fc
99
github.com/mitchellh/cli v1.0.0
10-
github.com/oracle/oci-go-sdk v23.0.0+incompatible
10+
github.com/oracle/oci-go-sdk v24.0.0+incompatible
1111
github.com/stretchr/objx v0.1.1 // indirect
12-
github.com/stretchr/testify v1.3.0
12+
github.com/stretchr/testify v1.6.1
1313
gopkg.in/yaml.v2 v2.2.2
1414
)
1515

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W
425425
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
426426
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
427427
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
428+
github.com/oracle/oci-go-sdk v0.0.0-20200811173458-2fac26f18f4c h1:LM+cqkI634VnhWkCzQXaDEptSXHLbEqCWquyuYFhnr4=
429+
github.com/oracle/oci-go-sdk v0.0.0-20200811173458-2fac26f18f4c/go.mod h1:fVMpuTsNzaRf5tkaarJqsBLBgr0U94Ohv7XTCuVuZUc=
428430
github.com/oracle/oci-go-sdk v16.0.0+incompatible h1:4BbhAM6wz7u9vtYrBMCPeQ2oRV9oaaqsHenErPvpQs4=
429431
github.com/oracle/oci-go-sdk v16.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
430432
github.com/oracle/oci-go-sdk v17.0.0+incompatible h1:VueI9WISwu2+GwYd2WzuFO+M7ufSnpA707MooU+8xNs=
@@ -467,6 +469,8 @@ github.com/oracle/oci-go-sdk v22.0.0+incompatible h1:EDi5Hji0AVU3HVw6B8smL35EBCo
467469
github.com/oracle/oci-go-sdk v22.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
468470
github.com/oracle/oci-go-sdk v23.0.0+incompatible h1:Mgz+YySzvjWktkuGFrm1EYEzWy5k5QI2Jq8S6yecSjo=
469471
github.com/oracle/oci-go-sdk v23.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
472+
github.com/oracle/oci-go-sdk v24.0.0+incompatible h1:jxLCpNGS9D7l7PW/t1tJAYxxj+xE+3VO/Ka3PvASAKA=
473+
github.com/oracle/oci-go-sdk v24.0.0+incompatible/go.mod h1:fVMpuTsNzaRf5tkaarJqsBLBgr0U94Ohv7XTCuVuZUc=
470474
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y=
471475
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
472476
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=
@@ -550,6 +554,8 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0
550554
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
551555
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
552556
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
557+
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
558+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
553559
github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d h1:Z4EH+5EffvBEhh37F0C0DnpklTMh00JOkjW5zK3ofBI=
554560
github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw=
555561
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
@@ -757,6 +763,8 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
757763
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
758764
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
759765
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
766+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
767+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
760768
grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o=
761769
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
762770
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

oci/blockchain_osn_resource.go

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"context"
88
"fmt"
99
"log"
10+
"net/url"
11+
"regexp"
1012
"strings"
1113
"time"
1214

@@ -116,7 +118,7 @@ type BlockchainOsnResourceCrud struct {
116118
}
117119

118120
func (s *BlockchainOsnResourceCrud) ID() string {
119-
return *s.Res.OsnKey
121+
return getOsnCompositeId(s.D.Get("blockchain_platform_id").(string), *s.Res.OsnKey)
120122
}
121123

122124
func (s *BlockchainOsnResourceCrud) CreatedTarget() []string {
@@ -293,6 +295,14 @@ func (s *BlockchainOsnResourceCrud) Get() error {
293295
tmp := s.D.Id()
294296
request.OsnId = &tmp
295297

298+
blockchainPlatformId, osnId, err := parseOsnCompositeId(s.D.Id())
299+
if err == nil {
300+
request.BlockchainPlatformId = &blockchainPlatformId
301+
request.OsnId = &osnId
302+
} else {
303+
log.Printf("[WARN] Get() unable to parse current ID: %s", s.D.Id())
304+
}
305+
296306
request.RequestMetadata.RetryPolicy = getRetryPolicy(s.DisableNotFoundRetries, "blockchain")
297307

298308
response, err := s.Client.GetOsn(context.Background(), request)
@@ -310,6 +320,15 @@ func (s *BlockchainOsnResourceCrud) Delete() error {
310320
}
311321

312322
func (s *BlockchainOsnResourceCrud) SetData() error {
323+
324+
blockchainPlatformId, osnId, err := parseOsnCompositeId(s.D.Id())
325+
if err == nil {
326+
s.D.Set("blockchain_platform_id", &blockchainPlatformId)
327+
s.D.SetId(osnId)
328+
} else {
329+
log.Printf("[WARN] SetData() unable to parse current ID: %s", s.D.Id())
330+
}
331+
313332
s.D.Set("ad", s.Res.Ad)
314333

315334
if s.Res.OcpuAllocationParam != nil {
@@ -327,6 +346,25 @@ func (s *BlockchainOsnResourceCrud) SetData() error {
327346
return nil
328347
}
329348

349+
func getOsnCompositeId(blockchainPlatformId string, osnId string) string {
350+
blockchainPlatformId = url.PathEscape(blockchainPlatformId)
351+
osnId = url.PathEscape(osnId)
352+
compositeId := "blockchainPlatforms/" + blockchainPlatformId + "/osns/" + osnId
353+
return compositeId
354+
}
355+
356+
func parseOsnCompositeId(compositeId string) (blockchainPlatformId string, osnId string, err error) {
357+
parts := strings.Split(compositeId, "/")
358+
match, _ := regexp.MatchString("blockchainPlatforms/.*/osns/.*", compositeId)
359+
if !match || len(parts) != 4 {
360+
err = fmt.Errorf("illegal compositeId %s encountered", compositeId)
361+
return
362+
}
363+
blockchainPlatformId, _ = url.PathUnescape(parts[1])
364+
osnId, _ = url.PathUnescape(parts[3])
365+
return
366+
}
367+
330368
func (s *BlockchainOsnResourceCrud) mapToOcpuAllocationNumberParam(fieldKeyFormat string) (oci_blockchain.OcpuAllocationNumberParam, error) {
331369
result := oci_blockchain.OcpuAllocationNumberParam{}
332370

oci/blockchain_osn_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestBlockchainOsnResource_basic(t *testing.T) {
6868
datasourceName := "data.oci_blockchain_osns.test_osns"
6969
singularDatasourceName := "data.oci_blockchain_osn.test_osn"
7070

71-
var resId, resId2 string
71+
var resId, resId2, compositeId string
7272

7373
resource.Test(t, resource.TestCase{
7474
PreCheck: func() { testAccPreCheck(t) },
@@ -109,8 +109,10 @@ func TestBlockchainOsnResource_basic(t *testing.T) {
109109

110110
func(s *terraform.State) (err error) {
111111
resId, err = fromInstanceState(s, resourceName, "id")
112+
blockchainPlatformId, _ := fromInstanceState(s, resourceName, "blockchain_platform_id")
113+
compositeId = "blockchainPlatforms/" + blockchainPlatformId + "/osns/" + resId
112114
if isEnableExportCompartment, _ := strconv.ParseBool(getEnvSettingWithDefault("enable_export_compartment", "false")); isEnableExportCompartment {
113-
if errExport := testExportCompartmentWithResourceName(&resId, &compartmentId, resourceName); errExport != nil {
115+
if errExport := testExportCompartmentWithResourceName(&compositeId, &compartmentId, resourceName); errExport != nil {
114116
return errExport
115117
}
116118
}
@@ -176,6 +178,7 @@ func TestBlockchainOsnResource_basic(t *testing.T) {
176178
{
177179
Config: config,
178180
ImportState: true,
181+
ImportStateIdFunc: getBlockchainOsnCompositeId(resourceName),
179182
ImportStateVerify: true,
180183
ImportStateVerifyIgnore: []string{},
181184
ResourceName: resourceName,
@@ -184,6 +187,17 @@ func TestBlockchainOsnResource_basic(t *testing.T) {
184187
})
185188
}
186189

190+
func getBlockchainOsnCompositeId(resourceName string) resource.ImportStateIdFunc {
191+
return func(s *terraform.State) (string, error) {
192+
rs, ok := s.RootModule().Resources[resourceName]
193+
if !ok {
194+
return "", fmt.Errorf("not found: %s", resourceName)
195+
}
196+
197+
return fmt.Sprintf("blockchainPlatforms/%s/osns/%s", rs.Primary.Attributes["blockchain_platform_id"], rs.Primary.Attributes["id"]), nil
198+
}
199+
}
200+
187201
func testAccCheckBlockchainOsnDestroy(s *terraform.State) error {
188202
noResourceFound := true
189203
client := testAccProvider.Meta().(*OracleClients).blockchainPlatformClient()

0 commit comments

Comments
 (0)