Skip to content

Commit db7dc6b

Browse files
srishtipmishrarashik-bhasin
authored andcommitted
Added support to DBaaS for Custom listener port
1 parent 846099b commit db7dc6b

11 files changed

+142
-26
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.41.0 (Unreleased)
2+
3+
### Added
4+
- Support for Custom Listener Port added to `database`
5+
16
## 4.40.0 (August 18, 2021)
27

38
### Added

examples/database/exadata_cc/vm_cluster.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ resource "oci_database_vm_cluster_network" "test_vm_cluster_network" {
1818
]
1919

2020
port = 1521
21+
scan_listener_port_tcp = 1521
22+
scan_listener_port_tcp_ssl = 2484
2123
}
2224

2325
vm_networks {

oci/database_vm_cluster_network_resource.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ func DatabaseVmClusterNetworkResource() *schema.Resource {
7373
},
7474

7575
// Optional
76+
"scan_listener_port_tcp": {
77+
Type: schema.TypeInt,
78+
Optional: true,
79+
Computed: true,
80+
},
81+
"scan_listener_port_tcp_ssl": {
82+
Type: schema.TypeInt,
83+
Optional: true,
84+
Computed: true,
85+
},
7686

7787
// Computed
7888
},
@@ -739,6 +749,16 @@ func (s *DatabaseVmClusterNetworkResourceCrud) mapToScanDetails(fieldKeyFormat s
739749
result.Port = &tmp
740750
}
741751

752+
if scanListenerPortTcp, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "scan_listener_port_tcp")); ok {
753+
tmp := scanListenerPortTcp.(int)
754+
result.ScanListenerPortTcp = &tmp
755+
}
756+
757+
if scanListenerPortTcpSsl, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "scan_listener_port_tcp_ssl")); ok {
758+
tmp := scanListenerPortTcpSsl.(int)
759+
result.ScanListenerPortTcpSsl = &tmp
760+
}
761+
742762
return result, nil
743763
}
744764

@@ -755,6 +775,14 @@ func ScanDetailsToMap(obj oci_database.ScanDetails) map[string]interface{} {
755775
result["port"] = int(*obj.Port)
756776
}
757777

778+
if obj.ScanListenerPortTcp != nil {
779+
result["scan_listener_port_tcp"] = int(*obj.ScanListenerPortTcp)
780+
}
781+
782+
if obj.ScanListenerPortTcpSsl != nil {
783+
result["scan_listener_port_tcp_ssl"] = int(*obj.ScanListenerPortTcpSsl)
784+
}
785+
758786
return result
759787
}
760788

@@ -869,6 +897,12 @@ func scansHashCodeForSets(v interface{}) int {
869897
if port, ok := m["port"]; ok {
870898
buf.WriteString(fmt.Sprintf("%v-", port))
871899
}
900+
if scanListenerPortTcp, ok := m["scan_listener_port_tcp"]; ok {
901+
buf.WriteString(fmt.Sprintf("%v-", scanListenerPortTcp))
902+
}
903+
if scanListenerPortTcpSsl, ok := m["scan_listener_port_tcp_ssl"]; ok {
904+
buf.WriteString(fmt.Sprintf("%v-", scanListenerPortTcpSsl))
905+
}
872906
return hashcode.String(buf.String())
873907
}
874908

