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_create.tf #422

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
180 changes: 106 additions & 74 deletions Multicloud/Azure/exa_vmcluster_create.tf
Original file line number Diff line number Diff line change
@@ -1,95 +1,127 @@
variable "resource_group_name" {
description = "Name of the resource group"
default = "ExampleRG"
}

variable "location" {
description = "Location for the resources"
default = "eastus"
}

variable "cloud_exadata_infrastructure_name" {
description = "Name of the cloud Exadata infrastructure"
default = "ExampleName"
}

variable "exa_cluster_name" {
description = "Name of the Exadata VM Cluster"
default = "ExampleCluster"
}

variable "cloud_exadata_infra_id" {
description = "Cloud Exadata Infrastructure ID"
default = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"
}

variable "vnet_id" {
description = "Virtual network ID"
default = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"
}

variable "subnet_id" {
description = "Subnet ID"
default = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"
}

variable "ssh_public_key" {
description = "SSH public key for VM cluster"
default = "ssh-rsa AAAAB3...yourkeyhere"
}

# Resource Group
resource "azapi_resource" "resource_group" {
type = "Microsoft.Resources/resourceGroups@2023-07-01"
name = "ExampleRG" location = "eastus"
name = var.resource_group_name
location = var.location
}

// OperationId: CloudExadataInfrastructures_CreateOrUpdate, CloudExadataInfrastructures_Get, CloudExadataInfrastructures_Delete
// PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}
resource "azapi_resource" "cloudExadataInfrastructure" {
# Cloud Exadata Infrastructure
resource "azapi_resource" "cloud_exadata_infrastructure" {
type = "Oracle.Database/cloudExadataInfrastructures@2023-09-01-preview"
parent_id = azapi_resource.resource_group.id
name = "ExampleName"
name = var.cloud_exadata_infrastructure_name
body = jsonencode({
"location" : "eastus",
"zones" : [
"2"
],
"tags" : {
"createdby" : "ExampleName"
location = var.location,
zones = ["2"],
tags = {
createdby = var.cloud_exadata_infrastructure_name
},
"properties" : {
"computeCount" : 2,
"displayName" : "ExampleName",
"maintenanceWindow" : {
"leadTimeInWeeks" : 0,
"preference" : "NoPreference",
"patchingMode" : "Rolling"
properties = {
computeCount = 2,
displayName = var.cloud_exadata_infrastructure_name,
maintenanceWindow = {
leadTimeInWeeks = 0,
preference = "NoPreference",
patchingMode = "Rolling"
},
"shape" : "Exadata.X9M",
"storageCount" : 3
shape = "Exadata.X9M",
storageCount = 3
}
})
schema_validation_enabled = false
}

//-------------VMCluster resources ------------
// OperationId: CloudVmClusters_CreateOrUpdate, CloudVmClusters_Get, CloudVmClusters_Delete
// PUT GET DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}
resource "azapi_resource" "cloudVmCluster" {
# Cloud VM Cluster
resource "azapi_resource" "cloud_vm_cluster" {
type = "Oracle.Database/cloudVmClusters@2023-09-01-preview"
parent_id = azapi_resource.resourceGroup.id
name = local.exa_cluster_name
parent_id = azapi_resource.resource_group.id
name = var.exa_cluster_name
schema_validation_enabled = false
depends_on = [azapi_resource.cloudExadataInfrastructure]
body = jsonencode({
"properties": {
"dataStorageSizeInTbs": 1000,
"dbNodeStorageSizeInGbs": 1000,
"memorySizeInGbs": 1000,
"timeZone": "UTC",
"hostname": "hostname1",
"domain": "domain1",
"cpuCoreCount": 2,
"ocpuCount": 3,
"clusterName": "cluster1",
"dataStoragePercentage": 100,
"isLocalBackupEnabled": false,
"cloudExadataInfrastructureId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1",
"isSparseDiskgroupEnabled": false,
"sshPublicKeys": [
"ssh-key 1"
],
"nsgCidrs": [
{
"source": "10.0.0.0/16",
"destinationPortRange": {
"min": 1520,
"max": 1522
}
},
{
"source": "10.10.0.0/24"
depends_on = [azapi_resource.cloud_exadata_infrastructure]
body = jsonencode({
properties = {
dataStorageSizeInTbs = 1000,
dbNodeStorageSizeInGbs = 1000,
memorySizeInGbs = 1000,
timeZone = "UTC",
hostname = "hostname1",
domain = "domain1",
cpuCoreCount = 2,
ocpuCount = 3,
clusterName = var.exa_cluster_name,
dataStoragePercentage = 100,
isLocalBackupEnabled = false,
cloudExadataInfrastructureId = var.cloud_exadata_infra_id,
isSparseDiskgroupEnabled = false,
sshPublicKeys = [var.ssh_public_key],
nsgCidrs = [
{
source = "10.0.0.0/16",
destinationPortRange = {
min = 1520,
max = 1522
}
],
"licenseModel": "LicenseIncluded",
"scanListenerPortTcp": 1050,
"scanListenerPortTcpSsl": 1025,
"vnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1",
"giVersion": "19.0.0.0",
"subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
"backupSubnetCidr": "172.17.5.0/24",
"dataCollectionOptions": {
"isDiagnosticsEventsEnabled": false,
"isHealthMonitoringEnabled": false,
"isIncidentLogsEnabled": false
},
"displayName": "cluster 1",
"dbServers": [
"ocid1..aaaa"
]
{
source = "10.10.0.0/24"
}
],
licenseModel = "LicenseIncluded",
scanListenerPortTcp = 1050,
scanListenerPortTcpSsl = 1025,
vnetId = var.vnet_id,
giVersion = "19.0.0.0",
subnetId = var.subnet_id,
backupSubnetCidr = "172.17.5.0/24",
dataCollectionOptions = {
isDiagnosticsEventsEnabled = false,
isHealthMonitoringEnabled = false,
isIncidentLogsEnabled = false
},
"location": "eastus"
}
})
displayName = var.exa_cluster_name,
dbServers = ["ocid1..aaaa"]
},
location = var.location
})
response_export_values = ["properties.ocid"]
}