From bd87b7914a4c2de8573cb0e51a41aa86ac6c5537 Mon Sep 17 00:00:00 2001 From: jackofallops <11830746+jackofallops@users.noreply.github.com> Date: Thu, 17 Oct 2024 09:57:23 +0200 Subject: [PATCH] Revert "new resource and data source : azurerm_oracle_cloud_vm_cluster (#27176)" This reverts commit cb8d847dc2e10ce7987234cf61d64dd59ec1e511. --- .teamcity/components/generated/services.kt | 2 +- internal/clients/client.go | 6 +- internal/provider/services.go | 4 +- internal/services/oracle/client/client.go | 29 - .../oracle/cloud_vm_cluster_data_source.go | 611 ------------------ .../cloud_vm_cluster_data_source_test.go | 44 -- .../oracle/cloud_vm_cluster_resource.go | 504 --------------- .../oracle/cloud_vm_cluster_resource_test.go | 273 -------- .../services/oracle/db_servers_data_source.go | 247 ------- .../oracle/db_servers_data_source_test.go | 47 -- .../oracle/validate/cloud_vm_cluster.go | 98 --- .../services/oracledatabase/client/client.go | 26 + .../exadata_infrastructure_data_source.go | 4 +- ...exadata_infrastructure_data_source_test.go | 6 +- .../exadata_infrastructure_resource.go | 12 +- .../exadata_infrastructure_resource_test.go | 16 +- .../registration.go | 9 +- .../validate/exadata_infrastructure.go | 4 +- website/allowed-subcategories | 2 +- .../d/oracle_cloud_vm_cluster.html.markdown | 179 ----- .../docs/d/oracle_db_servers.html.markdown | 88 --- ...base_exadata_infrastructure.html.markdown} | 2 +- .../r/oracle_cloud_vm_cluster.html.markdown | 167 ----- ...base_exadata_infrastructure.html.markdown} | 2 +- 24 files changed, 59 insertions(+), 2323 deletions(-) delete mode 100644 internal/services/oracle/client/client.go delete mode 100644 internal/services/oracle/cloud_vm_cluster_data_source.go delete mode 100644 internal/services/oracle/cloud_vm_cluster_data_source_test.go delete mode 100644 internal/services/oracle/cloud_vm_cluster_resource.go delete mode 100644 internal/services/oracle/cloud_vm_cluster_resource_test.go delete mode 100644 internal/services/oracle/db_servers_data_source.go delete mode 100644 internal/services/oracle/db_servers_data_source_test.go delete mode 100644 internal/services/oracle/validate/cloud_vm_cluster.go create mode 100644 internal/services/oracledatabase/client/client.go rename internal/services/{oracle => oracledatabase}/exadata_infrastructure_data_source.go (99%) rename internal/services/{oracle => oracledatabase}/exadata_infrastructure_data_source_test.go (90%) rename internal/services/{oracle => oracledatabase}/exadata_infrastructure_resource.go (96%) rename internal/services/{oracle => oracledatabase}/exadata_infrastructure_resource_test.go (89%) rename internal/services/{oracle => oracledatabase}/registration.go (84%) rename internal/services/{oracle => oracledatabase}/validate/exadata_infrastructure.go (98%) delete mode 100644 website/docs/d/oracle_cloud_vm_cluster.html.markdown delete mode 100644 website/docs/d/oracle_db_servers.html.markdown rename website/docs/d/{oracle_exadata_infrastructure.html.markdown => oracledatabase_exadata_infrastructure.html.markdown} (99%) delete mode 100644 website/docs/r/oracle_cloud_vm_cluster.html.markdown rename website/docs/r/{oracle_exadata_infrastructure.html.markdown => oracledatabase_exadata_infrastructure.html.markdown} (99%) diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index a84ce744aaa8..f70ec7ae8653 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -90,7 +90,7 @@ var services = mapOf( "newrelic" to "New Relic", "nginx" to "Nginx", "notificationhub" to "Notification Hub", - "oracle" to "Oracle", + "oracledatabase" to "Oracle Database", "orbital" to "Orbital", "paloalto" to "Palo Alto", "policy" to "Policy", diff --git a/internal/clients/client.go b/internal/clients/client.go index a6d41ef7e774..384faa8fd86a 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -106,7 +106,7 @@ import ( newrelic "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic/client" nginx "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx/client" notificationhub "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub/client" - oracle "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/client" + oracledatabase "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase/client" orbital "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital/client" paloalto "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto/client" policy "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/client" @@ -237,7 +237,7 @@ type Client struct { NewRelic *newrelic.Client Nginx *nginx_2024_06_01_preview.Client NotificationHubs *notificationhub.Client - Oracle *oracle.Client + OracleDatabase *oracledatabase.Client Orbital *orbital.Client PaloAlto *paloalto.Client Policy *policy.Client @@ -534,7 +534,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.NotificationHubs, err = notificationhub.NewClient(o); err != nil { return fmt.Errorf("building clients for NotificationHubs: %+v", err) } - if client.Oracle, err = oracle.NewClient(o); err != nil { + if client.OracleDatabase, err = oracledatabase.NewClient(o); err != nil { return fmt.Errorf("building clients for OracleDatabase: %+v", err) } if client.Orbital, err = orbital.NewClient(o); err != nil { diff --git a/internal/provider/services.go b/internal/provider/services.go index 1ce4a513b544..6da74bc6f280 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -90,7 +90,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/newrelic" "github.com/hashicorp/terraform-provider-azurerm/internal/services/nginx" "github.com/hashicorp/terraform-provider-azurerm/internal/services/notificationhub" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" "github.com/hashicorp/terraform-provider-azurerm/internal/services/orbital" "github.com/hashicorp/terraform-provider-azurerm/internal/services/paloalto" "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy" @@ -189,7 +189,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { networkfunction.Registration{}, newrelic.Registration{}, nginx.Registration{}, - oracle.Registration{}, + oracledatabase.Registration{}, orbital.Registration{}, paloalto.Registration{}, policy.Registration{}, diff --git a/internal/services/oracle/client/client.go b/internal/services/oracle/client/client.go deleted file mode 100644 index f99a558ad81f..000000000000 --- a/internal/services/oracle/client/client.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package client - -import ( - v2024_06_01 "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - "github.com/hashicorp/terraform-provider-azurerm/internal/common" -) - -type Client struct { - OracleClient *v2024_06_01.Client -} - -func NewClient(o *common.ClientOptions) (*Client, error) { - // ORP (backend for ODB@A) partly builds its idempotency keys based on correlationIds sent by client. - // It seems that AzureRM provider sends the same correlationId for each request during an apply. - // We need each request to have a different correlationId. By disabling this, Azure will provide a unique correlationId instead. - o.DisableCorrelationRequestID = true - oracleClient, err := v2024_06_01.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { - o.Configure(c, o.Authorizers.ResourceManager) - }) - if err != nil { - return nil, err - } - return &Client{ - OracleClient: oracleClient, - }, nil -} diff --git a/internal/services/oracle/cloud_vm_cluster_data_source.go b/internal/services/oracle/cloud_vm_cluster_data_source.go deleted file mode 100644 index 95830d8dd5b5..000000000000 --- a/internal/services/oracle/cloud_vm_cluster_data_source.go +++ /dev/null @@ -1,611 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle - -import ( - "context" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" - "github.com/hashicorp/terraform-provider-azurerm/utils" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type CloudVmClusterDataSource struct{} - -type CloudVmClusterDataModel struct { - Name string `tfschema:"name"` - Type string `tfschema:"type"` - Tags map[string]interface{} `tfschema:"tags"` - - // SystemData - SystemData []SystemDataModel `tfschema:"system_data"` - - // CloudVMClusterProperties - BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` - CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` - ClusterName string `tfschema:"cluster_name"` - CompartmentId string `tfschema:"compartment_id"` - ComputeNodes []string `tfschema:"compute_nodes"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` - DataStoragePercentage int64 `tfschema:"data_storage_percentage"` - DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DbServers []string `tfschema:"db_servers"` - DiskRedundancy string `tfschema:"disk_redundancy"` - DisplayName string `tfschema:"display_name"` - Domain string `tfschema:"domain"` - GiVersion string `tfschema:"gi_version"` - Hostname string `tfschema:"hostname"` - HostnameActual string `tfschema:"hostname_actual"` - IormConfigCache []ExadataIormConfigModel `tfschema:"iorm_config_cache"` - IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` - IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` - LastUpdateHistoryEntryId string `tfschema:"last_update_history_entry_id"` - LicenseModel string `tfschema:"license_model"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - ListenerPort int64 `tfschema:"listener_port"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - NodeCount int64 `tfschema:"node_count"` - NsgUrl string `tfschema:"nsg_url"` - OciUrl string `tfschema:"oci_url"` - Ocid string `tfschema:"ocid"` - OcpuCount float64 `tfschema:"ocpu_count"` - ProvisioningState string `tfschema:"provisioning_state"` - ScanDnsName string `tfschema:"scan_dns_name"` - ScanDnsRecordId string `tfschema:"scan_dns_record_id"` - ScanIPIds []string `tfschema:"scan_ip_ids"` - ScanListenerPortTcp int64 `tfschema:"scan_listener_port_tcp"` - ScanListenerPortTcpSsl int64 `tfschema:"scan_listener_port_tcp_ssl"` - Shape string `tfschema:"shape"` - SshPublicKeys []string `tfschema:"ssh_public_keys"` - StorageSizeInGbs int64 `tfschema:"storage_size_in_gbs"` - SubnetId string `tfschema:"subnet_id"` - SubnetOcid string `tfschema:"subnet_ocid"` - SystemVersion string `tfschema:"system_version"` - TimeCreated string `tfschema:"time_created"` - TimeZone string `tfschema:"time_zone"` - VipIds []string `tfschema:"vip_ods"` - VnetId string `tfschema:"vnet_id"` - ZoneId string `tfschema:"zone_id"` -} - -type DataCollectionOptionsModel struct { - IsDiagnosticsEventsEnabled bool `tfschema:"is_diagnostics_events_enabled"` - IsHealthMonitoringEnabled bool `tfschema:"is_health_monitoring_enabled"` - IsIncidentLogsEnabled bool `tfschema:"is_incident_logs_enabled"` -} - -type ExadataIormConfigModel struct { - DbPlans []DbIormConfigModel `tfschema:"db_plans"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - Objective string `tfschema:"objective"` -} - -type DbIormConfigModel struct { - DbName string `tfschema:"db_name"` - FlashCacheLimit string `tfschema:"flash_cache_limit"` - Share int64 `tfschema:"share"` -} - -func (d CloudVmClusterDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.Name, - }, - } -} - -func (d CloudVmClusterDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "location": commonschema.LocationComputed(), - - "type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - // SystemData - "system_data": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "created_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "created_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "created_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "last_modified_by": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "last_modified_by_type": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "last_modified_at": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - // CloudVMClusterProperties - "backup_subnet_cidr": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "cloud_exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "cluster_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "compartment_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "compute_nodes": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "data_collection_options": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "is_diagnostics_events_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "is_health_monitoring_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "is_incident_logs_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - }, - }, - }, - - "data_storage_percentage": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "db_servers": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "disk_redundancy": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "domain": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "gi_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "hostname": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "hostname_actual": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "iorm_config_cache": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "db_plans": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "db_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "flash_cache_limit": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "share": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - }, - }, - }, - - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "objective": { - Type: pluginsdk.TypeString, - Computed: true, - }, - }, - }, - }, - - "is_local_backup_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "is_sparse_diskgroup_enabled": { - Type: pluginsdk.TypeBool, - Computed: true, - }, - - "last_update_history_entry_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "license_model": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "listener_port": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "node_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "nsg_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "oci_url": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "ocpu_count": { - Type: pluginsdk.TypeFloat, - Computed: true, - }, - - "provisioning_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "scan_dns_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "scan_dns_record_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "scan_ip_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "scan_listener_port_tcp": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "scan_listener_port_tcp_ssl": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "shape": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "ssh_public_keys": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "subnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "subnet_ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "system_version": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "time_zone": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "vip_ods": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "vnet_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "zone_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "tags": commonschema.TagsDataSource(), - } -} - -func (d CloudVmClusterDataSource) ModelObject() interface{} { - return nil -} - -func (d CloudVmClusterDataSource) ResourceType() string { - return "azurerm_oracle_cloud_vm_cluster" -} - -func (d CloudVmClusterDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudvmclusters.ValidateCloudVMClusterID -} - -func (d CloudVmClusterDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudVMClusters - subscriptionId := metadata.Client.Account.SubscriptionId - - id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("name").(string)) - - resp, err := client.Get(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - err := metadata.ResourceData.Set("location", location.NormalizeNilable(&model.Location)) - if err != nil { - return err - } - - var output CloudVmClusterDataModel - prop := model.Properties - if prop != nil { - output = CloudVmClusterDataModel{ - BackupSubnetCidr: pointer.From(prop.BackupSubnetCidr), - CloudExadataInfrastructureId: prop.CloudExadataInfrastructureId, - ClusterName: pointer.From(prop.ClusterName), - CompartmentId: pointer.From(prop.CompartmentId), - ComputeNodes: pointer.From(prop.ComputeNodes), - CpuCoreCount: prop.CpuCoreCount, - DataStoragePercentage: pointer.From(prop.DataStoragePercentage), - DataStorageSizeInTbs: pointer.From(prop.DataStorageSizeInTbs), - DbNodeStorageSizeInGbs: pointer.From(prop.DbNodeStorageSizeInGbs), - DbServers: pointer.From(prop.DbServers), - DiskRedundancy: string(pointer.From(prop.DiskRedundancy)), - DisplayName: prop.DisplayName, - Domain: pointer.From(prop.Domain), - GiVersion: prop.GiVersion, - Hostname: removeHostnameSuffix(prop.Hostname), - HostnameActual: prop.Hostname, - IormConfigCache: FlattenExadataIormConfig(prop.IormConfigCache), - IsLocalBackupEnabled: pointer.From(prop.IsLocalBackupEnabled), - IsSparseDiskgroupEnabled: pointer.From(prop.IsSparseDiskgroupEnabled), - LastUpdateHistoryEntryId: pointer.From(prop.LastUpdateHistoryEntryId), - LicenseModel: string(pointer.From(prop.LicenseModel)), - LifecycleDetails: pointer.From(prop.LifecycleDetails), - LifecycleState: string(*prop.LifecycleState), - ListenerPort: pointer.From(prop.ListenerPort), - MemorySizeInGbs: pointer.From(prop.MemorySizeInGbs), - NodeCount: pointer.From(prop.NodeCount), - NsgUrl: pointer.From(prop.NsgURL), - OciUrl: pointer.From(prop.OciURL), - Ocid: pointer.From(prop.Ocid), - ProvisioningState: string(pointer.From(prop.ProvisioningState)), - Shape: pointer.From(prop.Shape), - StorageSizeInGbs: pointer.From(prop.StorageSizeInGbs), - SubnetId: prop.SubnetId, - SubnetOcid: pointer.From(prop.SubnetOcid), - SystemVersion: pointer.From(prop.SystemVersion), - TimeCreated: pointer.From(prop.TimeCreated), - TimeZone: pointer.From(prop.TimeZone), - ZoneId: pointer.From(prop.ZoneId), - } - } - - systemData := model.SystemData - if systemData != nil { - output.SystemData = []SystemDataModel{ - { - CreatedBy: systemData.CreatedBy, - CreatedByType: systemData.CreatedByType, - CreatedAt: systemData.CreatedAt, - LastModifiedBy: systemData.LastModifiedBy, - LastModifiedbyType: systemData.LastModifiedbyType, - LastModifiedAt: systemData.LastModifiedAt, - }, - } - } - output.Name = id.CloudVmClusterName - output.Type = pointer.From(model.Type) - output.Tags = utils.FlattenPtrMapStringString(model.Tags) - - metadata.SetID(id) - return metadata.Encode(&output) - } - return nil - }, - } -} - -func FlattenExadataIormConfig(exadataIormConfig *cloudvmclusters.ExadataIormConfig) []ExadataIormConfigModel { - if exadataIormConfig != nil { - var dbIormConfigModel []DbIormConfigModel - if exadataIormConfig.DbPlans != nil { - dbPlans := *exadataIormConfig.DbPlans - for _, dbPlan := range dbPlans { - dbIormConfigModel = append(dbIormConfigModel, DbIormConfigModel{ - DbName: pointer.From(dbPlan.DbName), - FlashCacheLimit: pointer.From(dbPlan.FlashCacheLimit), - Share: pointer.From(dbPlan.Share), - }) - } - } - return []ExadataIormConfigModel{ - { - DbPlans: dbIormConfigModel, - LifecycleDetails: pointer.From(exadataIormConfig.LifecycleDetails), - LifecycleState: string(pointer.From(exadataIormConfig.LifecycleState)), - Objective: string(pointer.From(exadataIormConfig.Objective)), - }, - } - } - return nil -} diff --git a/internal/services/oracle/cloud_vm_cluster_data_source_test.go b/internal/services/oracle/cloud_vm_cluster_data_source_test.go deleted file mode 100644 index b320338160c8..000000000000 --- a/internal/services/oracle/cloud_vm_cluster_data_source_test.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" -) - -type CloudVmClusterDataSource struct{} - -func TestCloudVmClusterDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.CloudVmClusterDataSource{}.ResourceType(), "test") - r := CloudVmClusterDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("location").Exists(), - check.That(data.ResourceName).Key("name").Exists(), - check.That(data.ResourceName).Key("resource_group_name").Exists(), - check.That(data.ResourceName).Key("cloud_exadata_infrastructure_id").Exists(), - check.That(data.ResourceName).Key("display_name").Exists(), - check.That(data.ResourceName).Key("cpu_core_count").Exists(), - ), - }, - }) -} - -func (d CloudVmClusterDataSource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -data "azurerm_oracle_cloud_vm_cluster" "test" { - name = azurerm_oracle_cloud_vm_cluster.test.name - resource_group_name = azurerm_oracle_cloud_vm_cluster.test.resource_group_name -} -`, CloudVmClusterResource{}.basic(data)) -} diff --git a/internal/services/oracle/cloud_vm_cluster_resource.go b/internal/services/oracle/cloud_vm_cluster_resource.go deleted file mode 100644 index f22d30597ad3..000000000000 --- a/internal/services/oracle/cloud_vm_cluster_resource.go +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" - "github.com/hashicorp/terraform-provider-azurerm/utils" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -var _ sdk.Resource = CloudVmClusterResource{} - -type CloudVmClusterResource struct{} - -type CloudVmClusterResourceModel struct { - // Azure - Location string `tfschema:"location"` - Name string `tfschema:"name"` - ResourceGroupName string `tfschema:"resource_group_name"` - Tags map[string]interface{} `tfschema:"tags"` - - // Required - CloudExadataInfrastructureId string `tfschema:"cloud_exadata_infrastructure_id"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DataStorageSizeInTbs float64 `tfschema:"data_storage_size_in_tbs"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DbServers []string `tfschema:"db_servers"` - DisplayName string `tfschema:"display_name"` - GiVersion string `tfschema:"gi_version"` - Hostname string `tfschema:"hostname"` - HostnameActual string `tfschema:"hostname_actual"` - LicenseModel string `tfschema:"license_model"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - SshPublicKeys []string `tfschema:"ssh_public_keys"` - SubnetId string `tfschema:"subnet_id"` - VnetId string `tfschema:"vnet_id"` - - // Optional - BackupSubnetCidr string `tfschema:"backup_subnet_cidr"` - ClusterName string `tfschema:"cluster_name"` - DataCollectionOptions []DataCollectionOptionsModel `tfschema:"data_collection_options"` - DataStoragePercentage int64 `tfschema:"data_storage_percentage"` - IsLocalBackupEnabled bool `tfschema:"is_local_backup_enabled"` - IsSparseDiskgroupEnabled bool `tfschema:"is_sparse_diskgroup_enabled"` - TimeZone string `tfschema:"time_zone"` -} - -func (CloudVmClusterResource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - // Azure - "location": commonschema.Location(), - - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.Name, - }, - - "resource_group_name": commonschema.ResourceGroupName(), - - // Required - "cloud_exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: cloudexadatainfrastructures.ValidateCloudExadataInfrastructureID, - }, - - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Required: true, - ValidateFunc: validate.CpuCoreCount, - }, - - "data_storage_size_in_tbs": { - Type: pluginsdk.TypeFloat, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: validate.DataStorageSizeInTbs, - }, - - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - - "db_servers": { - Type: pluginsdk.TypeList, - Required: true, - ForceNew: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "display_name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.Name, - }, - - "gi_version": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - - "hostname": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - - "license_model": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validate.LicenseModel, - }, - - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Optional: true, - Computed: true, - }, - - "ssh_public_keys": { - Type: pluginsdk.TypeList, - Required: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "subnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - - "vnet_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - }, - - // Optional - "backup_subnet_cidr": { - Type: pluginsdk.TypeString, - Optional: true, - }, - - "cluster_name": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - - "data_collection_options": { - Type: pluginsdk.TypeList, - Optional: true, - Computed: true, - MaxItems: 1, - MinItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "is_diagnostics_events_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - - "is_health_monitoring_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - - "is_incident_logs_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - }, - }, - }, - }, - - "data_storage_percentage": { - Type: schema.TypeInt, - Optional: true, - Computed: true, - ForceNew: true, - ValidateFunc: validate.DataStoragePercentage, - }, - - "is_local_backup_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - ForceNew: true, - }, - - "is_sparse_diskgroup_enabled": { - Type: pluginsdk.TypeBool, - Optional: true, - Computed: true, - ForceNew: true, - }, - - "time_zone": { - Type: pluginsdk.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - - "tags": commonschema.Tags(), - } -} - -func (CloudVmClusterResource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "hostname_actual": { - Type: pluginsdk.TypeString, - Computed: true, - }, - } -} - -func (CloudVmClusterResource) ModelObject() interface{} { - return &CloudVmClusterResource{} -} - -func (CloudVmClusterResource) ResourceType() string { - return "azurerm_oracle_cloud_vm_cluster" -} - -func (r CloudVmClusterResource) Create() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 24 * time.Hour, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudVMClusters - subscriptionId := metadata.Client.Account.SubscriptionId - - var model CloudVmClusterResourceModel - if err := metadata.Decode(&model); err != nil { - return err - } - - id := cloudvmclusters.NewCloudVMClusterID(subscriptionId, - model.ResourceGroupName, - model.Name) - - existing, err := client.Get(ctx, id) - if err != nil && !response.WasNotFound(existing.HttpResponse) { - return fmt.Errorf("checking for presence of existing %s: %+v", id, err) - } - if !response.WasNotFound(existing.HttpResponse) { - return metadata.ResourceRequiresImport(r.ResourceType(), id) - } - - param := cloudvmclusters.CloudVMCluster{ - // Azure - Name: pointer.To(model.Name), - Location: model.Location, - Tags: tags.Expand(model.Tags), - Properties: &cloudvmclusters.CloudVMClusterProperties{ - // Required - CloudExadataInfrastructureId: model.CloudExadataInfrastructureId, - CpuCoreCount: model.CpuCoreCount, - DbServers: pointer.To(model.DbServers), - DisplayName: model.DisplayName, - GiVersion: model.GiVersion, - Hostname: model.Hostname, - LicenseModel: pointer.To(cloudvmclusters.LicenseModel(model.LicenseModel)), - SshPublicKeys: model.SshPublicKeys, - SubnetId: model.SubnetId, - VnetId: model.VnetId, - }, - } - - if model.BackupSubnetCidr != "" { - param.Properties.BackupSubnetCidr = pointer.To(model.BackupSubnetCidr) - } - if model.ClusterName != "" { - param.Properties.ClusterName = pointer.To(model.ClusterName) - } - if model.DataCollectionOptions != nil && len(model.DataCollectionOptions) > 0 { - param.Properties.DataCollectionOptions = &cloudvmclusters.DataCollectionOptions{ - IsDiagnosticsEventsEnabled: pointer.To(model.DataCollectionOptions[0].IsDiagnosticsEventsEnabled), - IsHealthMonitoringEnabled: pointer.To(model.DataCollectionOptions[0].IsHealthMonitoringEnabled), - IsIncidentLogsEnabled: pointer.To(model.DataCollectionOptions[0].IsIncidentLogsEnabled), - } - } - if model.TimeZone != "" { - param.Properties.ClusterName = pointer.To(model.TimeZone) - } - if model.DataStoragePercentage != 0 { - param.Properties.DataStoragePercentage = pointer.To(model.DataStoragePercentage) - } - if model.DataStorageSizeInTbs != 0 { - param.Properties.DataStorageSizeInTbs = pointer.To(model.DataStorageSizeInTbs) - } - if model.DbNodeStorageSizeInGbs != 0 { - param.Properties.DbNodeStorageSizeInGbs = pointer.To(model.DbNodeStorageSizeInGbs) - } - param.Properties.IsLocalBackupEnabled = pointer.To(model.IsLocalBackupEnabled) - param.Properties.IsSparseDiskgroupEnabled = pointer.To(model.IsSparseDiskgroupEnabled) - if model.MemorySizeInGbs != 0 { - param.Properties.MemorySizeInGbs = pointer.To(model.MemorySizeInGbs) - } - - if err := client.CreateOrUpdateThenPoll(ctx, id, param); err != nil { - return fmt.Errorf("creating %s: %+v", id, err) - } - - metadata.SetID(id) - return nil - }, - } -} - -func (r CloudVmClusterResource) Update() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - - client := metadata.Client.Oracle.OracleClient.CloudVMClusters - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - var model CloudVmClusterResourceModel - if err = metadata.Decode(&model); err != nil { - return fmt.Errorf("decoding err: %+v", err) - } - - existing, err := client.Get(ctx, *id) - if err != nil { - return fmt.Errorf("retrieving exists when updating: +%v", *id) - } - if existing.Model == nil && existing.Model.Properties == nil { - return fmt.Errorf("retrieving as nil when updating for %v", *id) - } - - if metadata.ResourceData.HasChangesExcept("tags") { - return fmt.Errorf("only `tags` currently support updates") - } - if metadata.ResourceData.HasChange("tags") { - update := &cloudvmclusters.CloudVMClusterUpdate{ - Tags: tags.Expand(model.Tags), - } - err = client.UpdateThenPoll(ctx, *id, *update) - if err != nil { - return fmt.Errorf("updating %s: %v", id, err) - } - } - return nil - }, - } -} - -func (CloudVmClusterResource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - client := metadata.Client.Oracle.OracleClient.CloudVMClusters - result, err := client.Get(ctx, *id) - if err != nil { - if response.WasNotFound(result.HttpResponse) { - return metadata.MarkAsGone(id) - } - return err - } - - if result.Model == nil { - return fmt.Errorf("retrieving %s got nil model", id) - } - var output CloudVmClusterResourceModel - - // Azure - output.Name = pointer.ToString(result.Model.Name) - output.Location = result.Model.Location - output.Tags = utils.FlattenPtrMapStringString(result.Model.Tags) - output.ResourceGroupName = id.ResourceGroupName - // Required - output.CloudExadataInfrastructureId = result.Model.Properties.CloudExadataInfrastructureId - output.CpuCoreCount = result.Model.Properties.CpuCoreCount - output.DataStorageSizeInTbs = pointer.From(result.Model.Properties.DataStorageSizeInTbs) - output.DbNodeStorageSizeInGbs = pointer.From(result.Model.Properties.DbNodeStorageSizeInGbs) - output.DbServers = pointer.From(result.Model.Properties.DbServers) - output.DisplayName = result.Model.Properties.DisplayName - output.GiVersion = result.Model.Properties.GiVersion - output.Hostname = removeHostnameSuffix(result.Model.Properties.Hostname) - output.HostnameActual = result.Model.Properties.Hostname - output.LicenseModel = string(pointer.From(result.Model.Properties.LicenseModel)) - output.MemorySizeInGbs = pointer.From(result.Model.Properties.MemorySizeInGbs) - output.SshPublicKeys = result.Model.Properties.SshPublicKeys - tmp := make([]string, 0) - for _, key := range result.Model.Properties.SshPublicKeys { - if key != "" { - tmp = append(tmp, key) - } - } - output.SshPublicKeys = tmp - output.SubnetId = result.Model.Properties.SubnetId - output.VnetId = result.Model.Properties.VnetId - // Optional - output.BackupSubnetCidr = pointer.From(result.Model.Properties.BackupSubnetCidr) - output.ClusterName = pointer.From(result.Model.Properties.ClusterName) - output.DataCollectionOptions = FlattenDataCollectionOptions(result.Model.Properties.DataCollectionOptions) - output.DataStoragePercentage = pointer.From(result.Model.Properties.DataStoragePercentage) - output.IsLocalBackupEnabled = pointer.From(result.Model.Properties.IsLocalBackupEnabled) - output.IsSparseDiskgroupEnabled = pointer.From(result.Model.Properties.IsSparseDiskgroupEnabled) - output.TimeZone = pointer.From(result.Model.Properties.TimeZone) - - return metadata.Encode(&output) - }, - } -} - -func (CloudVmClusterResource) Delete() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudVMClusters - - id, err := cloudvmclusters.ParseCloudVMClusterID(metadata.ResourceData.Id()) - if err != nil { - return err - } - - if err = client.DeleteThenPoll(ctx, *id); err != nil { - return fmt.Errorf("deleting %s: %+v", *id, err) - } - - return nil - }, - } -} - -func (CloudVmClusterResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return cloudvmclusters.ValidateCloudVMClusterID -} - -func FlattenDataCollectionOptions(dataCollectionOptions *cloudvmclusters.DataCollectionOptions) []DataCollectionOptionsModel { - if dataCollectionOptions != nil { - return []DataCollectionOptionsModel{ - { - IsDiagnosticsEventsEnabled: pointer.From(dataCollectionOptions.IsDiagnosticsEventsEnabled), - IsHealthMonitoringEnabled: pointer.From(dataCollectionOptions.IsHealthMonitoringEnabled), - IsIncidentLogsEnabled: pointer.From(dataCollectionOptions.IsIncidentLogsEnabled), - }, - } - } - return nil -} - -func removeHostnameSuffix(hostnameActual string) string { - suffixIndex := strings.LastIndex(hostnameActual, "-") - if suffixIndex != -1 { - return hostnameActual[:suffixIndex] - } else { - return hostnameActual - } -} - -// DbSystemHostnameDiffSuppress When submitting a request to DBaaS a suffix will be added to the Hostname, -// therefore when computing the diff if the new Hostname is a prefix of the old then we will ignore the diff. -// Example: Initial plan -> testHostname, final result after DBaaS -> testHostname-abc. -// Since testHostname is a prefix of testHostname-abc, then computed diff is zero. -func DbSystemHostnameDiffSuppress(_ string, old string, new string, _ *schema.ResourceData) bool { - return EqualSuppressDiff(old, new) || NewIsPrefixOfOldDiffSuppress(old, new) -} - -func NewIsPrefixOfOldDiffSuppress(old string, new string) bool { - return strings.HasPrefix(strings.ToLower(old), strings.ToLower(new)) -} - -func EqualSuppressDiff(old string, new string) bool { - return old == new -} diff --git a/internal/services/oracle/cloud_vm_cluster_resource_test.go b/internal/services/oracle/cloud_vm_cluster_resource_test.go deleted file mode 100644 index 41afa655b231..000000000000 --- a/internal/services/oracle/cloud_vm_cluster_resource_test.go +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle_test - -import ( - "context" - "fmt" - "testing" - - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" - - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" - "github.com/hashicorp/terraform-provider-azurerm/utils" -) - -type CloudVmClusterResource struct{} - -func (a CloudVmClusterResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) - if err != nil { - return nil, err - } - resp, err := client.Oracle.OracleClient.CloudVMClusters.Get(ctx, *id) - if err != nil { - return nil, fmt.Errorf("retrieving cloud vm cluster %s: %+v", id, err) - } - return utils.Bool(resp.Model != nil), nil -} - -func (a CloudVmClusterResource) Destroy(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := cloudvmclusters.ParseCloudVMClusterID(state.ID) - if err != nil { - return nil, err - } - if _, err := client.Oracle.OracleClient.CloudVMClusters.Delete(ctx, *id); err != nil { - return nil, fmt.Errorf("deleting vm cluster %s: %+v", id, err) - } - return utils.Bool(true), nil -} - -func TestCloudVmClusterResource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestCloudVmClusterResource_complete(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.allFields(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func TestCloudVmClusterResource_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.RequiresImportErrorStep(r.requiresImport), - }) -} - -func TestCloudVmClusterResource_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.CloudVmClusterResource{}.ResourceType(), "test") - r := CloudVmClusterResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - { - Config: r.update(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).ExistsInAzure(r), - ), - }, - data.ImportStep(), - }) -} - -func (a CloudVmClusterResource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - %s -resource "azurerm_oracle_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracle_exadata_infrastructure.test.id - cpu_core_count = 4 - data_storage_size_in_tbs = 2 - 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" - gi_version = "23.0.0.0" - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) allFields(data acceptance.TestData) string { - return fmt.Sprintf(` - %s -resource "azurerm_oracle_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracle_exadata_infrastructure.test.id - cpu_core_count = 4 - data_collection_options { - is_diagnostics_events_enabled = true - is_health_monitoring_enabled = true - is_incident_logs_enabled = true - } - data_storage_size_in_tbs = 2 - 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" - gi_version = "23.0.0.0" - is_local_backup_enabled = true - is_sparse_diskgroup_enabled = true - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - tags = { - test = "testTag1" - } - time_zone = "UTC" - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) update(data acceptance.TestData) string { - return fmt.Sprintf(` -%s -resource "azurerm_oracle_cloud_vm_cluster" "test" { - location = "%[3]s" - name = "OFakeVmacctest%[2]d" - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_id = azurerm_oracle_exadata_infrastructure.test.id - cpu_core_count = 4 - data_storage_size_in_tbs = 2 - 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" - gi_version = "23.0.0.0" - license_model = "BringYourOwnLicense" - memory_size_in_gbs = 60 - hostname = "hostname" - ssh_public_keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+wWK73dCr+jgQOAxNsHAnNNNMEMWOHYEccp6wJm2gotpr9katuF/ZAdou5AaW1C61slRkHRkpRRX9FA9CYBiitZgvCCz+3nWNN7l/Up54Zps/pHWGZLHNJZRYyAB6j5yVLMVHIHriY49d/GZTZVNB8GoJv9Gakwc/fuEZYYl4YDFiGMBP///TzlI4jhiJzjKnEvqPFki5p2ZRJqcbCiF4pJrxUQR/RXqVFQdbRLZgYfJ8xGB878RENq3yQ39d8dVOkq4edbkzwcUmwwwkYVPIoDGsYLaRHnG+To7FvMeyO7xDVQkMKzopTQV8AuKpyvpqu0a9pWOMaiCyDytO7GGN you@me.com"] - subnet_id = azurerm_subnet.virtual_network_subnet.id - tags = { - test = "testTag1" - } - vnet_id = azurerm_virtual_network.virtual_network.id -}`, a.template(data), data.RandomInteger, data.Locations.Primary) -} - -func (a CloudVmClusterResource) requiresImport(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_oracle_cloud_vm_cluster" "import" { - location = azurerm_oracle_cloud_vm_cluster.test.location - name = azurerm_oracle_cloud_vm_cluster.test.name - resource_group_name = azurerm_oracle_cloud_vm_cluster.test.resource_group_name - cloud_exadata_infrastructure_id = azurerm_oracle_cloud_vm_cluster.test.cloud_exadata_infrastructure_id - cpu_core_count = azurerm_oracle_cloud_vm_cluster.test.cpu_core_count - data_storage_size_in_tbs = azurerm_oracle_cloud_vm_cluster.test.data_storage_size_in_tbs - db_node_storage_size_in_gbs = azurerm_oracle_cloud_vm_cluster.test.db_node_storage_size_in_gbs - db_servers = azurerm_oracle_cloud_vm_cluster.test.db_servers - display_name = azurerm_oracle_cloud_vm_cluster.test.display_name - gi_version = azurerm_oracle_cloud_vm_cluster.test.gi_version - license_model = azurerm_oracle_cloud_vm_cluster.test.license_model - memory_size_in_gbs = azurerm_oracle_cloud_vm_cluster.test.memory_size_in_gbs - hostname = azurerm_oracle_cloud_vm_cluster.test.hostname - ssh_public_keys = azurerm_oracle_cloud_vm_cluster.test.ssh_public_keys - subnet_id = azurerm_oracle_cloud_vm_cluster.test.subnet_id - vnet_id = azurerm_oracle_cloud_vm_cluster.test.vnet_id -} -`, a.basic(data)) -} - -func (a CloudVmClusterResource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - features {} -} - -data "azurerm_client_config" "current" {} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-%[1]d" - location = "%[2]s" -} - -resource "azurerm_virtual_network" "virtual_network" { - name = "OFakeacctest%[1]d_vnet" - address_space = ["10.0.0.0/16"] - location = "%[2]s" - resource_group_name = azurerm_resource_group.test.name -} - -resource "azurerm_subnet" "virtual_network_subnet" { - name = "OFakeacctest%[1]d" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.virtual_network.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - actions = [ - "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", - ] - name = "Oracle.Database/networkAttachments" - } - } -} - -resource "azurerm_oracle_exadata_infrastructure" "test" { - name = "OFakeacctest%[1]d" - location = "%[2]s" - resource_group_name = azurerm_resource_group.test.name - compute_count = "2" - display_name = "OFakeacctest%[1]d" - shape = "Exadata.X9M" - storage_count = "3" - zones = ["3"] -} - -data "azurerm_oracle_db_servers" "test" { - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_name = azurerm_oracle_exadata_infrastructure.test.name -} - - -`, data.RandomInteger, data.Locations.Primary, data.RandomString) -} diff --git a/internal/services/oracle/db_servers_data_source.go b/internal/services/oracle/db_servers_data_source.go deleted file mode 100644 index 9c4653e963e7..000000000000 --- a/internal/services/oracle/db_servers_data_source.go +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle - -import ( - "context" - "fmt" - "time" - - "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/dbservers" - - "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" -) - -type DBServersDataSource struct{} - -type DBServersDataModel struct { - DBServers []DBServerDataModel `tfschema:"db_servers"` -} - -type DBServerDataModel struct { - AutonomousVMClusterIds []string `tfschema:"autonomous_vm_cluster_ids"` - AutonomousVirtualMachineIds []string `tfschema:"autonomous_virtual_machine_ds"` - CompartmentId string `tfschema:"compartment_id"` - CpuCoreCount int64 `tfschema:"cpu_core_count"` - DbNodeIds []string `tfschema:"db_node_ids"` - DbNodeStorageSizeInGbs int64 `tfschema:"db_node_storage_size_in_gbs"` - DisplayName string `tfschema:"display_name"` - ExadataInfrastructureId string `tfschema:"exadata_infrastructure_id"` - LifecycleDetails string `tfschema:"lifecycle_details"` - LifecycleState string `tfschema:"lifecycle_state"` - MaxCPUCount int64 `tfschema:"max_cpu_count"` - MaxDbNodeStorageInGbs int64 `tfschema:"max_db_node_storage_in_gbs"` - MaxMemoryInGbs int64 `tfschema:"max_memory_in_gbs"` - MemorySizeInGbs int64 `tfschema:"memory_size_in_gbs"` - Ocid string `tfschema:"ocid"` - ProvisioningState string `tfschema:"provisioning_state"` - Shape string `tfschema:"shape"` - TimeCreated string `tfschema:"time_created"` - VMClusterIds []string `tfschema:"vm_cluster_ids"` -} - -func (d DBServersDataSource) Arguments() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "resource_group_name": commonschema.ResourceGroupNameForDataSource(), - - "cloud_exadata_infrastructure_name": { - Type: pluginsdk.TypeString, - Required: true, - }, - } -} - -func (d DBServersDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{ - "db_servers": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "autonomous_vm_cluster_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "autonomous_virtual_machine_ds": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "compartment_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "cpu_core_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "db_node_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "db_node_storage_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "display_name": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "exadata_infrastructure_id": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "lifecycle_details": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "lifecycle_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "max_cpu_count": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "max_db_node_storage_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "max_memory_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "memory_size_in_gbs": { - Type: pluginsdk.TypeInt, - Computed: true, - }, - - "ocid": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "provisioning_state": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "shape": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "time_created": { - Type: pluginsdk.TypeString, - Computed: true, - }, - - "vm_cluster_ids": { - Type: pluginsdk.TypeList, - Computed: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - } -} - -func (d DBServersDataSource) ModelObject() interface{} { - return nil -} - -func (d DBServersDataSource) ResourceType() string { - return "azurerm_oracle_db_servers" -} - -func (d DBServersDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { - return dbservers.ValidateDbServerID -} - -func (d DBServersDataSource) Read() sdk.ResourceFunc { - return sdk.ResourceFunc{ - Timeout: 5 * time.Minute, - Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.DbServers - subscriptionId := metadata.Client.Account.SubscriptionId - - id := dbservers.NewCloudExadataInfrastructureID(subscriptionId, - metadata.ResourceData.Get("resource_group_name").(string), - metadata.ResourceData.Get("cloud_exadata_infrastructure_name").(string)) - - resp, err := client.ListByCloudExadataInfrastructure(ctx, id) - if err != nil { - if response.WasNotFound(resp.HttpResponse) { - return fmt.Errorf("%s was not found", id) - } - return fmt.Errorf("retrieving %s: %+v", id, err) - } - - if model := resp.Model; model != nil { - output := DBServersDataModel{ - DBServers: make([]DBServerDataModel, 0), - } - for _, element := range *model { - if element.Properties != nil { - properties := element.Properties - dbServer := DBServerDataModel{ - AutonomousVMClusterIds: pointer.From(properties.AutonomousVMClusterIds), - AutonomousVirtualMachineIds: pointer.From(properties.AutonomousVirtualMachineIds), - CompartmentId: pointer.From(properties.CompartmentId), - CpuCoreCount: pointer.From(properties.CpuCoreCount), - DbNodeIds: pointer.From(properties.DbNodeIds), - DbNodeStorageSizeInGbs: pointer.From(properties.DbNodeStorageSizeInGbs), - DisplayName: pointer.From(properties.DisplayName), - ExadataInfrastructureId: pointer.From(properties.ExadataInfrastructureId), - LifecycleDetails: pointer.From(properties.LifecycleDetails), - LifecycleState: string(pointer.From(properties.LifecycleState)), - MaxCPUCount: pointer.From(properties.MaxCPUCount), - MaxDbNodeStorageInGbs: pointer.From(properties.MaxDbNodeStorageInGbs), - MaxMemoryInGbs: pointer.From(properties.MaxMemoryInGbs), - MemorySizeInGbs: pointer.From(properties.MemorySizeInGbs), - Ocid: pointer.From(properties.Ocid), - ProvisioningState: string(pointer.From(properties.ProvisioningState)), - Shape: pointer.From(properties.Shape), - TimeCreated: pointer.From(properties.TimeCreated), - VMClusterIds: pointer.From(properties.VMClusterIds), - } - output.DBServers = append(output.DBServers, dbServer) - } - } - metadata.SetID(id) - if err := metadata.Encode(&output); err != nil { - return fmt.Errorf("encoding %s: %+v", id, err) - } - } - return nil - }, - } -} diff --git a/internal/services/oracle/db_servers_data_source_test.go b/internal/services/oracle/db_servers_data_source_test.go deleted file mode 100644 index 4626a91c6056..000000000000 --- a/internal/services/oracle/db_servers_data_source_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright © 2024, Oracle and/or its affiliates. All rights reserved - -package oracle_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" - "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" -) - -type DBServersDataSource struct{} - -func TestDBServersDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, "data.azurerm_oracle_db_servers", "test") - r := DBServersDataSource{} - - data.DataSourceTest(t, []acceptance.TestStep{ - { - Config: r.basic(data), - Check: acceptance.ComposeTestCheckFunc( - check.That(data.ResourceName).Key("db_servers.0.compartment_id").Exists(), - ), - }, - }) -} - -func (d DBServersDataSource) basic(data acceptance.TestData) string { - return fmt.Sprintf(` - - -%s - -data "azurerm_oracle_db_servers" "test" { - resource_group_name = azurerm_resource_group.test.name - cloud_exadata_infrastructure_name = azurerm_oracle_exadata_infrastructure.test.name -} -`, d.template(data)) -} - -func (d DBServersDataSource) template(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -`, ExadataInfraResource{}.basic(data)) -} diff --git a/internal/services/oracle/validate/cloud_vm_cluster.go b/internal/services/oracle/validate/cloud_vm_cluster.go deleted file mode 100644 index 17789761046f..000000000000 --- a/internal/services/oracle/validate/cloud_vm_cluster.go +++ /dev/null @@ -1,98 +0,0 @@ -package validate - -import ( - "fmt" - "regexp" - "unicode" - "unicode/utf8" - - "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudvmclusters" -) - -func Name(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) - return - } - - if len(v) < 1 || len(v) > 255 { - errors = append(errors, fmt.Errorf("name must be %d to %d characters", 1, 255)) - return - } - - firstChar, _ := utf8.DecodeRuneInString(v) - if !unicode.IsLetter(firstChar) && firstChar != '_' { - errors = append(errors, fmt.Errorf("name must start with a letter or underscore (_)")) - return - } - - re := regexp.MustCompile("--") - if re.MatchString(v) { - errors = append(errors, fmt.Errorf("name must not contain any consecutive hyphers (--)")) - return - } - - return -} - -func CpuCoreCount(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(int) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) - return - } - - if v < 2 { - errors = append(errors, fmt.Errorf("cpu_core_count must be at least %v", 2)) - return - } - - return -} - -func DataStorageSizeInTbs(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(float64) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be float", k)) - return - } - - if v < 2 || v > 192 { - errors = append(errors, fmt.Errorf("%v must be between %v and %v", k, 2, 192)) - return - } - - return -} - -func LicenseModel(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) - return - } - - if v != string(cloudvmclusters.LicenseModelBringYourOwnLicense) && v != string(cloudvmclusters.LicenseModelLicenseIncluded) { - errors = append(errors, fmt.Errorf("%v must be %v or %v", k, - string(cloudvmclusters.LicenseModelBringYourOwnLicense), string(cloudvmclusters.LicenseModelLicenseIncluded))) - return - } - - return -} - -func DataStoragePercentage(i interface{}, k string) (warnings []string, errors []error) { - v, ok := i.(int) - if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be int", k)) - return - } - - if v != 35 && v != 40 && v != 60 && v != 80 { - errors = append(errors, fmt.Errorf("%v must 35, 40, 60 or 80", k)) - return - } - - return -} diff --git a/internal/services/oracledatabase/client/client.go b/internal/services/oracledatabase/client/client.go new file mode 100644 index 000000000000..6d3467596a8e --- /dev/null +++ b/internal/services/oracledatabase/client/client.go @@ -0,0 +1,26 @@ +// Copyright © 2024, Oracle and/or its affiliates. All rights reserved + +package client + +import ( + oracedatabase "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + OracleDatabaseClient *oracedatabase.Client +} + +func NewClient(o *common.ClientOptions) (*Client, error) { + o.DisableCorrelationRequestID = true + oracleDatabaseClient, err := oracedatabase.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, err + } + return &Client{ + OracleDatabaseClient: oracleDatabaseClient, + }, nil +} diff --git a/internal/services/oracle/exadata_infrastructure_data_source.go b/internal/services/oracledatabase/exadata_infrastructure_data_source.go similarity index 99% rename from internal/services/oracle/exadata_infrastructure_data_source.go rename to internal/services/oracledatabase/exadata_infrastructure_data_source.go index 2bbb258d226f..508a20647eb6 100644 --- a/internal/services/oracle/exadata_infrastructure_data_source.go +++ b/internal/services/oracledatabase/exadata_infrastructure_data_source.go @@ -1,6 +1,6 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracle +package oracledatabase import ( "context" @@ -420,7 +420,7 @@ func (d ExadataInfraDataSource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudExadataInfrastructures + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures subscriptionId := metadata.Client.Account.SubscriptionId id := cloudexadatainfrastructures.NewCloudExadataInfrastructureID(subscriptionId, diff --git a/internal/services/oracle/exadata_infrastructure_data_source_test.go b/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go similarity index 90% rename from internal/services/oracle/exadata_infrastructure_data_source_test.go rename to internal/services/oracledatabase/exadata_infrastructure_data_source_test.go index 4c6797d3222f..885dca07bb0a 100644 --- a/internal/services/oracle/exadata_infrastructure_data_source_test.go +++ b/internal/services/oracledatabase/exadata_infrastructure_data_source_test.go @@ -1,6 +1,6 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracle_test +package oracledatabase_test import ( "fmt" @@ -8,13 +8,13 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" ) type ExadataInfraDataSource struct{} func TestExadataInfraDataSource_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.ExadataInfraDataSource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraDataSource{}.ResourceType(), "test") r := ExadataInfraDataSource{} data.DataSourceTest(t, []acceptance.TestStep{ diff --git a/internal/services/oracle/exadata_infrastructure_resource.go b/internal/services/oracledatabase/exadata_infrastructure_resource.go similarity index 96% rename from internal/services/oracle/exadata_infrastructure_resource.go rename to internal/services/oracledatabase/exadata_infrastructure_resource.go index aa0911026cee..861d018e11a3 100644 --- a/internal/services/oracle/exadata_infrastructure_resource.go +++ b/internal/services/oracledatabase/exadata_infrastructure_resource.go @@ -1,6 +1,6 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracle +package oracledatabase import ( "context" @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -179,7 +179,7 @@ func (r ExadataInfraResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 120 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudExadataInfrastructures + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures subscriptionId := metadata.Client.Account.SubscriptionId var model ExadataInfraResourceModel @@ -240,7 +240,7 @@ func (r ExadataInfraResource) Update() sdk.ResourceFunc { Timeout: 30 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudExadataInfrastructures + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) if err != nil { return err @@ -286,7 +286,7 @@ func (ExadataInfraResource) Read() sdk.ResourceFunc { return err } - client := metadata.Client.Oracle.OracleClient.CloudExadataInfrastructures + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures result, err := client.Get(ctx, *id) if err != nil { if response.WasNotFound(result.HttpResponse) { @@ -323,7 +323,7 @@ func (ExadataInfraResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { - client := metadata.Client.Oracle.OracleClient.CloudExadataInfrastructures + client := metadata.Client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures id, err := cloudexadatainfrastructures.ParseCloudExadataInfrastructureID(metadata.ResourceData.Id()) if err != nil { diff --git a/internal/services/oracle/exadata_infrastructure_resource_test.go b/internal/services/oracledatabase/exadata_infrastructure_resource_test.go similarity index 89% rename from internal/services/oracle/exadata_infrastructure_resource_test.go rename to internal/services/oracledatabase/exadata_infrastructure_resource_test.go index 8fe187500703..3c195b54bc86 100644 --- a/internal/services/oracle/exadata_infrastructure_resource_test.go +++ b/internal/services/oracledatabase/exadata_infrastructure_resource_test.go @@ -1,6 +1,6 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracle_test +package oracledatabase_test import ( "context" @@ -8,7 +8,7 @@ import ( "testing" "github.com/hashicorp/go-azure-sdk/resource-manager/oracledatabase/2024-06-01/cloudexadatainfrastructures" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracle" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/oracledatabase" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -24,7 +24,7 @@ func (a ExadataInfraResource) Exists(ctx context.Context, client *clients.Client if err != nil { return nil, err } - resp, err := client.Oracle.OracleClient.CloudExadataInfrastructures.Get(ctx, *id) + resp, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("retrieving Exadata Infrastructure %s: %+v", id, err) } @@ -36,14 +36,14 @@ func (a ExadataInfraResource) Destroy(ctx context.Context, client *clients.Clien if err != nil { return nil, err } - if _, err := client.Oracle.OracleClient.CloudExadataInfrastructures.Delete(ctx, *id); err != nil { + if _, err := client.OracleDatabase.OracleDatabaseClient.CloudExadataInfrastructures.Delete(ctx, *id); err != nil { return nil, fmt.Errorf("deleting Exadata Infrastructure %s: %+v", id, err) } return utils.Bool(true), nil } func TestExaInfra_basic(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.ExadataInfraResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") r := ExadataInfraResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -57,7 +57,7 @@ func TestExaInfra_basic(t *testing.T) { } func TestExaInfra_allFields(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.ExadataInfraResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") r := ExadataInfraResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -71,7 +71,7 @@ func TestExaInfra_allFields(t *testing.T) { } func TestExaInfra_requiresImport(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.ExadataInfraResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") r := ExadataInfraResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { @@ -85,7 +85,7 @@ func TestExaInfra_requiresImport(t *testing.T) { } func TestExaInfra_update(t *testing.T) { - data := acceptance.BuildTestData(t, oracle.ExadataInfraResource{}.ResourceType(), "test") + data := acceptance.BuildTestData(t, oracledatabase.ExadataInfraResource{}.ResourceType(), "test") r := ExadataInfraResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { diff --git a/internal/services/oracle/registration.go b/internal/services/oracledatabase/registration.go similarity index 84% rename from internal/services/oracle/registration.go rename to internal/services/oracledatabase/registration.go index 4fd63cffb9f4..9fd0cf33ba27 100644 --- a/internal/services/oracle/registration.go +++ b/internal/services/oracledatabase/registration.go @@ -1,6 +1,6 @@ // Copyright © 2024, Oracle and/or its affiliates. All rights reserved -package oracle +package oracledatabase import ( "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -14,27 +14,24 @@ var ( func (r Registration) DataSources() []sdk.DataSource { return []sdk.DataSource{ - CloudVmClusterDataSource{}, - DBServersDataSource{}, ExadataInfraDataSource{}, } } func (r Registration) Resources() []sdk.Resource { return []sdk.Resource{ - CloudVmClusterResource{}, ExadataInfraResource{}, } } // Name is the name of this Service func (r Registration) Name() string { - return "Oracle" + return "Oracle Database" } // WebsiteCategories returns a list of categories which can be used for the sidebar func (r Registration) WebsiteCategories() []string { return []string{ - "Oracle", + "Oracle Database", } } diff --git a/internal/services/oracle/validate/exadata_infrastructure.go b/internal/services/oracledatabase/validate/exadata_infrastructure.go similarity index 98% rename from internal/services/oracle/validate/exadata_infrastructure.go rename to internal/services/oracledatabase/validate/exadata_infrastructure.go index 2a058520724b..2e163e450790 100644 --- a/internal/services/oracle/validate/exadata_infrastructure.go +++ b/internal/services/oracledatabase/validate/exadata_infrastructure.go @@ -129,7 +129,7 @@ func WeeksOfMonth(i interface{}, k string) (warnings []string, errors []error) { func Preference(i interface{}, k string) (warnings []string, errors []error) { v, ok := i.(string) if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + errors = append(errors, fmt.Errorf("expected type of %s to be list of strings", k)) return } @@ -145,7 +145,7 @@ func Preference(i interface{}, k string) (warnings []string, errors []error) { func PatchingMode(i interface{}, k string) (warnings []string, errors []error) { v, ok := i.(string) if !ok { - errors = append(errors, fmt.Errorf("expected type of %s to be string", k)) + errors = append(errors, fmt.Errorf("expected type of %s to be list of strings", k)) return } diff --git a/website/allowed-subcategories b/website/allowed-subcategories index f2245db4b136..76201e303d97 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -79,7 +79,7 @@ NetApp Network Network Function New Relic -Oracle +Oracle Database Orbital Palo Alto Policy diff --git a/website/docs/d/oracle_cloud_vm_cluster.html.markdown b/website/docs/d/oracle_cloud_vm_cluster.html.markdown deleted file mode 100644 index 7604d50e5c84..000000000000 --- a/website/docs/d/oracle_cloud_vm_cluster.html.markdown +++ /dev/null @@ -1,179 +0,0 @@ ---- -subcategory: "Oracle" -layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracle_cloud_vm_cluster" -description: |- - Gets information about an existing Cloud VM Cluster. ---- - -# Data Source: azurerm_oracle_cloud_vm_cluster - -Use this data source to access information about an existing Cloud VM Cluster. - -## Example Usage - -```hcl -data "azurerm_oracle_cloud_vm_cluster" "example" { - name = "existing" - resource_group_name = "existing" -} - -output "id" { - value = data.azurerm_oracle_cloud_vm_cluster.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `name` - (Required) The name of this Cloud VM Cluster. - -* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster exists. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Cloud VM Cluster. - -* `backup_subnet_cidr` - Client OCI backup subnet CIDR, default is `192.168.252.0/22`. - -* `cloud_exadata_infrastructure_id` - Cloud Exadata Infrastructure ID. - -* `cluster_name` - The cluster name for cloud VM cluster. - -* `compartment_id` - The OCID of the compartment. - -* `compute_nodes` - A `compute_nodes` block as defined below. - -* `cpu_core_count` - The number of CPU cores enabled on the cloud VM cluster. - -* `data_collection_options` - A `data_collection_options` block as defined below. - -* `data_storage_percentage` - The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are `35`, `40`, `60`, and 80. The default is `80` percent assigned to DATA storage. See [Storage Configuration](https://docs.oracle.com/en-us/iaas/exadatacloud/index.html#Exadata) in the Exadata documentation for details on the impact of the configuration settings on storage. - -* `data_storage_size_in_tbs` - The data disk group size to be allocated in TBs. - -* `db_node_storage_size_in_gbs` - The local node storage to be allocated in GBs. - -* `db_servers` - A `db_servers` block as defined below. - -* `disk_redundancy` - The type of redundancy configured for the cloud Vm cluster. `NORMAL` is 2-way redundancy. `HIGH` is 3-way redundancy. - -* `display_name` - The user-friendly name for the cloud VM cluster. The name does not need to be unique. - -* `domain` - The domain name for the cloud VM cluster. - -* `gi_version` - A valid Oracle Grid Infrastructure (GI) software version. - -* `hostname` - The hostname for the cloud VM cluster without suffix. - -* `hostname_actual` - The hostname for the cloud VM cluster with suffix. - -* `iorm_config_cache` - A `iorm_config_cache` block as defined below. - -* `is_local_backup_enabled` - 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. - -* `is_sparse_diskgroup_enabled` - If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. - -* `last_update_history_entry_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the last maintenance update history entry. This value is updated when a maintenance update starts. - -* `license_model` - The Oracle license model that applies to the cloud VM cluster. - -* `lifecycle_details` - Additional information about the current lifecycle state. - -* `lifecycle_state` - Cloud VM Cluster lifecycle state enum. - -* `listener_port` - The port number configured for the listener on the cloud VM cluster. - -* `location` - The Azure Region where the Cloud VM Cluster exists. - -* `memory_size_in_gbs` - The memory to be allocated in GBs. - -* `node_count` - The number of nodes in the cloud VM cluster. - -* `nsg_url` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) for the network security groups (NSGs) to which this resource belongs. Setting this to an empty list removes all resources from all NSGs. For more information about NSGs, see [Security Rules](https://docs.oracle.com/en-us/iaas/Content/Network/Concepts/securityrules.htm). NsgIds restrictions: - * A network security group (NSG) is optional for Autonomous Databases with private access. The nsgIds list can be empty. - -* `oci_url` - The URL of the resource in the OCI console. - -* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the cloud VM cluster. - -* `ocpu_count` - The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. - -* `provisioning_state` - Azure resource provisioning state. - -* `scan_dns_name` - The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - -* `scan_dns_record_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - -* `scan_ip_ids` - A `scan_ip_ids` block as defined below. - -* `scan_listener_port_tcp` - The TCP Single Client Access Name (SCAN) port. The default port is 1521. - -* `scan_listener_port_tcp_ssl` - The TCPS Single Client Access Name (SCAN) port. The default port is 2484. - -* `shape` - The model name of the Exadata hardware running the cloud VM cluster. - -* `ssh_public_keys` - The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - -* `storage_size_in_gbs` - The storage allocation for the disk group, in gigabytes (GB). - -* `subnet_id` - The ID of the Azure Resource Manager subnet resource. - -* `subnet_ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the subnet associated with the cloud VM cluster. - -* `system_data` - A `system_data` block as defined below. - -* `system_version` - Operating system version of the image. - -* `tags` - A mapping of tags assigned to the Cloud VM Cluster. - -* `time_created` - The date and time that the cloud VM cluster was created. - -* `time_zone` - The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](https://docs.oracle.com/en-us/iaas/base-database/doc/manage-time-zone.html). - -* `vip_ods` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the Exadata Cloud Service instance to enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. - -* `vnet_id` - The ID to an Azure Resource Manager vnet resource. - -* `zone_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the zone the cloud VM cluster is associated with. - ---- - -A `data_collection_options` block exports the following: - -* `is_diagnostics_events_enabled` - Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. - -* `is_health_monitoring_enabled` - Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. - -* `is_incident_logs_enabled` - Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. - ---- - -A `db_plans` block exports the following: - -* `db_name` - The database name. For the default `DbPlan`, the `dbName` is `default`. - -* `flash_cache_limit` - The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. - -* `share` - The relative priority of this database. - ---- - -A `iorm_config_cache` block exports the following: - -* `db_plans` - A `db_plans` block as defined above. - -* `lifecycle_details` - Additional information about the current `lifecycleState`. - -* `lifecycle_state` - The current state of IORM configuration for the Exadata DB system. - -* `objective` - The current value for the IORM objective. The default is `AUTO`. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. diff --git a/website/docs/d/oracle_db_servers.html.markdown b/website/docs/d/oracle_db_servers.html.markdown deleted file mode 100644 index 0f5952456fd8..000000000000 --- a/website/docs/d/oracle_db_servers.html.markdown +++ /dev/null @@ -1,88 +0,0 @@ ---- -subcategory: "Oracle" -layout: "azurerm" -page_title: "Azure Resource Manager: Data Source: azurerm_oracle_db_servers" -description: |- - Gets information about an existing DB Server. ---- - -# Data Source: azurerm_oracle_db_servers - -Use this data source to access information about an existing DB Server. - -## Example Usage - -```hcl -data "azurerm_oracle_db_servers" "example" { - resource_group_name = "existing" - cloud_exadata_infrastructure_name = "existing" -} - -output "id" { - value = data.azurerm_oracle_db_servers.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `cloud_exadata_infrastructure_name` - (Required) The name of the ExadataInfrastructure. - -* `resource_group_name` - (Required) The name of the Resource Group where the DB Server exists. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exacc Db server. - -* `db_servers` - A `db_servers` block as defined below. - ---- - -A `db_servers` block exports the following: - -* `autonomous_virtual_machine_ds` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous Virtual Machines associated with the Db server. - -* `autonomous_vm_cluster_ids` - The list of [OCIDs](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Autonomous VM Clusters associated with the Db server. - -* `compartment_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the compartment. - -* `cpu_core_count` - The number of CPU cores enabled on the Db server. - -* `db_node_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Db nodes associated with the Db server. - -* `db_node_storage_size_in_gbs` - The allocated local node storage in GBs on the Db server. - -* `display_name` - The user-friendly name for the Db server. The name does not need to be unique. - -* `exadata_infrastructure_id` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the Exadata infrastructure. - -* `lifecycle_details` - Additional information about the current lifecycle state. - -* `lifecycle_state` - The current state of the DB server. - -* `max_cpu_count` - The total number of CPU cores available. - -* `max_db_node_storage_in_gbs` -The total local node storage available in GBs. - -* `max_memory_in_gbs` - The total memory available in GBs. - -* `memory_size_in_gbs` - The allocated memory in GBs on the Db server. - -* `ocid` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the DB server. - -* `provisioning_state` - DbServer provisioning state. - -* `shape` - The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. - -* `time_created` - The date and time that the Db Server was created. - -* `vm_cluster_ids` - The [OCID](https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm) of the VM Clusters associated with the Db server. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `read` - (Defaults to 5 minutes) Used when retrieving the DB Server. diff --git a/website/docs/d/oracle_exadata_infrastructure.html.markdown b/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown similarity index 99% rename from website/docs/d/oracle_exadata_infrastructure.html.markdown rename to website/docs/d/oracledatabase_exadata_infrastructure.html.markdown index 8366bf2eb41b..f1527376c9a1 100644 --- a/website/docs/d/oracle_exadata_infrastructure.html.markdown +++ b/website/docs/d/oracledatabase_exadata_infrastructure.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Oracle" +subcategory: "Oracle Database" layout: "azurerm" page_title: "Azure Resource Manager: Data Source: azurerm_oracle_exadata_infrastructure" description: |- diff --git a/website/docs/r/oracle_cloud_vm_cluster.html.markdown b/website/docs/r/oracle_cloud_vm_cluster.html.markdown deleted file mode 100644 index 08690d308205..000000000000 --- a/website/docs/r/oracle_cloud_vm_cluster.html.markdown +++ /dev/null @@ -1,167 +0,0 @@ ---- -subcategory: "Oracle" -layout: "azurerm" -page_title: "Azure Resource Manager: azurerm_oracle_cloud_vm_cluster" -description: |- - Manages a Cloud VM Cluster. ---- - -# azurerm_oracle_cloud_vm_cluster - -Manages a Cloud VM Cluster. - -## Example Usage - -```hcl -resource "azurerm_resource_group" "example" { - name = "example-resources" - location = "West Europe" -} - -resource "azurerm_oracle_exadata_infrastructure" "example" { - name = "example-exadata-infrastructure" - display_name = "example-exadata-infrastructure" - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name - shape = "Exadata.X9M" - storage_count = "3" - compute_count = "2" - zones = ["3"] -} - -resource "azurerm_virtual_network" "example" { - name = "example-virtual-network" - address_space = ["10.0.0.0/16"] - location = azurerm_resource_group.example.location - resource_group_name = azurerm_resource_group.example.name -} - -resource "azurerm_subnet" "example" { - name = "example-subnet" - resource_group_name = azurerm_resource_group.example.name - virtual_network_name = azurerm_virtual_network.example.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "delegation" - - service_delegation { - actions = [ - "Microsoft.Network/networkinterfaces/*", - "Microsoft.Network/virtualNetworks/subnets/join/action", - ] - name = "Oracle.Database/networkAttachments" - } - } -} - -data "azurerm_oracle_db_servers" "example" { - resource_group_name = azurerm_resource_group.example.name - cloud_exadata_infrastructure_name = azurerm_oracle_exadata_infrastructure.example.name -} - -resource "azurerm_oracle_cloud_vm_cluster" "example" { - name = "example-cloud-vm-cluster" - resource_group_name = azurerm_resource_group.example.name - location = azurerm_resource_group.example.location - gi_version = "23.0.0.0" - vnet_id = azurerm_virtual_network.example.id - license_model = "BringYourOwnLicense" - db_servers = [for obj in data.azurerm_oracle_db_servers.example.db_servers : obj.ocid] - ssh_public_keys = [file("~/.ssh/id_rsa.pub")] - display_name = "example-cloud-vm-cluster" - cloud_exadata_infrastructure_id = azurerm_oracle_exadata_infrastructure.example.id - cpu_core_count = 2 - hostname = "hostname" - subnet_id = azurerm_subnet.example.id -} -``` - -## Arguments Reference - -The following arguments are supported: - -* `cloud_exadata_infrastructure_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the cloud Exadata infrastructure. - -* `cpu_core_count` - (Required) The number of CPU cores enabled on the cloud VM cluster. - -* `db_servers` - (Required) The list of DB servers. - -* `display_name` - (Required) The user-friendly name for the cloud VM cluster. The name does not need to be unique.. - -* `gi_version` - (Required) A valid Oracle Grid Infrastructure (GI) software version. - -* `hostname` - (Required) The hostname for the cloud VM cluster without suffix. - -* `hostname_actual` - The hostname for the cloud VM cluster with suffix. - -* `license_model` - (Required) The Oracle license model that applies to the cloud VM cluster, either `BringYourOwnLicense` or `LicenseIncluded`. - -* `location` - (Required) The Azure Region where the Cloud VM Cluster should exist. - -* `name` - (Required) The name which should be used for this Cloud VM Cluster. - -* `resource_group_name` - (Required) The name of the Resource Group where the Cloud VM Cluster should exist. - -* `ssh_public_keys` - (Required) The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - -* `subnet_id` - (Required) The ID of the subnet associated with the cloud VM cluster. - -* `vnet_id` - (Required) The ID of the vnet associated with the cloud VM cluster. - ---- - -* `backup_subnet_cidr` - (Optional) The backup subnet CIDR of the vnet associated with the cloud VM cluster.. - -* `cluster_name` - (Optional) The cluster name for cloud VM cluster. - -* `data_collection_options` - (Optional) A `data_collection_options` block as defined below. - -* `data_storage_percentage` - (Optional) The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups). Accepted values are `35`, `40`, `60` and `80`. - -* `data_storage_size_in_tbs` - (Optional) The data disk group size to be allocated in TBs. - -* `db_node_storage_size_in_gbs` - (Optional) The local node storage to be allocated in GBs. - -* `is_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. - -* `is_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. - -* `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). - ---- - -A `data_collection_options` block supports the following: - -* `is_diagnostics_events_enabled` - (Optional) Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. Enabling diagnostic collection allows you to receive Events service notifications for guest VM issues. Diagnostic collection also allows Oracle to provide enhanced service and proactive support for your Exadata system. You can enable diagnostic collection during VM cluster/Cloud VM cluster provisioning. You can also disable or enable it at any time using the `UpdateVmCluster` or `updateCloudVmCluster` API. - -* `is_health_monitoring_enabled` - (Optional) Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling health monitoring allows Oracle to collect diagnostic data and share it with its operations and support personnel. You may also receive notifications for some events. Collecting health diagnostics enables Oracle to provide proactive support and enhanced service for your system. Optionally enable health monitoring while provisioning a system. You can also disable or enable health monitoring anytime using the `UpdateVmCluster`, `UpdateCloudVmCluster` or `updateDbsystem` API. - -* `is_incident_logs_enabled` - (Optional) Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. Enabling incident logs collection allows Oracle to receive Events service notifications for guest VM issues, collect incident logs and traces, and use them to diagnose issues and resolve them. Optionally enable incident logs collection while provisioning a system. You can also disable or enable incident logs collection anytime using the `UpdateVmCluster`, `updateCloudVmCluster` or `updateDbsystem` API. - -## Attributes Reference - -In addition to the Arguments listed above - the following Attributes are exported: - -* `id` - The ID of the Cloud VM Cluster. - -## Timeouts - -The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: - -* `create` - (Defaults to 30 minutes) Used when creating the Cloud VM Cluster. -* `read` - (Defaults to 5 minutes) Used when retrieving the Cloud VM Cluster. -* `update` - (Defaults to 30 minutes) Used when updating the Cloud VM Cluster. -* `delete` - (Defaults to 30 minutes) Used when deleting the Cloud VM Cluster. - -## Import - -Cloud VM Clusters can be imported using the `resource id`, e.g. - -```shell -terraform import azurerm_oracle_cloud_vm_cluster.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup/providers/Oracle.Database/cloudVmClusters/cloudVmClusters1 -``` diff --git a/website/docs/r/oracle_exadata_infrastructure.html.markdown b/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown similarity index 99% rename from website/docs/r/oracle_exadata_infrastructure.html.markdown rename to website/docs/r/oracledatabase_exadata_infrastructure.html.markdown index a9f9d11b8391..debd4fa67153 100644 --- a/website/docs/r/oracle_exadata_infrastructure.html.markdown +++ b/website/docs/r/oracledatabase_exadata_infrastructure.html.markdown @@ -1,5 +1,5 @@ --- -subcategory: "Oracle" +subcategory: "Oracle Database" layout: "azurerm" page_title: "Azure Resource Manager: azurerm_oracle_exadata_infrastructure" description: |-