Skip to content

Commit e8f7e78

Browse files
authored
Merge pull request #990 from terraform-providers/release_merge_v3.65.0
Candidate for release_v3.65.0
2 parents 9e40ef0 + 2e215d7 commit e8f7e78

File tree

95 files changed

+2011
-221
lines changed

Some content is hidden

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

95 files changed

+2011
-221
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
## 3.65.0 (Unreleased)
2+
3+
### Added
4+
- Support for updating `shape` attribute in `oci_database_db_system` resource
5+
- Support for CPE builder on IPSec console
6+
- Support for exposing `private_ip` and `fault_domain` for OKE cluster node
7+
28
## 3.64.0 (February 26, 2020)
39

410
### Added

examples/networking/ipsec_connections/ipsec_connection.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@ provider "oci" {
1717
}
1818

1919
resource oci_core_cpe "test_cpe" {
20-
compartment_id = "${var.compartment_ocid}"
21-
display_name = "test_cpe"
22-
ip_address = "189.44.2.135"
20+
compartment_id = "${var.compartment_ocid}"
21+
display_name = "test_cpe"
22+
ip_address = "189.44.2.135"
23+
cpe_device_shape_id = "${data.oci_core_cpe_device_shape.test_cpe_device_shape.id}"
2324
}
2425

2526
resource oci_core_drg "test_drg" {
2627
compartment_id = "${var.compartment_ocid}"
2728
display_name = "test_drg"
2829
}
2930

