Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update exa_vmcluster_list.tf #423

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update exa_vmcluster_list.tf
Here’s the updated and refined code with improved structure, reusability, and corrections for consistency in resource types and IDs
yuvashrikarunakaran authored Dec 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 61e59a1dd1b3d6c31cb04411342ea78796419482
44 changes: 24 additions & 20 deletions Multicloud/Azure/exa_vmcluster_list.tf
Original file line number Diff line number Diff line change
@@ -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"
}