Skip to content

Commit 3d075c7

Browse files
authored
Release 3.23.0
Release 3.23.0
2 parents b1de2a9 + 3e4bd42 commit 3d075c7

File tree

308 files changed

+13293
-324
lines changed

Some content is hidden

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

308 files changed

+13293
-324
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/github.com/oracle/oci-go-sdk/**/* merge=ours
2+
vendor/vendor.json merge=ours
3+
vendor/github.com/oracle/oci-go-sdk/* merge=ours

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ debug.test
2323
docs/solutions/rhel74_image/ipxe.sh
2424
vendor/github.com/oracle/oci-go-sdk/target
2525
*.test
26+
.gitmodules
27+
oci/record

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
## 3.22.1 (Unreleased)
1+
## 3.23.0 (Unreleased)
2+
3+
### Added
4+
- Support for updating `license_model` for `oci_autonomous_database` resource
5+
- Support for updating `static_routes` and new `cpe_local_identifier` in `oci_core_ipsec` resource for improved VPN service usability
6+
- Support for updating `whitelisted_ips` in `autonomous_database`. Note: Cannot be used during creation.
7+
- Support tagging for Dynamic Groups in Identity
8+
29
## 3.22.0 (April 10, 2019)
310

411
### Added

GNUmakefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ WEBSITE_REPO=github.com/hashicorp/terraform-website
88
prefix := $(if $(debug),TF_LOG=DEBUG OCI_GO_SDK_DEBUG=v, )
99
timeout := $(if $(timeout), $(timeout), 120m)
1010
run_regex := $(if $(run), -run $(run), )
11+
test_tags := $(if $(tags), -tags $(tags), )
1112
skip_goimports_check_flag := $(if $(skip_goimports_check), -s, )
1213

1314
default: build
@@ -24,7 +25,7 @@ sweep: fmtcheck
2425
TF_ACC=1 $(prefix) go test $(TEST) -v -run TestMain -sweep=$(sweep) -sweep-run=$(sweep-run) -timeout $(timeout)
2526

2627
testacc: fmtcheck
27-
TF_ACC=1 $(prefix) go test $(TEST) -v $(TESTARGS) $(run_regex) -timeout $(timeout)
28+
TF_ACC=1 $(prefix) go test $(TEST) -v $(TESTARGS) $(run_regex) $(test_tags) -timeout $(timeout)
2829

2930
vet:
3031
@echo "go vet ."

examples/compute/windows/userdata/setup.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ Connect-IscsiTarget -NodeAddress $iqn -TargetPortalAddress $ipv4 -IsPersistent $
1414
Write-Output 'Configured ISCSI for Block Volumes'
1515

1616
Write-Output 'Configuring the new disk for a partition and file system'
17-
# By default the disk is initialized, if it is not, you can add this command before partitioning: Initialize-Disk -PartitionStyle MBR -PassThru
18-
Get-Disk -Number 1 | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "tfdisk" -Confirm:$false
17+
Get-Disk -Number 1 | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel "tfdisk" -Confirm:$false
1918
Write-Output 'Configured the new disk'

examples/compute/windows/variables.tf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ variable instance_image_ocid {
5252
type = "map"
5353

5454
default = {
55-
# Images released after June 2018 have cloudbase-init and winrm enabled by default, refer to the release notes - https://docs.cloud.oracle.com/iaas/images/
56-
# The below Image OCIDs are for Windows-Server-2012-R2-Standard-Edition-VM-Gen2-2018.12.12-0
57-
# See https://docs.cloud.oracle.com/iaas/images/image/5e34cde5-6cef-4cc3-b8f1-c8fc3a088302/
58-
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaarlo3ace3wq34aompwj3u2z2xteonboapg663woz6d2iovarowhja"
59-
60-
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaabzwak2haqxh3r7h6dajgu4enp7q7hcrreql45awryd5frjsd5l6a"
61-
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaaourcjktoe3gprvwfksxc36r4rxgbcjs5qvtrja6w6euivci635vq"
62-
uk-london-1 = "ocid1.image.oc1.uk-london-1.aaaaaaaadb4mg7ii73wkrntmiunr7x7qrh7ompczvy3xbggm27pkhotpgj2q"
55+
# Images released in and after July 2018 have cloudbase-init and winrm enabled by default, refer to the release notes - https://docs.cloud.oracle.com/iaas/images/
56+
# Image OCIDs for Windows-Server-2012-R2-Standard-Edition-VM-Gen2-2018.10.12-0 - https://docs.cloud.oracle.com/iaas/images/image/80b70ffd-5efc-479e-872c-d1bf6bcbefbd/
57+
eu-frankfurt-1 = "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaat5km25plmetj6gtnhrr5xprmv7boe25q2vrzwhbgno5yh2owybja"
58+
59+
us-ashburn-1 = "ocid1.image.oc1.iad.aaaaaaaaxgzzrdoge7zxrjtmjqjhicaxsujljvaju3mbwryo5x5k5axlmsza"
60+
uk-london-1 = "ocid1.image.oc1.uk-london-1.aaaaaaaaedntd3p6jed5d2p7gsohfu6x3k67s364amtzb5vwfzrvfzt2rrlq"
61+
us-phoenix-1 = "ocid1.image.oc1.phx.aaaaaaaaskz7sq3mlmiwazehuqzoxdq4xz7sinrwn5m6kedxz3td2c7it2vq"
6362
}
6463
}
6564

examples/identity/group.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,26 @@ output "groups" {
3232
/*
3333
* Some more directives to show dynamic groups and policy for it
3434
*/
35+
36+
variable "dynamic_group_defined_tags_value" {
37+
default = "value"
38+
}
39+
40+
variable "dynamic_group_freeform_tags" {
41+
default = {
42+
"Department" = "Finance"
43+
}
44+
}
45+
3546
resource "oci_identity_dynamic_group" "dynamic-group-1" {
3647
compartment_id = "${var.tenancy_ocid}"
3748
name = "tf-example-dynamic-group"
3849
description = "dynamic group created by terraform"
3950
matching_rule = "instance.compartment.id = ${data.oci_identity_compartments.compartments1.compartments.0.id}"
51+
52+
#Optional
53+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.dynamic_group_defined_tags_value}")}"
54+
freeform_tags = "${var.dynamic_group_freeform_tags}"
4055
}
4156