oci/database_vm_cluster_network_test.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ var (
5454
"ntp": Representation{repType: Optional, create: []string{`192.168.10.20`}, update: []string{`192.168.10.22`}},
5555
}
5656
vmClusterNetworkScansRepresentation = map[string]interface{}{
57-
"hostname": Representation{repType: Required, create: `myprefix1-ivmmj-scan`, update: `myprefix2-ivmmj-scan`},
58-
"ips": Representation{repType: Required, create: []string{`192.168.19.7`, `192.168.19.6`, `192.168.19.8`}, update: []string{`192.168.19.7`, `192.168.19.8`, `192.168.19.9`}},
59-
"port": Representation{repType: Required, create: `1521`, update: `1522`},
57+
"hostname": Representation{repType: Required, create: `myprefix1-ivmmj-scan`, update: `myprefix2-ivmmj-scan`},
58+
"ips": Representation{repType: Required, create: []string{`192.168.19.7`, `192.168.19.6`, `192.168.19.8`}, update: []string{`192.168.19.7`, `192.168.19.8`, `192.168.19.9`}},
59+
"port": Representation{repType: Required, create: `1521`, update: `1522`},
60+
"scan_listener_port_tcp": Representation{repType: Optional, create: `1521`, update: `1522`},
61+
"scan_listener_port_tcp_ssl": Representation{repType: Optional, create: `2484`, update: `2484`},
6062
}
6163
vmClusterNetworkBackupVmNetworkRepresentation = map[string]interface{}{
6264
"domain_name": Representation{repType: Required, create: `oracle.com`, update: `oracle.com`},
@@ -185,9 +187,11 @@ func TestDatabaseVmClusterNetworkResource_basic(t *testing.T) {
185187
resource.TestCheckResourceAttr(resourceName, "ntp.#", "1"),
186188
resource.TestCheckResourceAttr(resourceName, "scans.#", "1"),
187189
CheckResourceSetContainsElementWithProperties(resourceName, "scans", map[string]string{
188-
"hostname": "myprefix1-ivmmj-scan",
189-
"ips.#": "3",
190-
"port": "1521",
190+
"hostname": "myprefix1-ivmmj-scan",
191+
"ips.#": "3",
192+
"port": "1521",
193+
"scan_listener_port_tcp": "1521",
194+
"scan_listener_port_tcp_ssl": "2484",
191195
},
192196
[]string{}),
193197
resource.TestCheckResourceAttr(resourceName, "vm_networks.#", "2"),
@@ -230,9 +234,11 @@ func TestDatabaseVmClusterNetworkResource_basic(t *testing.T) {
230234
resource.TestCheckResourceAttr(resourceName, "ntp.#", "1"),
231235
resource.TestCheckResourceAttr(resourceName, "scans.#", "1"),
232236
CheckResourceSetContainsElementWithProperties(resourceName, "scans", map[string]string{
233-
"hostname": "myprefix2-ivmmj-scan",
234-
"ips.#": "3",
235-
"port": "1522",
237+
"hostname": "myprefix2-ivmmj-scan",
238+
"ips.#": "3",
239+
"port": "1522",
240+
"scan_listener_port_tcp": "1522",
241+
"scan_listener_port_tcp_ssl": "2484",
236242
},
237243
[]string{}),
238244
resource.TestCheckResourceAttr(resourceName, "vm_networks.#", "2"),
@@ -279,9 +285,11 @@ func TestDatabaseVmClusterNetworkResource_basic(t *testing.T) {
279285
resource.TestCheckResourceAttr(datasourceName, "vm_cluster_networks.0.ntp.#", "1"),
280286
resource.TestCheckResourceAttr(datasourceName, "vm_cluster_networks.0.scans.#", "1"),
281287
CheckResourceSetContainsElementWithProperties(datasourceName, "vm_cluster_networks.0.scans", map[string]string{
282-
"hostname": "myprefix2-ivmmj-scan",
283-
"ips.#": "3",
284-
"port": "1522",
288+
"hostname": "myprefix2-ivmmj-scan",
289+
"ips.#": "3",
290+
"port": "1522",
291+
"scan_listener_port_tcp": "1522",
292+
"scan_listener_port_tcp_ssl": "2484",
285293
},
286294
[]string{}),
287295
resource.TestCheckResourceAttrSet(datasourceName, "vm_cluster_networks.0.state"),
@@ -317,9 +325,11 @@ func TestDatabaseVmClusterNetworkResource_basic(t *testing.T) {
317325
resource.TestCheckResourceAttr(singularDatasourceName, "ntp.#", "1"),
318326
resource.TestCheckResourceAttr(singularDatasourceName, "scans.#", "1"),
319327
CheckResourceSetContainsElementWithProperties(singularDatasourceName, "scans", map[string]string{
320-
"hostname": "myprefix2-ivmmj-scan",
321-
"ips.#": "3",
322-
"port": "1522",
328+
"hostname": "myprefix2-ivmmj-scan",
329+
"ips.#": "3",
330+
"port": "1522",
331+
"scan_listener_port_tcp": "1522",
332+
"scan_listener_port_tcp_ssl": "2484",
323333
},
324334
[]string{}),
325335
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),

oci/database_vm_cluster_recommended_network_data_source.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ func DatabaseVmClusterRecommendedNetworkDataSource() *schema.Resource {
104104
Type: schema.TypeString,
105105
},
106106
},
107+
"scan_listener_port_tcp": {
108+
Type: schema.TypeInt,
109+
Optional: true,
110+
},
111+
"scan_listener_port_tcp_ssl": {
112+
Type: schema.TypeInt,
113+
Optional: true,
114+
},
107115

108116
// Computed
109117
"scans": {
@@ -131,6 +139,14 @@ func DatabaseVmClusterRecommendedNetworkDataSource() *schema.Resource {
131139
Type: schema.TypeInt,
132140
Computed: true,
133141
},
142+
"scan_listener_port_tcp": {
143+
Type: schema.TypeInt,
144+
Computed: true,
145+
},
146+
"scan_listener_port_tcp_ssl": {
147+
Type: schema.TypeInt,
148+
Computed: true,
149+
},
134150
},
135151
},
136152
},
@@ -291,6 +307,16 @@ func (s *DatabaseVmClusterRecommendedNetworkDataSourceCrud) Get() error {
291307
}
292308
}
293309