31+
data "oci_core_cpe_device_shapes" "test_cpe_device_shapes" {}
32+
33+
data "oci_core_cpe_device_shape" "test_cpe_device_shape" {
34+
cpe_device_shape_id = "${data.oci_core_cpe_device_shapes.test_cpe_device_shapes.cpe_device_shapes.0.cpe_device_shape_id}"
35+
}
36+
3037
resource "oci_core_ipsec" "test_ip_sec_connection" {
3138
#Required
3239
compartment_id = "${var.compartment_ocid}"

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.7.0+incompatible
9+
github.com/oracle/oci-go-sdk v15.8.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
@@ -356,6 +356,8 @@ github.com/oracle/oci-go-sdk v15.6.0+incompatible h1:6kX7J6cJnFeWwCPUfiywDD5joxx
356356
github.com/oracle/oci-go-sdk v15.6.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
357357
github.com/oracle/oci-go-sdk v15.7.0+incompatible h1:CkhSZ7dL9yB/rNbVX+MVFHojuMTo+4dFOSorz/iNxmY=
358358
github.com/oracle/oci-go-sdk v15.7.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
359+
github.com/oracle/oci-go-sdk v15.8.0+incompatible h1:SEJ4DBi6DUtCZH26hGtDhQiU3IfjuBFc7R4XjQ8w9DA=
360+
github.com/oracle/oci-go-sdk v15.8.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
359361
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y=
360362
github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=
361363
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c h1:Lgl0gzECD8GnQ5QCWA8o6BtfL6mDH5rQgM4/fX3avOs=

oci/containerengine_node_pool_resource.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ func ContainerengineNodePoolResource() *schema.Resource {
268268
},
269269
},
270270
},
271+
"fault_domain": {
272+
Type: schema.TypeString,
273+
Computed: true,
274+
},
271275
"id": {
272276
Type: schema.TypeString,
273277
Computed: true,
@@ -284,6 +288,10 @@ func ContainerengineNodePoolResource() *schema.Resource {
284288
Type: schema.TypeString,
285289
Computed: true,
286290
},
291+
"private_ip": {
292+
Type: schema.TypeString,
293+
Computed: true,
294+
},
287295
"public_ip": {
288296
Type: schema.TypeString,
289297
Computed: true,
@@ -834,6 +842,10 @@ func NodeToMap(obj oci_containerengine.Node) map[string]interface{} {
834842
result["error"] = []interface{}{NodeErrorToMap(obj.NodeError)}
835843
}
836844

845+
if obj.FaultDomain != nil {
846+
result["fault_domain"] = string(*obj.FaultDomain)
847+
}
848+
837849
if obj.Id != nil {
838850
result["id"] = string(*obj.Id)
839851
}
@@ -850,6 +862,10 @@ func NodeToMap(obj oci_containerengine.Node) map[string]interface{} {
850862
result["node_pool_id"] = string(*obj.NodePoolId)
851863
}
852864

865+
if obj.PrivateIp != nil {
866+
result["private_ip"] = string(*obj.PrivateIp)
867+
}
868+
853869
if obj.PublicIp != nil {
854870
result["public_ip"] = string(*obj.PublicIp)
855871
}

oci/containerengine_node_pool_resource_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ func TestResourceContainerengineNodePool_regionalsubnet(t *testing.T) {
246246
resource.TestCheckResourceAttr(singularDatasourceName, "node_shape", "VM.Standard2.1"),
247247
resource.TestCheckResourceAttr(singularDatasourceName, "ssh_public_key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOuBJgh6lTmQvQJ4BA3RCJdSmxRtmiXAQEEIP68/G4gF3XuZdKEYTFeputacmRq9yO5ZnNXgO9akdUgePpf8+CfFtveQxmN5xo3HVCDKxu/70lbMgeu7+wJzrMOlzj+a4zNq2j0Ww2VWMsisJ6eV3bJTnO/9VLGCOC8M9noaOlcKcLgIYy4aDM724MxFX2lgn7o6rVADHRxkvLEXPVqYT4syvYw+8OVSnNgE4MJLxaw8/2K0qp19YlQyiriIXfQpci3ThxwLjymYRPj+kjU1xIxv6qbFQzHR7ds0pSWp1U06cIoKPfCazU9hGWW8yIe/vzfTbWrt2DK6pLwBn/G0x3 sample"),
248248
resource.TestCheckResourceAttr(singularDatasourceName, "subnet_ids.#", "1"),
249+
// "nodes" is not set until the instances in the node_pool are "Available" so we can't assert the nodes property
250+
//resource.TestCheckResourceAttrSet(singularDatasourceName, "nodes"),
249251
),
250252
},
251253
},
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
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_core "github.com/oracle/oci-go-sdk/core"
10+
)
11+
12+
func CoreCpeDeviceShapeDataSource() *schema.Resource {
13+
return &schema.Resource{
14+
Read: readSingularCoreCpeDeviceShape,
15+
Schema: map[string]*schema.Schema{
16+
"cpe_device_shape_id": {
17+
Type: schema.TypeString,
18+
Required: true,
19+
},
20+
// Computed
21+
"cpe_device_info": {
22+
Type: schema.TypeList,
23+
Computed: true,
24+
Elem: &schema.Resource{
25+
Schema: map[string]*schema.Schema{
26+
// Required
27+
28+
// Optional
29+
30+
// Computed
31+
"platform_software_version": {
32+
Type: schema.TypeString,
33+
Computed: true,
34+
},
35+
"vendor": {
36+
Type: schema.TypeString,
37+
Computed: true,
38+
},
39+
},
40+
},
41+
},
42+
"parameters": {
43+
Type: schema.TypeList,
44+
Computed: true,
45+
Elem: &schema.Resource{
46+
Schema: map[string]*schema.Schema{
47+
// Required
48+
49+
// Optional
50+
51+
// Computed
52+
"display_name": {
53+
Type: schema.TypeString,
54+
Computed: true,
55+
},
56+
"explanation": {
57+
Type: schema.TypeString,
58+
Computed: true,
59+
},
60+
"key": {
61+
Type: schema.TypeString,
62+
Computed: true,
63+
},
64+
},
65+
},
66+
},
67+
"template": {
68+
Type: schema.TypeString,
69+
Computed: true,
70+
},
71+
},
72+
}
73+
}
74+
75+
func readSingularCoreCpeDeviceShape(d *schema.ResourceData, m interface{}) error {
76+
sync := &CoreCpeDeviceShapeDataSourceCrud{}
77+
sync.D = d
78+
sync.Client = m.(*OracleClients).virtualNetworkClient
79+
80+
return ReadResource(sync)
81+
}
82+
83+
type CoreCpeDeviceShapeDataSourceCrud struct {
84+
D *schema.ResourceData
85+
Client *oci_core.VirtualNetworkClient
86+
Res *oci_core.GetCpeDeviceShapeResponse
87+
}
88+
89+
func (s *CoreCpeDeviceShapeDataSourceCrud) VoidState() {
90+
s.D.SetId("")
91+
}
92+
93+
func (s *CoreCpeDeviceShapeDataSourceCrud) Get() error {
94+
request := oci_core.GetCpeDeviceShapeRequest{}
95+
96+
if cpeDeviceShapeId, ok := s.D.GetOkExists("cpe_device_shape_id"); ok {
97+
tmp := cpeDeviceShapeId.(string)
98+
request.CpeDeviceShapeId = &tmp
99+
}
100+
101+
request.RequestMetadata.RetryPolicy = getRetryPolicy(false, "core")
102+
103+
response, err := s.Client.GetCpeDeviceShape(context.Background(), request)
104+
if err != nil {
105+
return err
106+
}
107+
108+
s.Res = &response
109+
return nil
110+
}
111+
112+
func (s *CoreCpeDeviceShapeDataSourceCrud) SetData() error {
113+
if s.Res == nil {
114+
return nil
115+
}
116+
117+
s.D.SetId(*s.Res.CpeDeviceShapeId)
118+
119+
if s.Res.CpeDeviceInfo != nil {
120+
s.D.Set("cpe_device_info", []interface{}{CpeDeviceInfoToMap(s.Res.CpeDeviceInfo)})
121+
} else {
122+
s.D.Set("cpe_device_info", nil)
123+
}
124+
125+
parameters := []interface{}{}
126+
for _, item := range s.Res.Parameters {
127+
parameters = append(parameters, CpeDeviceConfigQuestionToMap(item))
128+
}
129+
s.D.Set("parameters", parameters)
130+
131+
if s.Res.Template != nil {
132+
s.D.Set("template", *s.Res.Template)
133+
}
134+
135+
return nil
136+
}
137+
138+
func CpeDeviceConfigQuestionToMap(obj oci_core.CpeDeviceConfigQuestion) map[string]interface{} {
139+
result := map[string]interface{}{}
140+
141+
if obj.DisplayName != nil {
142+
result["display_name"] = string(*obj.DisplayName)
143+
}
144+
145+
if obj.Explanation != nil {
146+
result["explanation"] = string(*obj.Explanation)
147+
}
148+
149+
if obj.Key != nil {
150+
result["key"] = string(*obj.Key)
151+
}
152+
153+
return result
154+
}
155+
156+
func CpeDeviceInfoToMap(obj *oci_core.CpeDeviceInfo) map[string]interface{} {
157+
result := map[string]interface{}{}
158+
159+
if obj.PlatformSoftwareVersion != nil {
160+
result["platform_software_version"] = string(*obj.PlatformSoftwareVersion)
161+
}
162+
163+
if obj.Vendor != nil {
164+
result["vendor"] = string(*obj.Vendor)
165+
}
166+
167+
return result
168+
}