4257
data "oci_identity_dynamic_groups" "dynamic-groups-1" {

httpreplay/README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
**HTTP Replay**
2+
=====
3+
4+
Synopsis
5+
-----
6+
7+
```
8+
// install the hook for HTTP replaying:
9+
10+
if h, ok := client.HTTPClient.(*http.Client); ok {
11+
_, err := httpreplay.InstallRecorder(h)
12+
if err != nil {
13+
return err
14+
}
15+
}
16+
17+
func TestMyServiceResource_basic(t *testing.T) {
18+
// In a unit test, tell the recorder what test we are running
19+
httpreplay.SetScenario("TestMyServiceResource_basic")
20+
defer httpreplay.SaveScenario()
21+
... testing happens ...
22+
}
23+
```
24+
25+
Description
26+
-----
27+
28+
This library provides a recording mechanism for the OCI-GO-SDK. It hooks into
29+
the 'Transport' layer of the HTTP request, calling through to the real
30+
network as needed.
31+
32+
* bypass (default): Do nothing
33+
* record: Store the Interaction
34+
* replay: Load the Interaction file and send back the response
35+
36+
Select the record or replay mode by specifying a build tag to go: `-tags <mode>`
37+
38+
39+
Functions
40+
-----
41+
42+
InstallRecorder
43+
* Install hooks into the `http.Client` to allow the record/replay library to
44+
intercept HTTP calls. `InstallRecorder` tries to be safe if called multiple
45+
times, but it is possible to fool it. Best is to only call it once per
46+
`http.Client`.
47+
48+
SetScenario
49+
* Name the scenario that is about to run.
50+
51+
Currently, this specifies
52+
the filename that the scenario data will be saved into,
53+
with a `.yaml` extension.
54+
- If `-tags record` is specified, the
55+
requests are written to this file in the `SaveScenario` call. The Interaction file
56+
will be stored in directory `~<prj_path>/record/` with the name passed into.
57+
- If `-tags replay` is specified, then a file by that name is immediately
58+
read and used for generating replies to network requests.
59+
60+
SaveScenario
61+
* Save the scenario data.
62+
63+
Currently, if `-tags record` is specified, this writes all the
64+
recorded requests to the file named in `SetScenario`.
65+
66+
67+
Record Storage
68+
-----
69+
70+
* In record mode: After running the test case, the record file will be stored under "oci/record/".
71+
* In replay mode: Look for the record file under "oci/record/" and throw error if it is not found.
72+
73+
74+
Example usage
75+
-----
76+
* To run normally: `go test`
77+
* Or run 1 specific test case: `go test -run <testname>`
78+
----
79+
* To record interactions: `go test -tags record`
80+
* Or to record 1 specific test case: `go test -run <testname> -tags record`
81+
----
82+
* To replay interactions: `go test -tags replay`
83+
* Or to replay 1 specific test case: `go test -run <testname> -tags replay`
84+
85+
### Example Output
86+
87+
Run with recording turned on, the test portion takes 2411 seconds:
88+
89+
> go test -v -timeout 120m -run TestResourceCoreImageTestSuite -tags record
90+
=== RUN TestResourceCoreImageTestSuite
91+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_basic
92+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageTuple
93+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageUri
94+
--- PASS: TestResourceCoreImageTestSuite (2411.14s)
95+
--- PASS: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_basic (2410.58s)
96+
--- SKIP: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageTuple (0.00s)
97+
core_image_resource_test.go:191: Long running test, requires per tenancy namespace + bucket + image export object to run
98+
--- SKIP: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageUri (0.00s)
99+
core_image_resource_test.go:155: Long running test, requires exported image available via public url
100+
PASS
101+
102+
103+
Now that we have a recording, run in replay mode, note that it is only 4.09 seconds:
104+
105+
> go test -v -run TestResourceCoreImageTestSuite -tags replay
106+
=== RUN TestResourceCoreImageTestSuite
107+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_basic
108+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageTuple
109+
=== RUN TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageUri
110+
--- PASS: TestResourceCoreImageTestSuite (4.09s)
111+
--- PASS: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_basic (3.60s)
112+
--- SKIP: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageTuple (0.00s)
113+
core_image_resource_test.go:191: Long running test, requires per tenancy namespace + bucket + image export object to run
114+
--- SKIP: TestResourceCoreImageTestSuite/TestAccResourceCoreImage_createFromExport_objectStorageUri (0.00s)
115+
core_image_resource_test.go:155: Long running test, requires exported image available via public url
116+
PASS
117+

httpreplay/bypassing.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
// +build !record
4+
// +build !replay
5+
6+
package httpreplay
7+
8+
import (
9+
"net/http"
10+
)
11+
12+
// InstallRecorder does no-op.
13+
func InstallRecorder(client *http.Client) (HTTPRecordingClient, error) {
14+
return client, nil
15+
}
16+
17+
// SetScenario lets the recorder know which test is currently executing
18+
func SetScenario(name string) error {
19+
debugLogf("Not recording. %s", name)
20+
return nil
21+
}
22+
23+
// SaveScenario saves the recorded service calls for the current scenario
24+
func SaveScenario() error {
25+
return nil
26+
}
27+
28+
// ShouldRetryImmediately returns true if replaying
29+
func ShouldRetryImmediately() bool {
30+
return false
31+
}

httpreplay/common.go

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
package httpreplay
4+
5+
import (
6+
"fmt"
7+
"log"
8+
"net/http"
9+
"os"
10+
"path/filepath"
11+
12+
yaml "gopkg.in/yaml.v2"
13+
)
14+
15+
func init() {
16+
SetDebugLogger(DefaultLogger())
17+
}
18+
19+
// HTTPRecordingClient wraps the execution of a http request, adding record/replay functionality. It is meant to be compatible with oci-go-sdk's client.HTTPRequestDispatcher interface.
20+
type HTTPRecordingClient interface {
21+
Do(req *http.Request) (*http.Response, error)
22+
}
23+
24+
var currentLogger *log.Logger
25+
26+
// DebugLogf logs a formatted string to stderr. It should be considered temporary, and in a release version either removed or replaced with a passed-in logging interface.
27+
func debugLogf(format string, v ...interface{}) {
28+
if currentLogger != nil {
29+
err := currentLogger.Output(2, fmt.Sprintf(format, v...))
30+
if err != nil {
31+
log.Println("[WARN] Failed to write to current logger")
32+
}
33+
}
34+
}
35+
36+
func SetDebugLogger(logger *log.Logger) {
37+
currentLogger = logger
38+
}
39+
40+
func DefaultLogger() *log.Logger {
41+
return log.New(os.Stderr, "", log.Ldate|log.Ltime|log.Lshortfile)
42+
}
43+
44+
func saveOrLog(d interface{}, fn string) {
45+
if err := save(d, fn); err != nil {
46+
debugLogf("Error: %v", err)
47+
}
48+
}
49+
50+
// Save writes some data on disk for future re-use
51+
func save(d interface{}, fn string) error {
52+
// Create directory for scenario if missing
53+
scenarioDir := filepath.Dir(fn)
54+
if _, err := os.Stat(scenarioDir); os.IsNotExist(err) {
55+
if err = os.MkdirAll(scenarioDir, 0755); err != nil {
56+
return err
57+
}
58+
}
59+
60+
// Marshal to YAML and save interactions
61+
data, err := yaml.Marshal(d)
62+
if err != nil {
63+
return err
64+
}
65+
66+
f, err := os.Create(fn)
67+
if err != nil {
68+
return err
69+
}
70+
71+
defer func(f *os.File) {
72+
err := f.Close()
73+
if err != nil {
74+
log.Fatal(err)
75+
}
76+
}(f)
77+
78+
// Honor the YAML structure specification
79+
// http://www.yaml.org/spec/1.2/spec.html#id2760395
80+
_, err = f.Write([]byte("---\n"))
81+
if err != nil {
82+
return err
83+
}
84+
85+
_, err = f.Write(data)
86+
if err != nil {
87+
return err
88+
}
89+
90+
return nil
91+
}

0 commit comments

Comments
 (0)