310+
if scanListenerPortTcp, ok := s.D.GetOkExists("scan_listener_port_tcp"); ok {
311+
tmp := scanListenerPortTcp.(int)
312+
request.ScanListenerPortTcp = &tmp
313+
}
314+
315+
if scanListenerPortTcpSsl, ok := s.D.GetOkExists("scan_listener_port_tcp_ssl"); ok {
316+
tmp := scanListenerPortTcpSsl.(int)
317+
request.ScanListenerPortTcpSsl = &tmp
318+
}
319+
294320
request.RequestMetadata.RetryPolicy = getRetryPolicy(false, "database")
295321

296322
response, err := s.Client.GenerateRecommendedVmClusterNetwork(context.Background(), request)

oci/database_vm_cluster_recommended_network_test.go

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ import (
1515

1616
var (
1717
vmClusterRecommendedNetworkSingularDataSourceRepresentation = map[string]interface{}{
18-
"compartment_id": Representation{repType: Required, create: `${var.compartment_id}`},
19-
"display_name": Representation{repType: Required, create: `testVmClusterNw`},
20-
"exadata_infrastructure_id": Representation{repType: Required, create: `${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}`},
21-
"networks": []RepresentationGroup{{Required, vmClusterRecommendedNetworkClientNetworksRepresentation}, {Required, vmClusterRecommendedNetworkbackupNetworksRepresentation}},
22-
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
23-
"dns": Representation{repType: Optional, create: []string{`192.168.10.10`}},
24-
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
25-
"ntp": Representation{repType: Optional, create: []string{`192.168.10.20`}},
18+
"compartment_id": Representation{repType: Required, create: `${var.compartment_id}`},
19+
"display_name": Representation{repType: Required, create: `testVmClusterNw`},
20+
"exadata_infrastructure_id": Representation{repType: Required, create: `${oci_database_exadata_infrastructure.test_exadata_infrastructure.id}`},
21+
"networks": []RepresentationGroup{{Required, vmClusterRecommendedNetworkClientNetworksRepresentation}, {Required, vmClusterRecommendedNetworkbackupNetworksRepresentation}},
22+
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
23+
"dns": Representation{repType: Optional, create: []string{`192.168.10.10`}},
24+
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
25+
"ntp": Representation{repType: Optional, create: []string{`192.168.10.20`}},
26+
"scan_listener_port_tcp": Representation{repType: Optional, create: `1521`},
27+
"scan_listener_port_tcp_ssl": Representation{repType: Optional, create: `2484`},
2628
}
2729
vmClusterRecommendedNetworkClientNetworksRepresentation = map[string]interface{}{
2830
"cidr": Representation{repType: Required, create: `192.168.19.2/16`},
@@ -73,13 +75,31 @@ func TestDatabaseVmClusterRecommendedNetworkResource_basic(t *testing.T) {
7375
// verify singular datasource
7476
{
7577
Config: config + VmClusterRecommendedNetworkDataSourceDependencies +
76-
generateDataSourceFromRepresentationMap("oci_database_vm_cluster_recommended_network", "test_vm_cluster_recommended_network", Required, Create, vmClusterRecommendedNetworkSingularDataSourceRepresentation) +
78+
generateDataSourceFromRepresentationMap("oci_database_vm_cluster_recommended_network", "test_vm_cluster_recommended_network", Optional, Create, vmClusterRecommendedNetworkSingularDataSourceRepresentation) +
7779
compartmentIdVariableStr,
7880
Check: ComposeAggregateTestCheckFuncWrapper(
7981
resource.TestCheckResourceAttr(singularDatasourceName, "compartment_id", compartmentId),
8082
resource.TestCheckResourceAttr(singularDatasourceName, "display_name", "testVmClusterNw"),
8183
resource.TestCheckResourceAttrSet(singularDatasourceName, "exadata_infrastructure_id"),
84+
resource.TestCheckResourceAttr(singularDatasourceName, "freeform_tags.%", "1"),
8285
resource.TestCheckResourceAttr(singularDatasourceName, "networks.#", "2"),
86+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.cidr", "192.168.19.2/16"),
87+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.domain", "oracle.com"),
88+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.gateway", "192.168.20.1"),
89+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.netmask", "255.255.0.0"),
90+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.network_type", "CLIENT"),
91+
resource.TestCheckResourceAttr(singularDatasourceName, "networks.0.prefix", "myprefix1"),
92+
resource.TestCheckResourceAttrSet(singularDatasourceName, "networks.0.vlan_id"),
93+
resource.TestCheckResourceAttr(singularDatasourceName, "ntp.#", "1"),
94+
resource.TestCheckResourceAttr(singularDatasourceName, "scan_listener_port_tcp", "1521"),
95+
resource.TestCheckResourceAttr(singularDatasourceName, "scan_listener_port_tcp_ssl", "2484"),
96+
97+
resource.TestCheckResourceAttr(singularDatasourceName, "compartment_id", compartmentId),
98+
resource.TestCheckResourceAttr(singularDatasourceName, "defined_tags.%", "1"),
99+
resource.TestCheckResourceAttr(singularDatasourceName, "display_name", "testVmClusterNw"),
100+
resource.TestCheckResourceAttr(singularDatasourceName, "dns.#", "1"),
101+
resource.TestCheckResourceAttr(singularDatasourceName, "freeform_tags.%", "1"),
102+
resource.TestCheckResourceAttr(singularDatasourceName, "ntp.#", "1"),
83103
resource.TestCheckResourceAttr(singularDatasourceName, "scans.#", "1"),
84104
),
85105
},

website/docs/d/database_vm_cluster_network.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ The following attributes are exported:
4949
* `hostname` - The SCAN hostname.
5050
* `ips` - The list of SCAN IP addresses. Three addresses should be provided.
5151
* `port` - The SCAN TCPIP port. Default is 1521.
52+
* `scan_listener_port_tcp` - The SCAN TCPIP port. Default is 1521.
53+
* `scan_listener_port_tcp_ssl` - The SCAN TCPIP SSL port. Default is 2484.
5254
* `state` - The current state of the VM cluster network.
5355
* `time_created` - The date and time when the VM cluster network was created.
5456
* `vm_cluster_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the associated VM Cluster.

website/docs/d/database_vm_cluster_networks.html.markdown

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ The following attributes are exported:
6060
* `hostname` - The SCAN hostname.
6161
* `ips` - The list of SCAN IP addresses. Three addresses should be provided.
6262
* `port` - The SCAN TCPIP port. Default is 1521.
63+
* `scan_listener_port_tcp` - The SCAN TCPIP port. Default is 1521.
64+
* `scan_listener_port_tcp_ssl` - The SCAN TCPIP SSL port. Default is 2484.
6365
* `state` - The current state of the VM cluster network.
6466
* `time_created` - The date and time when the VM cluster network was created.
6567
* `vm_cluster_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the associated VM Cluster.

website/docs/d/database_vm_cluster_recommended_network.html.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ data "oci_database_vm_cluster_recommended_network" "test_vm_cluster_recommended_
3737
dns = var.vm_cluster_recommended_network_dns
3838
freeform_tags = var.vm_cluster_recommended_network_freeform_tags
3939
ntp = var.vm_cluster_recommended_network_ntp
40+
scan_listener_port_tcp = var.vm_cluster_recommended_network_scan_listener_port_tcp
41+
scan_listener_port_tcp_ssl = var.vm_cluster_recommended_network_scan_listener_port_tcp_ssl
4042
}
4143
```
4244

@@ -59,6 +61,8 @@ The following arguments are supported:
5961
* `prefix` - (Required) The network domain name.
6062
* `vlan_id` - (Required) The network VLAN ID.
6163
* `ntp` - (Optional) The list of NTP server IP addresses. Maximum of 3 allowed.
64+
* `scan_listener_port_tcp` - (Optional) The SCAN TCPIP port. Default is 1521.
65+
* `scan_listener_port_tcp_ssl` - (Optional) The SCAN TCPIP SSL port. Default is 2484.
6266

6367

6468
## Attributes Reference
@@ -75,6 +79,8 @@ The following attributes are exported:
7579
* `hostname` - The SCAN hostname.
7680
* `ips` - The list of SCAN IP addresses. Three addresses should be provided.
7781
* `port` - The SCAN TCPIP port. Default is 1521.
82+
* `scan_listener_port_tcp` - The SCAN TCPIP port. Default is 1521.
83+
* `scan_listener_port_tcp_ssl` - The SCAN TCPIP SSL port. Default is 2484.
7884
* `vm_networks` - Details of the client and backup networks.
7985
* `domain_name` - The network domain name.
8086
* `gateway` - The network gateway.

website/docs/r/database_autonomous_database.html.markdown

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The following arguments are supported:
115115
* `is_refreshable_clone` - (Applicable when source=CLONE_TO_REFRESHABLE) (Updatable) True for creating a refreshable clone and False for detaching the clone from source Autonomous Database. Detaching is one time operation and clone becomes a regular Autonomous Database.
116116
* `license_model` - (Optional) (Updatable) The Oracle license model that applies to the Oracle Autonomous Database. Bring your own license (BYOL) allows you to apply your current on-premises Oracle software licenses to equivalent, highly automated Oracle PaaS and IaaS services in the cloud. License Included allows you to subscribe to new Oracle Database software licenses and the Database service. Note that when provisioning an Autonomous Database on [dedicated Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adbddoverview.htm), this attribute must be null because the attribute is already set at the Autonomous Exadata Infrastructure level. When using [shared Exadata infrastructure](https://docs.cloud.oracle.com/iaas/Content/Database/Concepts/adboverview.htm#AEI), if a value is not specified, the system will supply the value of `BRING_YOUR_OWN_LICENSE`. It is a required field when `db_workload` is AJD and needs to be set to `LICENSE_INCLUDED` as AJD does not support default `license_model` value `BRING_YOUR_OWN_LICENSE`.
117117
* `nsg_ids` - (Optional) (Updatable) A list of the [OCIDs](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the network security groups (NSGs) that this resource belongs to. Setting this to an empty array after the list is created removes the resource from all NSGs. For more information about NSGs, see [Security Rules](https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/securityrules.htm). **NsgIds restrictions:**
118-
* Autonomous Databases with private access require at least 1 Network Security Group (NSG). The nsgIds array cannot be empty.
118+
* Autonomous Databases with private access require at least 1 Network Security Group (NSG). The nsgIds array cannot be empty.
119119
* `ocpu_count` - (Optional) (Updatable) The number of OCPU cores to be made available to the database.
120120

121121
The following points apply:
@@ -124,7 +124,8 @@ The following arguments are supported:
124124

125125
For Autonomous Databases on dedicated Exadata infrastructure, the maximum number of cores is determined by the infrastructure shape. See [Characteristics of Infrastructure Shapes](https://www.oracle.com/pls/topic/lookup?ctx=en/cloud/paas/autonomous-database&id=ATPFG-GUID-B0F033C1-CC5A-42F0-B2E7-3CECFEDA1FD1) for shape details.
126126

127-
**Note:** This parameter cannot be used with the `cpuCoreCount` parameter.
127+
**Note:** This parameter cannot be used with the `cpuCoreCount` parameter.
128+
* `operations_insights_status` - (Optional) (Updatable) Status of Operations Insights for this Autonomous Database. Values supported are `ENABLED` and `NOT_ENABLED`
128129
* `private_endpoint_label` - (Optional) (Updatable) The private endpoint label for the resource.
129130
* `refreshable_mode` - (Applicable when source=CLONE_TO_REFRESHABLE) (Updatable) The refresh mode of the clone. AUTOMATIC indicates that the clone is automatically being refreshed with data from the source Autonomous Database.
130131
* `source` - (Optional) The source of the database: Use `NONE` for creating a new Autonomous Database. Use `DATABASE` for creating a new Autonomous Database by cloning an existing Autonomous Database.

0 commit comments

Comments
 (0)