oci/core_cpe_device_shape_test.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
3+
package oci
4+
5+
import (
6+
"fmt"
7+
"testing"
8+
9+
"github.com/hashicorp/terraform/helper/resource"
10+
"github.com/hashicorp/terraform/terraform"
11+
12+
"github.com/terraform-providers/terraform-provider-oci/httpreplay"
13+
)
14+
15+
var (
16+
cpeDeviceShapeSingularDataSourceRepresentation = map[string]interface{}{
17+
"cpe_device_shape_id": Representation{repType: Required, create: `${data.oci_core_cpe_device_shapes.test_cpe_device_shapes.cpe_device_shapes.0.cpe_device_shape_id}`},
18+
}
19+
20+
cpeDeviceShapeDataSourceRepresentation = map[string]interface{}{}
21+
22+
CpeDeviceShapeResourceConfig = ""
23+
)
24+
25+
func TestCoreCpeDeviceShapeResource_basic(t *testing.T) {
26+
httpreplay.SetScenario("TestCoreCpeDeviceShapeResource_basic")
27+
defer httpreplay.SaveScenario()
28+
29+
provider := testAccProvider
30+
config := testProviderConfig()
31+
32+
compartmentId := getEnvSettingWithBlankDefault("compartment_ocid")
33+
compartmentIdVariableStr := fmt.Sprintf("variable \"compartment_id\" { default = \"%s\" }\n", compartmentId)
34+
35+
datasourceName := "data.oci_core_cpe_device_shapes.test_cpe_device_shapes"
36+
singularDatasourceName := "data.oci_core_cpe_device_shape.test_cpe_device_shape"
37+
38+
resource.Test(t, resource.TestCase{
39+
PreCheck: func() { testAccPreCheck(t) },
40+
Providers: map[string]terraform.ResourceProvider{
41+
"oci": provider,
42+
},
43+
Steps: []resource.TestStep{
44+
// verify datasource
45+
{
46+
Config: config +
47+
generateDataSourceFromRepresentationMap("oci_core_cpe_device_shapes", "test_cpe_device_shapes", Required, Create, cpeDeviceShapeDataSourceRepresentation) +
48+
compartmentIdVariableStr + CpeDeviceShapeResourceConfig,
49+
Check: resource.ComposeAggregateTestCheckFunc(
50+
51+
resource.TestCheckResourceAttrSet(datasourceName, "cpe_device_shapes.#"),
52+
resource.TestCheckResourceAttr(datasourceName, "cpe_device_shapes.0.cpe_device_info.#", "1"),
53+
),
54+
},
55+
// verify singular datasource
56+
{
57+
Config: config +
58+
generateDataSourceFromRepresentationMap("oci_core_cpe_device_shape", "test_cpe_device_shape", Required, Create, cpeDeviceShapeSingularDataSourceRepresentation) +
59+
generateDataSourceFromRepresentationMap("oci_core_cpe_device_shapes", "test_cpe_device_shapes", Required, Create, cpeDeviceShapeDataSourceRepresentation) +
60+
compartmentIdVariableStr + CpeDeviceShapeResourceConfig,
61+
62+
Check: resource.ComposeAggregateTestCheckFunc(
63+
resource.TestCheckResourceAttrSet(singularDatasourceName, "cpe_device_shape_id"),
64+
65+
resource.TestCheckResourceAttr(singularDatasourceName, "cpe_device_info.#", "1"),
66+
resource.TestCheckResourceAttrSet(singularDatasourceName, "cpe_device_shape_id"),
67+
resource.TestCheckResourceAttrSet(singularDatasourceName, "template"),
68+
),
69+
},
70+
},
71+
})
72+
}

0 commit comments

Comments
 (0)