From 61e59a1dd1b3d6c31cb04411342ea78796419482 Mon Sep 17 00:00:00 2001 From: Yuva <94527987+yuvashrikarunakaran@users.noreply.github.com> Date: Sun, 15 Dec 2024 00:48:18 +0530 Subject: [PATCH] Update exa_vmcluster_list.tf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here’s the updated and refined code with improved structure, reusability, and corrections for consistency in resource types and IDs --- Multicloud/Azure/exa_vmcluster_list.tf | 44 ++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/Multicloud/Azure/exa_vmcluster_list.tf b/Multicloud/Azure/exa_vmcluster_list.tf index 9709a42c..7dcf8791 100644 --- a/Multicloud/Azure/exa_vmcluster_list.tf +++ b/Multicloud/Azure/exa_vmcluster_list.tf @@ -1,34 +1,38 @@ + # Get subscription details data "azapi_resource" "subscription" { type = "Microsoft.Resources/subscriptions@2020-06-01" response_export_values = ["*"] } -// OperationId: CloudExadataInfrastructures_ListBySubscription -// GET /subscriptions/{subscriptionId}/providers/Oracle.Database/cloudExadataInfrastructures -data "azapi_resource_list" "listCloudExadataInfrastructuresBySubscription" { - type = "Oracle.Database/cloudVmClusters@2023-09-01-preview" - parent_id = data.azapi_resource.subscription.id +# List all Oracle Exadata infrastructures under a subscription +data "azapi_resource_list" "list_cloud_exadata_infrastructures_by_subscription" { + type = "Oracle.Database/cloudExadataInfrastructures@2023-09-01-preview" + parent_id = data.azapi_resource.subscription.id } -// List Oracle Exadata VM Clusters by Resource Group +# Get existing resource group details +data "azurerm_resource_group" "existing" { + name = "existing-resource-group" +} -data "azurerm_resource_group" "example" { - name = "existing" +# List all Oracle Exadata infrastructures in a specific resource group +data "azapi_resource_list" "list_cloud_exadata_infrastructures_by_resource_group" { + type = "Oracle.Database/cloudExadataInfrastructures@2023-09-01-preview" + parent_id = data.azurerm_resource_group.existing.id } -// OperationId: CloudExadataInfrastructures_ListByResourceGroup -// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures -data "azapi_resource_list" "listCloudExadataInfrastructuresByResourceGroup" { - type = "Oracle.Database/cloudVmClusters@2023-09-01-preview" - parent_id = azurerm_resource_group.example.id +# Get Database Node information from a specific VM cluster +data "azapi_resource" "db_node" { + type = "Oracle.Database/cloudVmClusters/dbNodes@2023-09-01-preview" + parent_id = var.vm_cluster_id # Pass the VM Cluster ID dynamically + name = var.db_node_name # Pass the database node name dynamically } -// List Database Nodes on an Oracle Exadata VM Cluster +# Variables for VM Cluster ID and Database Node Name +variable "vm_cluster_id" { + description = "The resource ID of the Oracle Exadata VM Cluster" +} -// OperationId: DbNodes_Get -// GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid} -data "azapi_resource" "dbNode" { - type = "Oracle.Database/cloudVmClusters/dbNodes@2023-09-01-preview" - parent_id = azapi_resource.cloudVmCluster.id. // VM Cluster Id - name = var.resource_name +variable "db_node_name" { + description = "The name of the specific database node within the VM Cluster" }