Skip to content

Commit 3993033

Browse files
committed
fix for ocpu_count in cloud vm cluster
1 parent 64ebbdb commit 3993033

File tree

5 files changed

+30
-15
lines changed

5 files changed

+30
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.58.0 (Unreleased)
2+
3+
### Bug Fix
4+
- Reverting `ocpu_count` to be `optional` in `oci_database_cloud_vm_cluster`
5+
16
## 4.57.0 (December 15, 2021)
27

38
### Added

oci/database_autonomous_container_database_dataguard_association_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ var (
101101
func TestDatabaseAutonomousContainerDatabaseDataguardAssociationResource_basic(t *testing.T) {
102102
// sshaagar: Commenting AEI test as not needed post migration.
103103
// DISALLOWED_API.launchAutonomousExadataInfrastructure
104-
t.Skip("Skipping Test for TeamCity")
104+
t.Skip("Skipping Test from execution on a regular test run")
105105

106106
httpreplay.SetScenario("TestDatabaseAutonomousContainerDatabaseDataguardAssociationResource_basic")
107107
defer httpreplay.SaveScenario()

oci/database_cloud_vm_cluster_resource.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ func DatabaseCloudVmClusterResource() *schema.Resource {
5050
Type: schema.TypeInt,
5151
Required: true,
5252
},
53-
"ocpu_count": {
54-
Type: schema.TypeFloat,
55-
Required: true,
56-
},
5753
"display_name": {
5854
Type: schema.TypeString,
5955
Required: true,
@@ -155,6 +151,11 @@ func DatabaseCloudVmClusterResource() *schema.Resource {
155151
Type: schema.TypeString,
156152
},
157153
},
154+
"ocpu_count": {
155+
Type: schema.TypeFloat,
156+
Optional: true,
157+
Computed: true,
158+
},
158159
"scan_listener_port_tcp": {
159160
Type: schema.TypeInt,
160161
Optional: true,
@@ -433,16 +434,16 @@ func (s *DatabaseCloudVmClusterResourceCrud) Create() error {
433434
request.CpuCoreCount = &tmp
434435
}
435436

436-
if ocpuCount, ok := s.D.GetOkExists("ocpu_count"); ok {
437-
tmp := float32(ocpuCount.(float64))
438-
request.OcpuCount = &tmp
439-
}
440-
441437
if dataStoragePercentage, ok := s.D.GetOkExists("data_storage_percentage"); ok {
442438
tmp := dataStoragePercentage.(int)
443439
request.DataStoragePercentage = &tmp
444440
}
445441

442+
if ocpuCount, ok := s.D.GetOkExists("ocpu_count"); ok {
443+
tmp := float32(ocpuCount.(float64))
444+
request.OcpuCount = &tmp
445+
}
446+
446447
if definedTags, ok := s.D.GetOkExists("defined_tags"); ok {
447448
convertedDefinedTags, err := mapToDefinedTags(definedTags.(map[string]interface{}))
448449
if err != nil {
@@ -611,11 +612,6 @@ func (s *DatabaseCloudVmClusterResourceCrud) Update() error {
611612
request.CpuCoreCount = &tmp
612613
}
613614

614-
if ocpuCount, ok := s.D.GetOkExists("ocpu_count"); ok && s.D.HasChange("ocpu_count") {
615-
tmp := float32(ocpuCount.(float64))
616-
request.OcpuCount = &tmp
617-
}
618-
619615
if definedTags, ok := s.D.GetOkExists("defined_tags"); ok {
620616
convertedDefinedTags, err := mapToDefinedTags(definedTags.(map[string]interface{}))
621617
if err != nil {
@@ -651,6 +647,11 @@ func (s *DatabaseCloudVmClusterResourceCrud) Update() error {
651647
}
652648
}
653649

650+
if ocpuCount, ok := s.D.GetOkExists("ocpu_count"); ok && s.D.HasChange("ocpu_count") {
651+
tmp := float32(ocpuCount.(float64))
652+
request.OcpuCount = &tmp
653+
}
654+
654655
if sshPublicKeys, ok := s.D.GetOkExists("ssh_public_keys"); ok {
655656
interfaces := sshPublicKeys.([]interface{})
656657
tmp := make([]string, len(interfaces))

oci/database_cloud_vm_cluster_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ var (
6161
"is_sparse_diskgroup_enabled": Representation{RepType: Optional, Create: `false`},
6262
"license_model": Representation{RepType: Optional, Create: `LICENSE_INCLUDED`},
6363
"nsg_ids": Representation{RepType: Optional, Create: []string{`${oci_core_network_security_group.test_network_security_group.id}`}},
64+
"ocpu_count": Representation{RepType: Optional, Create: `4.0`, Update: `4.0`},
6465
"scan_listener_port_tcp": Representation{RepType: Optional, Create: `1521`},
6566
"scan_listener_port_tcp_ssl": Representation{RepType: Optional, Create: `2484`},
6667
"time_zone": Representation{RepType: Optional, Create: `US/Pacific`},
@@ -253,6 +254,7 @@ func TestDatabaseCloudVmClusterResource_basic(t *testing.T) {
253254
resource.TestCheckResourceAttr(resourceName, "is_local_backup_enabled", "true"),
254255
resource.TestCheckResourceAttr(resourceName, "is_sparse_diskgroup_enabled", "false"),
255256
resource.TestCheckResourceAttr(resourceName, "license_model", "LICENSE_INCLUDED"),
257+
resource.TestCheckResourceAttr(resourceName, "ocpu_count", "4"),
256258
resource.TestCheckResourceAttrSet(resourceName, "shape"),
257259
resource.TestCheckResourceAttr(resourceName, "ssh_public_keys.#", "1"),
258260
resource.TestCheckResourceAttrSet(resourceName, "state"),
@@ -295,6 +297,7 @@ func TestDatabaseCloudVmClusterResource_basic(t *testing.T) {
295297
resource.TestCheckResourceAttr(resourceName, "is_local_backup_enabled", "true"),
296298
resource.TestCheckResourceAttr(resourceName, "is_sparse_diskgroup_enabled", "false"),
297299
resource.TestCheckResourceAttr(resourceName, "license_model", "LICENSE_INCLUDED"),
300+
resource.TestCheckResourceAttr(resourceName, "ocpu_count", "4"),
298301
resource.TestCheckResourceAttr(resourceName, "scan_listener_port_tcp", "1521"),
299302
resource.TestCheckResourceAttr(resourceName, "scan_listener_port_tcp_ssl", "2484"),
300303
resource.TestCheckResourceAttrSet(resourceName, "shape"),
@@ -334,6 +337,7 @@ func TestDatabaseCloudVmClusterResource_basic(t *testing.T) {
334337
resource.TestCheckResourceAttr(resourceName, "is_local_backup_enabled", "true"),
335338
resource.TestCheckResourceAttr(resourceName, "is_sparse_diskgroup_enabled", "false"),
336339
resource.TestCheckResourceAttr(resourceName, "license_model", "LICENSE_INCLUDED"),
340+
resource.TestCheckResourceAttr(resourceName, "ocpu_count", "4"),
337341
resource.TestCheckResourceAttrSet(resourceName, "shape"),
338342
resource.TestCheckResourceAttr(resourceName, "ssh_public_keys.#", "1"),
339343
resource.TestCheckResourceAttrSet(resourceName, "state"),
@@ -381,6 +385,7 @@ func TestDatabaseCloudVmClusterResource_basic(t *testing.T) {
381385
resource.TestCheckResourceAttr(datasourceName, "cloud_vm_clusters.0.license_model", "LICENSE_INCLUDED"),
382386
resource.TestCheckResourceAttrSet(datasourceName, "cloud_vm_clusters.0.listener_port"),
383387
resource.TestCheckResourceAttrSet(datasourceName, "cloud_vm_clusters.0.node_count"),
388+
resource.TestCheckResourceAttr(datasourceName, "cloud_vm_clusters.0.ocpu_count", "4"),
384389
resource.TestCheckResourceAttrSet(datasourceName, "cloud_vm_clusters.0.scan_dns_name"),
385390
resource.TestCheckResourceAttrSet(datasourceName, "cloud_vm_clusters.0.shape"),
386391
resource.TestCheckResourceAttr(datasourceName, "cloud_vm_clusters.0.ssh_public_keys.#", "1"),
@@ -417,6 +422,7 @@ func TestDatabaseCloudVmClusterResource_basic(t *testing.T) {
417422
resource.TestCheckResourceAttr(singularDatasourceName, "license_model", "LICENSE_INCLUDED"),
418423
resource.TestCheckResourceAttrSet(singularDatasourceName, "listener_port"),
419424
resource.TestCheckResourceAttrSet(singularDatasourceName, "node_count"),
425+
resource.TestCheckResourceAttr(singularDatasourceName, "ocpu_count", "4"),
420426
resource.TestCheckResourceAttrSet(singularDatasourceName, "scan_dns_name"),
421427
resource.TestCheckResourceAttrSet(singularDatasourceName, "shape"),
422428
resource.TestCheckResourceAttr(singularDatasourceName, "ssh_public_keys.#", "1"),

website/docs/r/database_cloud_vm_cluster.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ resource "oci_database_cloud_vm_cluster" "test_cloud_vm_cluster" {
3939
is_sparse_diskgroup_enabled = var.cloud_vm_cluster_is_sparse_diskgroup_enabled
4040
license_model = var.cloud_vm_cluster_license_model
4141
nsg_ids = var.cloud_vm_cluster_nsg_ids
42+
ocpu_count = var.cloud_vm_cluster_ocpu_count
4243
scan_listener_port_tcp = var.cloud_vm_cluster_scan_listener_port_tcp
4344
scan_listener_port_tcp_ssl = var.cloud_vm_cluster_scan_listener_port_tcp_ssl
4445
time_zone = var.cloud_vm_cluster_time_zone
@@ -78,6 +79,7 @@ The following arguments are supported:
7879
* `license_model` - (Optional) (Updatable) The Oracle license model that applies to the cloud VM cluster. The default is BRING_YOUR_OWN_LICENSE.
7980
* `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:**
8081
* Autonomous Databases with private access require at least 1 Network Security Group (NSG). The nsgIds array cannot be empty.
82+
* `ocpu_count` - (Optional) (Updatable) The number of OCPU cores to enable for a cloud VM cluster. Only 1 decimal place is allowed for the fractional part.
8183
* `scan_listener_port_tcp` - (Optional) The TCP Single Client Access Name (SCAN) port. The default port is 1521.
8284
* `scan_listener_port_tcp_ssl` - (Optional) The TCPS Single Client Access Name (SCAN) port. The default port is 2484.
8385
* `ssh_public_keys` - (Required) (Updatable) The public key portion of one or more key pairs used for SSH access to the cloud VM cluster.
@@ -127,6 +129,7 @@ The following attributes are exported:
127129
* `node_count` - The number of nodes in the cloud VM cluster.
128130
* `nsg_ids` - 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:**
129131
* Autonomous Databases with private access require at least 1 Network Security Group (NSG). The nsgIds array cannot be empty.
132+
* `ocpu_count` - The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part.
130133
* `scan_dns_name` - The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster.
131134
* `scan_dns_record_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster.
132135
* `scan_ip_ids` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the Single Client Access Name (SCAN) IP addresses associated with the cloud VM cluster. SCAN IP addresses are typically used for load balancing and are not assigned to any interface. Oracle Clusterware directs the requests to the appropriate nodes in the cluster.

0 commit comments

Comments
 (0)