Namespace Pulumi.OpenStack.Compute
Classes
Flavor
Manages a V2 flavor resource within OpenStack.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var test_flavor = new OpenStack.Compute.Flavor("test-flavor", new OpenStack.Compute.FlavorArgs
{
Disk = "20",
ExtraSpecs =
{
{ "hw:cpu_policy", "CPU-POLICY" },
{ "hw:cpu_thread_policy", "CPU-THREAD-POLICY" },
},
Ram = "8096",
Vcpus = "2",
});
}
}
FlavorAccess
Manages a project access for flavor V2 resource within OpenStack.
Note: You must have admin privileges in your OpenStack cloud to use this resource.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var project1 = new OpenStack.Identity.Project("project1", new OpenStack.Identity.ProjectArgs
{
});
var flavor1 = new OpenStack.Compute.Flavor("flavor1", new OpenStack.Compute.FlavorArgs
{
Disk = "20",
IsPublic = false,
Ram = "8096",
Vcpus = "2",
});
var access1 = new OpenStack.Compute.FlavorAccess("access1", new OpenStack.Compute.FlavorAccessArgs
{
FlavorId = flavor1.Id,
TenantId = project1.Id,
});
}
}
FlavorAccessArgs
FlavorAccessState
FlavorArgs
FlavorState
FloatingIp
Manages a V2 floating IP resource within OpenStack Nova (compute) that can be used for compute instances.
Please note that managing floating IPs through the OpenStack Compute API has
been deprecated. Unless you are using an older OpenStack environment, it is
recommended to use the openstack.networking.FloatingIp
resource instead, which uses the OpenStack Networking API.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var floatip1 = new OpenStack.Compute.FloatingIp("floatip1", new OpenStack.Compute.FloatingIpArgs
{
Pool = "public",
});
}
}
FloatingIpArgs
FloatingIpAssociate
Associate a floating IP to an instance. This can be used instead of the
floating_ip options in openstack.compute.Instance.
Example Usage
Automatically detect the correct network
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
FlavorId = 3,
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
KeyPair = "my_key_pair_name",
SecurityGroups =
{
"default",
},
});
var fip1FloatingIp = new OpenStack.Networking.FloatingIp("fip1FloatingIp", new OpenStack.Networking.FloatingIpArgs
{
Pool = "my_pool",
});
var fip1FloatingIpAssociate = new OpenStack.Compute.FloatingIpAssociate("fip1FloatingIpAssociate", new OpenStack.Compute.FloatingIpAssociateArgs
{
FloatingIp = fip1FloatingIp.Address,
InstanceId = instance1.Id,
});
}
}
Explicitly set the network to attach to
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
FlavorId = 3,
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
KeyPair = "my_key_pair_name",
Networks =
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "default",
},
},
SecurityGroups =
{
"default",
},
});
var fip1FloatingIp = new OpenStack.Networking.FloatingIp("fip1FloatingIp", new OpenStack.Networking.FloatingIpArgs
{
Pool = "my_pool",
});
var fip1FloatingIpAssociate = new OpenStack.Compute.FloatingIpAssociate("fip1FloatingIpAssociate", new OpenStack.Compute.FloatingIpAssociateArgs
{
FixedIp = instance1.Networks.Apply(networks => networks[1].FixedIpV4),
FloatingIp = fip1FloatingIp.Address,
InstanceId = instance1.Id,
});
}
}
FloatingIpAssociateArgs
FloatingIpAssociateState
FloatingIpState
GetAvailabilityZones
GetAvailabilityZonesArgs
GetAvailabilityZonesResult
GetFlavor
GetFlavorArgs
GetFlavorResult
GetKeypair
GetKeypairArgs
GetKeypairResult
Instance
InstanceArgs
InstanceState
InterfaceAttach
Attaches a Network Interface (a Port) to an Instance using the OpenStack Compute (Nova) v2 API.
Example Usage
Basic Attachment
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var network1 = new OpenStack.Networking.Network("network1", new OpenStack.Networking.NetworkArgs
{
AdminStateUp = "true",
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new OpenStack.Compute.InterfaceAttachArgs
{
InstanceId = instance1.Id,
NetworkId = openstack_networking_port_v2.Network_1.Id,
});
}
}
Attachment Specifying a Fixed IP
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var network1 = new OpenStack.Networking.Network("network1", new OpenStack.Networking.NetworkArgs
{
AdminStateUp = "true",
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new OpenStack.Compute.InterfaceAttachArgs
{
FixedIp = "10.0.10.10",
InstanceId = instance1.Id,
NetworkId = openstack_networking_port_v2.Network_1.Id,
});
}
}
Attachment Using an Existing Port
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var network1 = new OpenStack.Networking.Network("network1", new OpenStack.Networking.NetworkArgs
{
AdminStateUp = "true",
});
var port1 = new OpenStack.Networking.Port("port1", new OpenStack.Networking.PortArgs
{
AdminStateUp = "true",
NetworkId = network1.Id,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new OpenStack.Compute.InterfaceAttachArgs
{
InstanceId = instance1.Id,
PortId = port1.Id,
});
}
}
InterfaceAttachArgs
InterfaceAttachState
Keypair
KeypairArgs
KeypairState
QuotaSetV2
Manages a V2 compute quotaset resource within OpenStack.
Note: This usually requires admin privileges.
Note: This resource has a no-op deletion so no actual actions will be done against the OpenStack API in case of delete call.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var project1 = new OpenStack.Identity.Project("project1", new OpenStack.Identity.ProjectArgs
{
});
var quotaset1 = new OpenStack.Compute.QuotaSetV2("quotaset1", new OpenStack.Compute.QuotaSetV2Args
{
ProjectId = project1.Id,
KeyPairs = 10,
Ram = 40960,
Cores = 32,
Instances = 20,
ServerGroups = 4,
ServerGroupMembers = 8,
});
}
}
QuotaSetV2Args
QuotaSetV2State
SecGroup
Manages a V2 security group resource within OpenStack.
Please note that managing security groups through the OpenStack Compute API
has been deprecated. Unless you are using an older OpenStack environment, it is
recommended to use the openstack.networking.SecGroup
and openstack.networking.SecGroupRule
resources instead, which uses the OpenStack Networking API.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var secgroup1 = new OpenStack.Compute.SecGroup("secgroup1", new OpenStack.Compute.SecGroupArgs
{
Description = "my security group",
Rules =
{
new OpenStack.Compute.Inputs.SecGroupRuleArgs
{
Cidr = "0.0.0.0/0",
FromPort = 22,
IpProtocol = "tcp",
ToPort = 22,
},
new OpenStack.Compute.Inputs.SecGroupRuleArgs
{
Cidr = "0.0.0.0/0",
FromPort = 80,
IpProtocol = "tcp",
ToPort = 80,
},
},
});
}
}
Notes
ICMP Rules
When using ICMP as the ip_protocol, the from_port sets the ICMP type and the to_port sets the ICMP code. To allow all ICMP types, set each value to -1, like so:
using Pulumi;
class MyStack : Stack
{
public MyStack()
{
}
}
A list of ICMP types and codes can be found here.
Referencing Security Groups
When referencing a security group in a configuration (for example, a configuration creates a new security group and then needs to apply it to an instance being created in the same configuration), it is currently recommended to reference the security group by name and not by ID, like this:
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var test_server = new OpenStack.Compute.Instance("test-server", new OpenStack.Compute.InstanceArgs
{
FlavorId = "3",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
KeyPair = "my_key_pair_name",
SecurityGroups =
{
openstack_compute_secgroup_v2.Secgroup_1.Name,
},
});
}
}
SecGroupArgs
SecGroupState
ServerGroup
Manages a V2 Server Group resource within OpenStack.
Example Usage
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var test_sg = new OpenStack.Compute.ServerGroup("test-sg", new OpenStack.Compute.ServerGroupArgs
{
Policies =
{
"anti-affinity",
},
});
}
}
Policies
affinity- All instances/servers launched in this group will be hosted on the same compute node.anti-affinity- All instances/servers launched in this group will be hosted on different compute nodes.soft-affinity- All instances/servers launched in this group will be hosted on the same compute node if possible, but if not possible they still will be scheduled instead of failure. To use this policy your OpenStack environment should support Compute service API 2.15 or above.soft-anti-affinity- All instances/servers launched in this group will be hosted on different compute nodes if possible, but if not possible they still will be scheduled instead of failure. To use this policy your OpenStack environment should support Compute service API 2.15 or above.
ServerGroupArgs
ServerGroupState
VolumeAttach
Attaches a Block Storage Volume to an Instance using the OpenStack Compute (Nova) v2 API.
Example Usage
Basic attachment of a single volume to a single instance
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var volume1 = new OpenStack.BlockStorage.VolumeV2("volume1", new OpenStack.BlockStorage.VolumeV2Args
{
Size = 1,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var va1 = new OpenStack.Compute.VolumeAttach("va1", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance1.Id,
VolumeId = volume1.Id,
});
}
}
Using Multiattach-enabled volumes
using Pulumi;
using OpenStack = Pulumi.OpenStack;
class MyStack : Stack
{
public MyStack()
{
var volume1 = new OpenStack.BlockStorage.Volume("volume1", new OpenStack.BlockStorage.VolumeArgs
{
Multiattach = true,
Size = 1,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var instance2 = new OpenStack.Compute.Instance("instance2", new OpenStack.Compute.InstanceArgs
{
SecurityGroups =
{
"default",
},
});
var va1 = new OpenStack.Compute.VolumeAttach("va1", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance1.Id,
Multiattach = true,
VolumeId = openstack_blockstorage_volume_v2.Volume_1.Id,
});
var va2 = new OpenStack.Compute.VolumeAttach("va2", new OpenStack.Compute.VolumeAttachArgs
{
InstanceId = instance2.Id,
Multiattach = true,
VolumeId = openstack_blockstorage_volume_v2.Volume_1.Id,
});
}
}