Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add optional arguments for Oracle VMCluster creation (domain and scan listener ports) #27808

Merged
merged 12 commits into from
Nov 4, 2024
Merged
52 changes: 51 additions & 1 deletion internal/services/oracle/cloud_vm_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ type CloudVmClusterResourceModel struct {
ClusterName string `tfschema:"cluster_name"`
DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"`
DataStoragePercentage int64 `tfschema:"data_storage_percentage"`
Domain string `tfschema:"domain"`
IsLocalBackupEnabled bool `tfschema:"local_backup_enabled"`
IsSparseDiskgroupEnabled bool `tfschema:"sparse_diskgroup_enabled"`
Ocid string `tfschema:"ocid"`
ScanListenerPortTcp int64 `tfschema:"scan_listener_port_tcp"`
ScanListenerPortTcpSsl int64 `tfschema:"scan_listener_port_tcp_ssl"`
TimeZone string `tfschema:"time_zone"`
ZoneId string `tfschema:"zone_id"`
}

func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema {
Expand Down Expand Up @@ -223,6 +227,13 @@ func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema {
ValidateFunc: validate.DataStoragePercentage,
},

"domain": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"local_backup_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand All @@ -237,13 +248,36 @@ func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema {
ForceNew: true,
},

"scan_listener_port_tcp": {
Type: pluginsdk.TypeInt,
Optional: true,
Default: 1521,
ForceNew: true,
ValidateFunc: validation.IntBetween(1024, 8999),
},

"scan_listener_port_tcp_ssl": {
Type: pluginsdk.TypeInt,
Optional: true,
Default: 2484,
ForceNew: true,
ValidateFunc: validation.IntBetween(1024, 8999),
},

"time_zone": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"zone_id": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"tags": commonschema.Tags(),
}
}
Expand Down Expand Up @@ -325,8 +359,20 @@ func (r CloudVmClusterResource) Create() sdk.ResourceFunc {
IsIncidentLogsEnabled: pointer.To(model.DataCollectionOptions[0].IsIncidentLogsEnabled),
}
}
if model.Domain != "" {
param.Properties.Domain = pointer.To(model.Domain)
}
if model.ScanListenerPortTcp >= 1024 && model.ScanListenerPortTcp <= 8999 {
param.Properties.ScanListenerPortTcp = pointer.To(model.ScanListenerPortTcp)
}
if model.ScanListenerPortTcpSsl >= 1024 && model.ScanListenerPortTcpSsl <= 8999 {
param.Properties.ScanListenerPortTcpSsl = pointer.To(model.ScanListenerPortTcpSsl)
}
if model.TimeZone != "" {
param.Properties.ClusterName = pointer.To(model.TimeZone)
param.Properties.TimeZone = pointer.To(model.TimeZone)
}
if model.ZoneId != "" {
param.Properties.ZoneId = pointer.To(model.ZoneId)
}
if model.DataStoragePercentage != 0 {
param.Properties.DataStoragePercentage = pointer.To(model.DataStoragePercentage)
Expand Down Expand Up @@ -443,10 +489,14 @@ func (CloudVmClusterResource) Read() sdk.ResourceFunc {
state.ClusterName = pointer.From(props.ClusterName)
state.DataCollectionOptions = FlattenDataCollectionOptions(props.DataCollectionOptions)
state.DataStoragePercentage = pointer.From(props.DataStoragePercentage)
state.Domain = pointer.From(props.Domain)
state.Ocid = pointer.From(props.Ocid)
state.IsLocalBackupEnabled = pointer.From(props.IsLocalBackupEnabled)
state.IsSparseDiskgroupEnabled = pointer.From(props.IsSparseDiskgroupEnabled)
state.ScanListenerPortTcp = pointer.From(props.ScanListenerPortTcp)
state.ScanListenerPortTcpSsl = pointer.From(props.ScanListenerPortTcpSsl)
state.TimeZone = pointer.From(props.TimeZone)
state.ZoneId = pointer.From(props.ZoneId)
}
}

Expand Down
4 changes: 4 additions & 0 deletions internal/services/oracle/cloud_vm_cluster_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ resource "azurerm_oracle_cloud_vm_cluster" "test" {
db_node_storage_size_in_gbs = 120
db_servers = [for obj in data.azurerm_oracle_db_servers.test.db_servers : obj.ocid]
display_name = "OFakeVmacctest%[2]d"
domain = "ociofakeacctes.com"
gi_version = "23.0.0.0"
local_backup_enabled = true
sparse_diskgroup_enabled = true
Expand All @@ -142,10 +143,13 @@ resource "azurerm_oracle_cloud_vm_cluster" "test" {
hostname = "hostname"
ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN [email protected]"]
subnet_id = azurerm_subnet.virtual_network_subnet.id
scan_listener_port_tcp = 1521
scan_listener_port_tcp_ssl = 2484
tags = {
test = "testTag1"
}
time_zone = "UTC"
zone_id = "ocid1.dns-zone.oc1.iad.aaaaaaaac7lyw74bnybmlek7nrsd5h3v5kjfv3aiw62menpuuwoder7yhmpa"
virtual_network_id = azurerm_virtual_network.virtual_network.id
}`, a.template(data), data.RandomInteger, data.Locations.Primary)
}
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/oracle_cloud_vm_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,24 @@ The following arguments are supported:

* `db_node_storage_size_in_gbs` - (Optional) The local node storage to be allocated in GBs.

* `domain` - (Optional) The name of the OCI Private DNS Zone to be associated with the Cloud VM Cluster. This is required for specifying your own private domain name.

* `local_backup_enabled` - (Optional) If true, database backup on local Exadata storage is configured for the Cloud VM Cluster. If `false`, database backup on local Exadata storage is not available in the Cloud VM Cluster.

* `sparse_diskgroup_enabled` - (Optional) If true, the sparse disk group is configured for the Cloud VM Cluster. If `false`, the sparse disk group is not created.

* `memory_size_in_gbs` - (Optional) The memory to be allocated in GBs.

* `scan_listener_port_tcp` - (Optional) The TCP Single Client Access Name (SCAN) port. The default port to 1521.

* `scan_listener_port_tcp_ssl` - (Optional) The TCPS Single Client Access Name (SCAN) port. The default port to 2484.

* `tags` - (Optional) A mapping of tags which should be assigned to the Cloud VM Cluster.

* `time_zone` - (Optional) The time zone of the Cloud VM Cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.cloud.oracle.com/iaas/Content/Database/References/timezones.htm).

* `zone_id` - (Optional) The OCID of the OCI Private DNS Zone to be associated with the Cloud VM Cluster. This is required for specifying your own private domain name.

---

A `data_collection_options` block supports the following:
Expand Down
Loading