1. Packages
  2. Opennebula Provider
  3. API Docs
  4. VirtualDataCenter
opennebula 1.4.1 published on Monday, Apr 14, 2025 by opennebula

opennebula.VirtualDataCenter

Explore with Pulumi AI

Provides an OpenNebula virtual data center resource.

This resource allows you to manage virtual data centers on your OpenNebula organization. When applied, a new virtual data center is created. When destroyed, this virtual data center is removed.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as opennebula from "@pulumi/opennebula";

const example = new opennebula.VirtualDataCenter("example", {
    groupIds: [opennebula_group.example.id],
    zones: [{
        id: 0,
        hostIds: [
            0,
            1,
        ],
        datastoreIds: [
            0,
            1,
            2,
        ],
        vnetIds: [opennebula_virtual_network.example.id],
        clusterIds: [
            0,
            100,
        ],
    }],
});
Copy
import pulumi
import pulumi_opennebula as opennebula

example = opennebula.VirtualDataCenter("example",
    group_ids=[opennebula_group["example"]["id"]],
    zones=[{
        "id": 0,
        "host_ids": [
            0,
            1,
        ],
        "datastore_ids": [
            0,
            1,
            2,
        ],
        "vnet_ids": [opennebula_virtual_network["example"]["id"]],
        "cluster_ids": [
            0,
            100,
        ],
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opennebula/opennebula"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := opennebula.NewVirtualDataCenter(ctx, "example", &opennebula.VirtualDataCenterArgs{
			GroupIds: pulumi.Float64Array{
				opennebula_group.Example.Id,
			},
			Zones: opennebula.VirtualDataCenterZoneArray{
				&opennebula.VirtualDataCenterZoneArgs{
					Id: pulumi.Float64(0),
					HostIds: pulumi.Float64Array{
						pulumi.Float64(0),
						pulumi.Float64(1),
					},
					DatastoreIds: pulumi.Float64Array{
						pulumi.Float64(0),
						pulumi.Float64(1),
						pulumi.Float64(2),
					},
					VnetIds: pulumi.Float64Array{
						opennebula_virtual_network.Example.Id,
					},
					ClusterIds: pulumi.Float64Array{
						pulumi.Float64(0),
						pulumi.Float64(100),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opennebula = Pulumi.Opennebula;

return await Deployment.RunAsync(() => 
{
    var example = new Opennebula.VirtualDataCenter("example", new()
    {
        GroupIds = new[]
        {
            opennebula_group.Example.Id,
        },
        Zones = new[]
        {
            new Opennebula.Inputs.VirtualDataCenterZoneArgs
            {
                Id = 0,
                HostIds = new[]
                {
                    0,
                    1,
                },
                DatastoreIds = new[]
                {
                    0,
                    1,
                    2,
                },
                VnetIds = new[]
                {
                    opennebula_virtual_network.Example.Id,
                },
                ClusterIds = new[]
                {
                    0,
                    100,
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opennebula.VirtualDataCenter;
import com.pulumi.opennebula.VirtualDataCenterArgs;
import com.pulumi.opennebula.inputs.VirtualDataCenterZoneArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new VirtualDataCenter("example", VirtualDataCenterArgs.builder()
            .groupIds(opennebula_group.example().id())
            .zones(VirtualDataCenterZoneArgs.builder()
                .id(0)
                .hostIds(                
                    0,
                    1)
                .datastoreIds(                
                    0,
                    1,
                    2)
                .vnetIds(opennebula_virtual_network.example().id())
                .clusterIds(                
                    0,
                    100)
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: opennebula:VirtualDataCenter
    properties:
      groupIds:
        - ${opennebula_group.example.id}
      zones:
        - id: 0
          hostIds:
            - 0
            - 1
          datastoreIds:
            - 0
            - 1
            - 2
          vnetIds:
            - ${opennebula_virtual_network.example.id}
          clusterIds:
            - 0
            - 100
Copy

Create VirtualDataCenter Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VirtualDataCenter(name: string, args?: VirtualDataCenterArgs, opts?: CustomResourceOptions);
@overload
def VirtualDataCenter(resource_name: str,
                      args: Optional[VirtualDataCenterArgs] = None,
                      opts: Optional[ResourceOptions] = None)

@overload
def VirtualDataCenter(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      group_ids: Optional[Sequence[float]] = None,
                      name: Optional[str] = None,
                      virtual_data_center_id: Optional[str] = None,
                      zones: Optional[Sequence[VirtualDataCenterZoneArgs]] = None)
func NewVirtualDataCenter(ctx *Context, name string, args *VirtualDataCenterArgs, opts ...ResourceOption) (*VirtualDataCenter, error)
public VirtualDataCenter(string name, VirtualDataCenterArgs? args = null, CustomResourceOptions? opts = null)
public VirtualDataCenter(String name, VirtualDataCenterArgs args)
public VirtualDataCenter(String name, VirtualDataCenterArgs args, CustomResourceOptions options)
type: opennebula:VirtualDataCenter
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args VirtualDataCenterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args VirtualDataCenterArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args VirtualDataCenterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args VirtualDataCenterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VirtualDataCenterArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var virtualDataCenterResource = new Opennebula.VirtualDataCenter("virtualDataCenterResource", new()
{
    GroupIds = new[]
    {
        0,
    },
    Name = "string",
    VirtualDataCenterId = "string",
    Zones = new[]
    {
        new Opennebula.Inputs.VirtualDataCenterZoneArgs
        {
            ClusterIds = new[]
            {
                0,
            },
            DatastoreIds = new[]
            {
                0,
            },
            HostIds = new[]
            {
                0,
            },
            Id = 0,
            VnetIds = new[]
            {
                0,
            },
        },
    },
});
Copy
example, err := opennebula.NewVirtualDataCenter(ctx, "virtualDataCenterResource", &opennebula.VirtualDataCenterArgs{
GroupIds: pulumi.Float64Array{
pulumi.Float64(0),
},
Name: pulumi.String("string"),
VirtualDataCenterId: pulumi.String("string"),
Zones: .VirtualDataCenterZoneArray{
&.VirtualDataCenterZoneArgs{
ClusterIds: pulumi.Float64Array{
pulumi.Float64(0),
},
DatastoreIds: pulumi.Float64Array{
pulumi.Float64(0),
},
HostIds: pulumi.Float64Array{
pulumi.Float64(0),
},
Id: pulumi.Float64(0),
VnetIds: pulumi.Float64Array{
pulumi.Float64(0),
},
},
},
})
Copy
var virtualDataCenterResource = new VirtualDataCenter("virtualDataCenterResource", VirtualDataCenterArgs.builder()
    .groupIds(0)
    .name("string")
    .virtualDataCenterId("string")
    .zones(VirtualDataCenterZoneArgs.builder()
        .clusterIds(0)
        .datastoreIds(0)
        .hostIds(0)
        .id(0)
        .vnetIds(0)
        .build())
    .build());
Copy
virtual_data_center_resource = opennebula.VirtualDataCenter("virtualDataCenterResource",
    group_ids=[0],
    name="string",
    virtual_data_center_id="string",
    zones=[{
        "cluster_ids": [0],
        "datastore_ids": [0],
        "host_ids": [0],
        "id": 0,
        "vnet_ids": [0],
    }])
Copy
const virtualDataCenterResource = new opennebula.VirtualDataCenter("virtualDataCenterResource", {
    groupIds: [0],
    name: "string",
    virtualDataCenterId: "string",
    zones: [{
        clusterIds: [0],
        datastoreIds: [0],
        hostIds: [0],
        id: 0,
        vnetIds: [0],
    }],
});
Copy
type: opennebula:VirtualDataCenter
properties:
    groupIds:
        - 0
    name: string
    virtualDataCenterId: string
    zones:
        - clusterIds:
            - 0
          datastoreIds:
            - 0
          hostIds:
            - 0
          id: 0
          vnetIds:
            - 0
Copy

VirtualDataCenter Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VirtualDataCenter resource accepts the following input properties:

GroupIds List<double>
List of Group IDs to be added into the VDC
Name string
The name of the virtual data center.
VirtualDataCenterId string
ID of the virtual data center.
Zones List<VirtualDataCenterZone>
List of zones. See Zones parameters below for details
GroupIds []float64
List of Group IDs to be added into the VDC
Name string
The name of the virtual data center.
VirtualDataCenterId string
ID of the virtual data center.
Zones []VirtualDataCenterZoneArgs
List of zones. See Zones parameters below for details
groupIds List<Double>
List of Group IDs to be added into the VDC
name String
The name of the virtual data center.
virtualDataCenterId String
ID of the virtual data center.
zones List<VirtualDataCenterZone>
List of zones. See Zones parameters below for details
groupIds number[]
List of Group IDs to be added into the VDC
name string
The name of the virtual data center.
virtualDataCenterId string
ID of the virtual data center.
zones VirtualDataCenterZone[]
List of zones. See Zones parameters below for details
group_ids Sequence[float]
List of Group IDs to be added into the VDC
name str
The name of the virtual data center.
virtual_data_center_id str
ID of the virtual data center.
zones Sequence[VirtualDataCenterZoneArgs]
List of zones. See Zones parameters below for details
groupIds List<Number>
List of Group IDs to be added into the VDC
name String
The name of the virtual data center.
virtualDataCenterId String
ID of the virtual data center.
zones List<Property Map>
List of zones. See Zones parameters below for details

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualDataCenter resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing VirtualDataCenter Resource

Get an existing VirtualDataCenter resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VirtualDataCenterState, opts?: CustomResourceOptions): VirtualDataCenter
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        group_ids: Optional[Sequence[float]] = None,
        name: Optional[str] = None,
        virtual_data_center_id: Optional[str] = None,
        zones: Optional[Sequence[VirtualDataCenterZoneArgs]] = None) -> VirtualDataCenter
func GetVirtualDataCenter(ctx *Context, name string, id IDInput, state *VirtualDataCenterState, opts ...ResourceOption) (*VirtualDataCenter, error)
public static VirtualDataCenter Get(string name, Input<string> id, VirtualDataCenterState? state, CustomResourceOptions? opts = null)
public static VirtualDataCenter get(String name, Output<String> id, VirtualDataCenterState state, CustomResourceOptions options)
resources:  _:    type: opennebula:VirtualDataCenter    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
GroupIds List<double>
List of Group IDs to be added into the VDC
Name string
The name of the virtual data center.
VirtualDataCenterId string
ID of the virtual data center.
Zones List<VirtualDataCenterZone>
List of zones. See Zones parameters below for details
GroupIds []float64
List of Group IDs to be added into the VDC
Name string
The name of the virtual data center.
VirtualDataCenterId string
ID of the virtual data center.
Zones []VirtualDataCenterZoneArgs
List of zones. See Zones parameters below for details
groupIds List<Double>
List of Group IDs to be added into the VDC
name String
The name of the virtual data center.
virtualDataCenterId String
ID of the virtual data center.
zones List<VirtualDataCenterZone>
List of zones. See Zones parameters below for details
groupIds number[]
List of Group IDs to be added into the VDC
name string
The name of the virtual data center.
virtualDataCenterId string
ID of the virtual data center.
zones VirtualDataCenterZone[]
List of zones. See Zones parameters below for details
group_ids Sequence[float]
List of Group IDs to be added into the VDC
name str
The name of the virtual data center.
virtual_data_center_id str
ID of the virtual data center.
zones Sequence[VirtualDataCenterZoneArgs]
List of zones. See Zones parameters below for details
groupIds List<Number>
List of Group IDs to be added into the VDC
name String
The name of the virtual data center.
virtualDataCenterId String
ID of the virtual data center.
zones List<Property Map>
List of zones. See Zones parameters below for details

Supporting Types

VirtualDataCenterZone
, VirtualDataCenterZoneArgs

ClusterIds List<double>
List of clusters from Zone ID to add in virtual data center.
DatastoreIds List<double>
List of datastore from Zone ID to add in virtual data center.
HostIds List<double>
List of hosts from Zone ID to add in virtual data center.
Id double
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
VnetIds List<double>
List of virtual networks from Zone ID to add in virtual data center.
ClusterIds []float64
List of clusters from Zone ID to add in virtual data center.
DatastoreIds []float64
List of datastore from Zone ID to add in virtual data center.
HostIds []float64
List of hosts from Zone ID to add in virtual data center.
Id float64
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
VnetIds []float64
List of virtual networks from Zone ID to add in virtual data center.
clusterIds List<Double>
List of clusters from Zone ID to add in virtual data center.
datastoreIds List<Double>
List of datastore from Zone ID to add in virtual data center.
hostIds List<Double>
List of hosts from Zone ID to add in virtual data center.
id Double
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
vnetIds List<Double>
List of virtual networks from Zone ID to add in virtual data center.
clusterIds number[]
List of clusters from Zone ID to add in virtual data center.
datastoreIds number[]
List of datastore from Zone ID to add in virtual data center.
hostIds number[]
List of hosts from Zone ID to add in virtual data center.
id number
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
vnetIds number[]
List of virtual networks from Zone ID to add in virtual data center.
cluster_ids Sequence[float]
List of clusters from Zone ID to add in virtual data center.
datastore_ids Sequence[float]
List of datastore from Zone ID to add in virtual data center.
host_ids Sequence[float]
List of hosts from Zone ID to add in virtual data center.
id float
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
vnet_ids Sequence[float]
List of virtual networks from Zone ID to add in virtual data center.
clusterIds List<Number>
List of clusters from Zone ID to add in virtual data center.
datastoreIds List<Number>
List of datastore from Zone ID to add in virtual data center.
hostIds List<Number>
List of hosts from Zone ID to add in virtual data center.
id Number
Zone ID from where resource to add in virtual data center are located. Defaults to 0.
vnetIds List<Number>
List of virtual networks from Zone ID to add in virtual data center.

Import

opennebula_virtual_data_center can be imported using its ID:

$ pulumi import opennebula:index/virtualDataCenter:VirtualDataCenter example 123
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
opennebula opennebula/terraform-provider-opennebula
License
Notes
This Pulumi package is based on the opennebula Terraform Provider.