published on Friday, Apr 10, 2026 by Pulumi
published on Friday, Apr 10, 2026 by Pulumi
Manages a V2 VM instance resource within OpenStack.
Note: All arguments including the instance admin password will be stored in the raw state as plain-text. Read more about sensitive data in state.
Example Usage
Basic Instance
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const basic = new openstack.compute.Instance("basic", {
name: "basic",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
metadata: {
"this": "that",
},
networks: [{
name: "my_network",
}],
});
import pulumi
import pulumi_openstack as openstack
basic = openstack.compute.Instance("basic",
name="basic",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
metadata={
"this": "that",
},
networks=[{
"name": "my_network",
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "basic", &compute.InstanceArgs{
Name: pulumi.String("basic"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
Metadata: pulumi.StringMap{
"this": pulumi.String("that"),
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var basic = new OpenStack.Compute.Instance("basic", new()
{
Name = "basic",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
Metadata =
{
{ "this", "that" },
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 basic = new Instance("basic", InstanceArgs.builder()
.name("basic")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.metadata(Map.of("this", "that"))
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
}
}
resources:
basic:
type: openstack:compute:Instance
properties:
name: basic
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
metadata:
this: that
networks:
- name: my_network
Instance With Attached Volume
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const myvol = new openstack.blockstorage.Volume("myvol", {
name: "myvol",
size: 1,
});
const myinstance = new openstack.compute.Instance("myinstance", {
name: "myinstance",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
networks: [{
name: "my_network",
}],
});
const attached = new openstack.compute.VolumeAttach("attached", {
instanceId: myinstance.id,
volumeId: myvol.id,
});
import pulumi
import pulumi_openstack as openstack
myvol = openstack.blockstorage.Volume("myvol",
name="myvol",
size=1)
myinstance = openstack.compute.Instance("myinstance",
name="myinstance",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
networks=[{
"name": "my_network",
}])
attached = openstack.compute.VolumeAttach("attached",
instance_id=myinstance.id,
volume_id=myvol.id)
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/blockstorage"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myvol, err := blockstorage.NewVolume(ctx, "myvol", &blockstorage.VolumeArgs{
Name: pulumi.String("myvol"),
Size: pulumi.Int(1),
})
if err != nil {
return err
}
myinstance, err := compute.NewInstance(ctx, "myinstance", &compute.InstanceArgs{
Name: pulumi.String("myinstance"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
_, err = compute.NewVolumeAttach(ctx, "attached", &compute.VolumeAttachArgs{
InstanceId: myinstance.ID(),
VolumeId: myvol.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var myvol = new OpenStack.BlockStorage.Volume("myvol", new()
{
Name = "myvol",
Size = 1,
});
var myinstance = new OpenStack.Compute.Instance("myinstance", new()
{
Name = "myinstance",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
var attached = new OpenStack.Compute.VolumeAttach("attached", new()
{
InstanceId = myinstance.Id,
VolumeId = myvol.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.blockstorage.Volume;
import com.pulumi.openstack.blockstorage.VolumeArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
import com.pulumi.openstack.compute.VolumeAttach;
import com.pulumi.openstack.compute.VolumeAttachArgs;
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 myvol = new Volume("myvol", VolumeArgs.builder()
.name("myvol")
.size(1)
.build());
var myinstance = new Instance("myinstance", InstanceArgs.builder()
.name("myinstance")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
var attached = new VolumeAttach("attached", VolumeAttachArgs.builder()
.instanceId(myinstance.id())
.volumeId(myvol.id())
.build());
}
}
resources:
myvol:
type: openstack:blockstorage:Volume
properties:
name: myvol
size: 1
myinstance:
type: openstack:compute:Instance
properties:
name: myinstance
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
networks:
- name: my_network
attached:
type: openstack:compute:VolumeAttach
properties:
instanceId: ${myinstance.id}
volumeId: ${myvol.id}
Boot From Volume
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const boot_from_volume = new openstack.compute.Instance("boot-from-volume", {
name: "boot-from-volume",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [{
uuid: "<image-id>",
sourceType: "image",
volumeSize: 5,
bootIndex: 0,
destinationType: "volume",
deleteOnTermination: true,
}],
networks: [{
name: "my_network",
}],
});
import pulumi
import pulumi_openstack as openstack
boot_from_volume = openstack.compute.Instance("boot-from-volume",
name="boot-from-volume",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[{
"uuid": "<image-id>",
"source_type": "image",
"volume_size": 5,
"boot_index": 0,
"destination_type": "volume",
"delete_on_termination": True,
}],
networks=[{
"name": "my_network",
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "boot-from-volume", &compute.InstanceArgs{
Name: pulumi.String("boot-from-volume"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
Uuid: pulumi.String("<image-id>"),
SourceType: pulumi.String("image"),
VolumeSize: pulumi.Int(5),
BootIndex: pulumi.Int(0),
DestinationType: pulumi.String("volume"),
DeleteOnTermination: pulumi.Bool(true),
},
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var boot_from_volume = new OpenStack.Compute.Instance("boot-from-volume", new()
{
Name = "boot-from-volume",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = "<image-id>",
SourceType = "image",
VolumeSize = 5,
BootIndex = 0,
DestinationType = "volume",
DeleteOnTermination = true,
},
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 boot_from_volume = new Instance("boot-from-volume", InstanceArgs.builder()
.name("boot-from-volume")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(InstanceBlockDeviceArgs.builder()
.uuid("<image-id>")
.sourceType("image")
.volumeSize(5)
.bootIndex(0)
.destinationType("volume")
.deleteOnTermination(true)
.build())
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
}
}
resources:
boot-from-volume:
type: openstack:compute:Instance
properties:
name: boot-from-volume
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- uuid: <image-id>
sourceType: image
volumeSize: 5
bootIndex: 0
destinationType: volume
deleteOnTermination: true
networks:
- name: my_network
Boot From an Existing Volume
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const myvol = new openstack.blockstorage.Volume("myvol", {
name: "myvol",
size: 5,
imageId: "<image-id>",
});
const boot_from_volume = new openstack.compute.Instance("boot-from-volume", {
name: "bootfromvolume",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [{
uuid: myvol.id,
sourceType: "volume",
bootIndex: 0,
destinationType: "volume",
deleteOnTermination: true,
}],
networks: [{
name: "my_network",
}],
});
import pulumi
import pulumi_openstack as openstack
myvol = openstack.blockstorage.Volume("myvol",
name="myvol",
size=5,
image_id="<image-id>")
boot_from_volume = openstack.compute.Instance("boot-from-volume",
name="bootfromvolume",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[{
"uuid": myvol.id,
"source_type": "volume",
"boot_index": 0,
"destination_type": "volume",
"delete_on_termination": True,
}],
networks=[{
"name": "my_network",
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/blockstorage"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myvol, err := blockstorage.NewVolume(ctx, "myvol", &blockstorage.VolumeArgs{
Name: pulumi.String("myvol"),
Size: pulumi.Int(5),
ImageId: pulumi.String("<image-id>"),
})
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "boot-from-volume", &compute.InstanceArgs{
Name: pulumi.String("bootfromvolume"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
Uuid: myvol.ID(),
SourceType: pulumi.String("volume"),
BootIndex: pulumi.Int(0),
DestinationType: pulumi.String("volume"),
DeleteOnTermination: pulumi.Bool(true),
},
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var myvol = new OpenStack.BlockStorage.Volume("myvol", new()
{
Name = "myvol",
Size = 5,
ImageId = "<image-id>",
});
var boot_from_volume = new OpenStack.Compute.Instance("boot-from-volume", new()
{
Name = "bootfromvolume",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = myvol.Id,
SourceType = "volume",
BootIndex = 0,
DestinationType = "volume",
DeleteOnTermination = true,
},
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.blockstorage.Volume;
import com.pulumi.openstack.blockstorage.VolumeArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 myvol = new Volume("myvol", VolumeArgs.builder()
.name("myvol")
.size(5)
.imageId("<image-id>")
.build());
var boot_from_volume = new Instance("boot-from-volume", InstanceArgs.builder()
.name("bootfromvolume")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(InstanceBlockDeviceArgs.builder()
.uuid(myvol.id())
.sourceType("volume")
.bootIndex(0)
.destinationType("volume")
.deleteOnTermination(true)
.build())
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
}
}
resources:
myvol:
type: openstack:blockstorage:Volume
properties:
name: myvol
size: 5
imageId: <image-id>
boot-from-volume:
type: openstack:compute:Instance
properties:
name: bootfromvolume
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- uuid: ${myvol.id}
sourceType: volume
bootIndex: 0
destinationType: volume
deleteOnTermination: true
networks:
- name: my_network
Boot Instance, Create Volume, and Attach Volume as a Block Device
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const instance1 = new openstack.compute.Instance("instance_1", {
name: "instance_1",
imageId: "<image-id>",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [
{
uuid: "<image-id>",
sourceType: "image",
destinationType: "local",
bootIndex: 0,
deleteOnTermination: true,
},
{
sourceType: "blank",
destinationType: "volume",
volumeSize: 1,
bootIndex: 1,
deleteOnTermination: true,
},
],
});
import pulumi
import pulumi_openstack as openstack
instance1 = openstack.compute.Instance("instance_1",
name="instance_1",
image_id="<image-id>",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[
{
"uuid": "<image-id>",
"source_type": "image",
"destination_type": "local",
"boot_index": 0,
"delete_on_termination": True,
},
{
"source_type": "blank",
"destination_type": "volume",
"volume_size": 1,
"boot_index": 1,
"delete_on_termination": True,
},
])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "instance_1", &compute.InstanceArgs{
Name: pulumi.String("instance_1"),
ImageId: pulumi.String("<image-id>"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
Uuid: pulumi.String("<image-id>"),
SourceType: pulumi.String("image"),
DestinationType: pulumi.String("local"),
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
},
&compute.InstanceBlockDeviceArgs{
SourceType: pulumi.String("blank"),
DestinationType: pulumi.String("volume"),
VolumeSize: pulumi.Int(1),
BootIndex: pulumi.Int(1),
DeleteOnTermination: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var instance1 = new OpenStack.Compute.Instance("instance_1", new()
{
Name = "instance_1",
ImageId = "<image-id>",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = "<image-id>",
SourceType = "image",
DestinationType = "local",
BootIndex = 0,
DeleteOnTermination = true,
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
SourceType = "blank",
DestinationType = "volume",
VolumeSize = 1,
BootIndex = 1,
DeleteOnTermination = true,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
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 instance1 = new Instance("instance1", InstanceArgs.builder()
.name("instance_1")
.imageId("<image-id>")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(
InstanceBlockDeviceArgs.builder()
.uuid("<image-id>")
.sourceType("image")
.destinationType("local")
.bootIndex(0)
.deleteOnTermination(true)
.build(),
InstanceBlockDeviceArgs.builder()
.sourceType("blank")
.destinationType("volume")
.volumeSize(1)
.bootIndex(1)
.deleteOnTermination(true)
.build())
.build());
}
}
resources:
instance1:
type: openstack:compute:Instance
name: instance_1
properties:
name: instance_1
imageId: <image-id>
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- uuid: <image-id>
sourceType: image
destinationType: local
bootIndex: 0
deleteOnTermination: true
- sourceType: blank
destinationType: volume
volumeSize: 1
bootIndex: 1
deleteOnTermination: true
Boot Instance and Attach Existing Volume as a Block Device
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const volume1 = new openstack.blockstorage.Volume("volume_1", {
name: "volume_1",
size: 1,
});
const instance1 = new openstack.compute.Instance("instance_1", {
name: "instance_1",
imageId: "<image-id>",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [
{
uuid: "<image-id>",
sourceType: "image",
destinationType: "local",
bootIndex: 0,
deleteOnTermination: true,
},
{
uuid: volume1.id,
sourceType: "volume",
destinationType: "volume",
bootIndex: 1,
deleteOnTermination: true,
},
],
});
import pulumi
import pulumi_openstack as openstack
volume1 = openstack.blockstorage.Volume("volume_1",
name="volume_1",
size=1)
instance1 = openstack.compute.Instance("instance_1",
name="instance_1",
image_id="<image-id>",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[
{
"uuid": "<image-id>",
"source_type": "image",
"destination_type": "local",
"boot_index": 0,
"delete_on_termination": True,
},
{
"uuid": volume1.id,
"source_type": "volume",
"destination_type": "volume",
"boot_index": 1,
"delete_on_termination": True,
},
])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/blockstorage"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
volume1, err := blockstorage.NewVolume(ctx, "volume_1", &blockstorage.VolumeArgs{
Name: pulumi.String("volume_1"),
Size: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "instance_1", &compute.InstanceArgs{
Name: pulumi.String("instance_1"),
ImageId: pulumi.String("<image-id>"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
Uuid: pulumi.String("<image-id>"),
SourceType: pulumi.String("image"),
DestinationType: pulumi.String("local"),
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
},
&compute.InstanceBlockDeviceArgs{
Uuid: volume1.ID(),
SourceType: pulumi.String("volume"),
DestinationType: pulumi.String("volume"),
BootIndex: pulumi.Int(1),
DeleteOnTermination: pulumi.Bool(true),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var volume1 = new OpenStack.BlockStorage.Volume("volume_1", new()
{
Name = "volume_1",
Size = 1,
});
var instance1 = new OpenStack.Compute.Instance("instance_1", new()
{
Name = "instance_1",
ImageId = "<image-id>",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = "<image-id>",
SourceType = "image",
DestinationType = "local",
BootIndex = 0,
DeleteOnTermination = true,
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = volume1.Id,
SourceType = "volume",
DestinationType = "volume",
BootIndex = 1,
DeleteOnTermination = true,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.blockstorage.Volume;
import com.pulumi.openstack.blockstorage.VolumeArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
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 volume1 = new Volume("volume1", VolumeArgs.builder()
.name("volume_1")
.size(1)
.build());
var instance1 = new Instance("instance1", InstanceArgs.builder()
.name("instance_1")
.imageId("<image-id>")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(
InstanceBlockDeviceArgs.builder()
.uuid("<image-id>")
.sourceType("image")
.destinationType("local")
.bootIndex(0)
.deleteOnTermination(true)
.build(),
InstanceBlockDeviceArgs.builder()
.uuid(volume1.id())
.sourceType("volume")
.destinationType("volume")
.bootIndex(1)
.deleteOnTermination(true)
.build())
.build());
}
}
resources:
volume1:
type: openstack:blockstorage:Volume
name: volume_1
properties:
name: volume_1
size: 1
instance1:
type: openstack:compute:Instance
name: instance_1
properties:
name: instance_1
imageId: <image-id>
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- uuid: <image-id>
sourceType: image
destinationType: local
bootIndex: 0
deleteOnTermination: true
- uuid: ${volume1.id}
sourceType: volume
destinationType: volume
bootIndex: 1
deleteOnTermination: true
Instance With Multiple Networks
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const myip = new openstack.networking.FloatingIp("myip", {pool: "my_pool"});
const multi_net = new openstack.compute.Instance("multi-net", {
name: "multi-net",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
networks: [
{
name: "my_first_network",
},
{
name: "my_second_network",
},
],
});
const vm_port = pulumi.all([multi_net.id, multi_net.networks]).apply(([id, networks]) => openstack.networking.getPortOutput({
deviceId: id,
networkId: networks[1].uuid,
}));
const fipVm = new openstack.networking.FloatingIpAssociate("fip_vm", {
floatingIp: myip.address,
portId: vm_port.apply(vm_port => vm_port.id),
});
import pulumi
import pulumi_openstack as openstack
myip = openstack.networking.FloatingIp("myip", pool="my_pool")
multi_net = openstack.compute.Instance("multi-net",
name="multi-net",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
networks=[
{
"name": "my_first_network",
},
{
"name": "my_second_network",
},
])
vm_port = pulumi.Output.all(
id=multi_net.id,
networks=multi_net.networks
).apply(lambda resolved_outputs: openstack.networking.get_port_output(device_id=resolved_outputs['id'],
network_id=networks[1].uuid))
fip_vm = openstack.networking.FloatingIpAssociate("fip_vm",
floating_ip=myip.address,
port_id=vm_port.id)
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myip, err := networking.NewFloatingIp(ctx, "myip", &networking.FloatingIpArgs{
Pool: pulumi.String("my_pool"),
})
if err != nil {
return err
}
multi_net, err := compute.NewInstance(ctx, "multi-net", &compute.InstanceArgs{
Name: pulumi.String("multi-net"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_first_network"),
},
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_second_network"),
},
},
})
if err != nil {
return err
}
vm_port := pulumi.All(multi_net.ID(), multi_net.Networks).ApplyT(func(_args []interface{}) (networking.GetPortResult, error) {
id := _args[0].(string)
networks := _args[1].([]compute.InstanceNetwork)
return networking.GetPortResult(interface{}(networking.LookupPort(ctx, &networking.LookupPortArgs{
DeviceId: pulumi.StringRef(pulumi.StringRef(id)),
NetworkId: pulumi.StringRef(pulumi.StringRef(pulumi.String(networks[1].Uuid))),
}, nil))), nil
}).(networking.GetPortResultOutput)
_, err = networking.NewFloatingIpAssociate(ctx, "fip_vm", &networking.FloatingIpAssociateArgs{
FloatingIp: myip.Address,
PortId: pulumi.String(vm_port.ApplyT(func(vm_port networking.GetPortResult) (*string, error) {
return &vm_port.Id, nil
}).(pulumi.StringPtrOutput)),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var myip = new OpenStack.Networking.FloatingIp("myip", new()
{
Pool = "my_pool",
});
var multi_net = new OpenStack.Compute.Instance("multi-net", new()
{
Name = "multi-net",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_first_network",
},
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_second_network",
},
},
});
var vm_port = OpenStack.Networking.GetPort.Invoke(new()
{
DeviceId = multi_net.Id,
NetworkId = multi_net.Networks[1].Uuid,
});
var fipVm = new OpenStack.Networking.FloatingIpAssociate("fip_vm", new()
{
FloatingIp = myip.Address,
PortId = vm_port.Apply(vm_port => vm_port.Apply(getPortResult => getPortResult.Id)),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.FloatingIp;
import com.pulumi.openstack.networking.FloatingIpArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
import com.pulumi.openstack.networking.NetworkingFunctions;
import com.pulumi.openstack.networking.inputs.GetPortArgs;
import com.pulumi.openstack.networking.FloatingIpAssociate;
import com.pulumi.openstack.networking.FloatingIpAssociateArgs;
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 myip = new FloatingIp("myip", FloatingIpArgs.builder()
.pool("my_pool")
.build());
var multi_net = new Instance("multi-net", InstanceArgs.builder()
.name("multi-net")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.networks(
InstanceNetworkArgs.builder()
.name("my_first_network")
.build(),
InstanceNetworkArgs.builder()
.name("my_second_network")
.build())
.build());
final var vm-port = Output.tuple(multi_net.id(), multi_net.networks()).applyValue(values -> {
var id = values.t1;
var networks = values.t2;
return NetworkingFunctions.getPort(GetPortArgs.builder()
.deviceId(id)
.networkId(networks[1].uuid())
.build());
});
var fipVm = new FloatingIpAssociate("fipVm", FloatingIpAssociateArgs.builder()
.floatingIp(myip.address())
.portId(vm_port.applyValue(_vm_port -> _vm_port.id()))
.build());
}
}
resources:
myip:
type: openstack:networking:FloatingIp
properties:
pool: my_pool
multi-net:
type: openstack:compute:Instance
properties:
name: multi-net
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
networks:
- name: my_first_network
- name: my_second_network
fipVm:
type: openstack:networking:FloatingIpAssociate
name: fip_vm
properties:
floatingIp: ${myip.address}
portId: ${["vm-port"].id}
variables:
vm-port:
fn::invoke:
function: openstack:networking:getPort
arguments:
deviceId: ${["multi-net"].id}
networkId: ${["multi-net"].networks[1].uuid}
Instance With Personality
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const personality = new openstack.compute.Instance("personality", {
name: "personality",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
personalities: [{
file: "/path/to/file/on/instance.txt",
content: "contents of file",
}],
networks: [{
name: "my_network",
}],
});
import pulumi
import pulumi_openstack as openstack
personality = openstack.compute.Instance("personality",
name="personality",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
personalities=[{
"file": "/path/to/file/on/instance.txt",
"content": "contents of file",
}],
networks=[{
"name": "my_network",
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "personality", &compute.InstanceArgs{
Name: pulumi.String("personality"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
Personalities: compute.InstancePersonalityArray{
&compute.InstancePersonalityArgs{
File: pulumi.String("/path/to/file/on/instance.txt"),
Content: pulumi.String("contents of file"),
},
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var personality = new OpenStack.Compute.Instance("personality", new()
{
Name = "personality",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
Personalities = new[]
{
new OpenStack.Compute.Inputs.InstancePersonalityArgs
{
File = "/path/to/file/on/instance.txt",
Content = "contents of file",
},
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstancePersonalityArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 personality = new Instance("personality", InstanceArgs.builder()
.name("personality")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.personalities(InstancePersonalityArgs.builder()
.file("/path/to/file/on/instance.txt")
.content("contents of file")
.build())
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
}
}
resources:
personality:
type: openstack:compute:Instance
properties:
name: personality
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
personalities:
- file: /path/to/file/on/instance.txt
content: contents of file
networks:
- name: my_network
Instance with Multiple Ephemeral Disks
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const multi_eph = new openstack.compute.Instance("multi-eph", {
name: "multi_eph",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [
{
bootIndex: 0,
deleteOnTermination: true,
destinationType: "local",
sourceType: "image",
uuid: "<image-id>",
},
{
bootIndex: -1,
deleteOnTermination: true,
destinationType: "local",
sourceType: "blank",
volumeSize: 1,
guestFormat: "ext4",
},
{
bootIndex: -1,
deleteOnTermination: true,
destinationType: "local",
sourceType: "blank",
volumeSize: 1,
},
],
});
import pulumi
import pulumi_openstack as openstack
multi_eph = openstack.compute.Instance("multi-eph",
name="multi_eph",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[
{
"boot_index": 0,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "image",
"uuid": "<image-id>",
},
{
"boot_index": -1,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "blank",
"volume_size": 1,
"guest_format": "ext4",
},
{
"boot_index": -1,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "blank",
"volume_size": 1,
},
])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "multi-eph", &compute.InstanceArgs{
Name: pulumi.String("multi_eph"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("image"),
Uuid: pulumi.String("<image-id>"),
},
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(-1),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("blank"),
VolumeSize: pulumi.Int(1),
GuestFormat: pulumi.String("ext4"),
},
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(-1),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("blank"),
VolumeSize: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var multi_eph = new OpenStack.Compute.Instance("multi-eph", new()
{
Name = "multi_eph",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = 0,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "image",
Uuid = "<image-id>",
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = -1,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "blank",
VolumeSize = 1,
GuestFormat = "ext4",
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = -1,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "blank",
VolumeSize = 1,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
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 multi_eph = new Instance("multi-eph", InstanceArgs.builder()
.name("multi_eph")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(
InstanceBlockDeviceArgs.builder()
.bootIndex(0)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("image")
.uuid("<image-id>")
.build(),
InstanceBlockDeviceArgs.builder()
.bootIndex(-1)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("blank")
.volumeSize(1)
.guestFormat("ext4")
.build(),
InstanceBlockDeviceArgs.builder()
.bootIndex(-1)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("blank")
.volumeSize(1)
.build())
.build());
}
}
resources:
multi-eph:
type: openstack:compute:Instance
properties:
name: multi_eph
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- bootIndex: 0
deleteOnTermination: true
destinationType: local
sourceType: image
uuid: <image-id>
- bootIndex: -1
deleteOnTermination: true
destinationType: local
sourceType: blank
volumeSize: 1
guestFormat: ext4
- bootIndex: -1
deleteOnTermination: true
destinationType: local
sourceType: blank
volumeSize: 1
Instance with Boot Disk and Swap Disk
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const flavor_with_swap = new openstack.compute.Flavor("flavor-with-swap", {
name: "flavor-with-swap",
ram: 8096,
vcpus: 2,
disk: 20,
swap: 4096,
});
const vm_swap = new openstack.compute.Instance("vm-swap", {
name: "vm_swap",
flavorId: flavor_with_swap.id,
keyPair: "my_key_pair_name",
securityGroups: ["default"],
blockDevices: [
{
bootIndex: 0,
deleteOnTermination: true,
destinationType: "local",
sourceType: "image",
uuid: "<image-id>",
},
{
bootIndex: -1,
deleteOnTermination: true,
destinationType: "local",
sourceType: "blank",
guestFormat: "swap",
volumeSize: 4,
},
],
});
import pulumi
import pulumi_openstack as openstack
flavor_with_swap = openstack.compute.Flavor("flavor-with-swap",
name="flavor-with-swap",
ram=8096,
vcpus=2,
disk=20,
swap=4096)
vm_swap = openstack.compute.Instance("vm-swap",
name="vm_swap",
flavor_id=flavor_with_swap.id,
key_pair="my_key_pair_name",
security_groups=["default"],
block_devices=[
{
"boot_index": 0,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "image",
"uuid": "<image-id>",
},
{
"boot_index": -1,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "blank",
"guest_format": "swap",
"volume_size": 4,
},
])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
flavor_with_swap, err := compute.NewFlavor(ctx, "flavor-with-swap", &compute.FlavorArgs{
Name: pulumi.String("flavor-with-swap"),
Ram: pulumi.Int(8096),
Vcpus: pulumi.Int(2),
Disk: pulumi.Int(20),
Swap: pulumi.Int(4096),
})
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "vm-swap", &compute.InstanceArgs{
Name: pulumi.String("vm_swap"),
FlavorId: flavor_with_swap.ID(),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("image"),
Uuid: pulumi.String("<image-id>"),
},
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(-1),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("blank"),
GuestFormat: pulumi.String("swap"),
VolumeSize: pulumi.Int(4),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var flavor_with_swap = new OpenStack.Compute.Flavor("flavor-with-swap", new()
{
Name = "flavor-with-swap",
Ram = 8096,
Vcpus = 2,
Disk = 20,
Swap = 4096,
});
var vm_swap = new OpenStack.Compute.Instance("vm-swap", new()
{
Name = "vm_swap",
FlavorId = flavor_with_swap.Id,
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = 0,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "image",
Uuid = "<image-id>",
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = -1,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "blank",
GuestFormat = "swap",
VolumeSize = 4,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Flavor;
import com.pulumi.openstack.compute.FlavorArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
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 flavor_with_swap = new Flavor("flavor-with-swap", FlavorArgs.builder()
.name("flavor-with-swap")
.ram(8096)
.vcpus(2)
.disk(20)
.swap(4096)
.build());
var vm_swap = new Instance("vm-swap", InstanceArgs.builder()
.name("vm_swap")
.flavorId(flavor_with_swap.id())
.keyPair("my_key_pair_name")
.securityGroups("default")
.blockDevices(
InstanceBlockDeviceArgs.builder()
.bootIndex(0)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("image")
.uuid("<image-id>")
.build(),
InstanceBlockDeviceArgs.builder()
.bootIndex(-1)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("blank")
.guestFormat("swap")
.volumeSize(4)
.build())
.build());
}
}
resources:
flavor-with-swap:
type: openstack:compute:Flavor
properties:
name: flavor-with-swap
ram: '8096'
vcpus: '2'
disk: '20'
swap: '4096'
vm-swap:
type: openstack:compute:Instance
properties:
name: vm_swap
flavorId: ${["flavor-with-swap"].id}
keyPair: my_key_pair_name
securityGroups:
- default
blockDevices:
- bootIndex: 0
deleteOnTermination: true
destinationType: local
sourceType: image
uuid: <image-id>
- bootIndex: -1
deleteOnTermination: true
destinationType: local
sourceType: blank
guestFormat: swap
volumeSize: 4
Instance with User Data (cloud-init)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const instance1 = new openstack.compute.Instance("instance_1", {
name: "basic",
imageId: "ad091b52-742f-469e-8f3c-fd81cadf0743",
flavorId: "3",
keyPair: "my_key_pair_name",
securityGroups: ["default"],
userData: `#cloud-config
hostname: instance_1.example.com
fqdn: instance_1.example.com`,
networks: [{
name: "my_network",
}],
});
import pulumi
import pulumi_openstack as openstack
instance1 = openstack.compute.Instance("instance_1",
name="basic",
image_id="ad091b52-742f-469e-8f3c-fd81cadf0743",
flavor_id="3",
key_pair="my_key_pair_name",
security_groups=["default"],
user_data="""#cloud-config
hostname: instance_1.example.com
fqdn: instance_1.example.com""",
networks=[{
"name": "my_network",
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "instance_1", &compute.InstanceArgs{
Name: pulumi.String("basic"),
ImageId: pulumi.String("ad091b52-742f-469e-8f3c-fd81cadf0743"),
FlavorId: pulumi.String("3"),
KeyPair: pulumi.String("my_key_pair_name"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
UserData: pulumi.String("#cloud-config\nhostname: instance_1.example.com\nfqdn: instance_1.example.com"),
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("my_network"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var instance1 = new OpenStack.Compute.Instance("instance_1", new()
{
Name = "basic",
ImageId = "ad091b52-742f-469e-8f3c-fd81cadf0743",
FlavorId = "3",
KeyPair = "my_key_pair_name",
SecurityGroups = new[]
{
"default",
},
UserData = @"#cloud-config
hostname: instance_1.example.com
fqdn: instance_1.example.com",
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "my_network",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 instance1 = new Instance("instance1", InstanceArgs.builder()
.name("basic")
.imageId("ad091b52-742f-469e-8f3c-fd81cadf0743")
.flavorId("3")
.keyPair("my_key_pair_name")
.securityGroups("default")
.userData("""
#cloud-config
hostname: instance_1.example.com
fqdn: instance_1.example.com """)
.networks(InstanceNetworkArgs.builder()
.name("my_network")
.build())
.build());
}
}
resources:
instance1:
type: openstack:compute:Instance
name: instance_1
properties:
name: basic
imageId: ad091b52-742f-469e-8f3c-fd81cadf0743
flavorId: '3'
keyPair: my_key_pair_name
securityGroups:
- default
userData: |-
#cloud-config
hostname: instance_1.example.com
fqdn: instance_1.example.com
networks:
- name: my_network
userData can come from a variety of sources: inline, read in from the file
function, or the templateCloudinitConfig resource.
Notes
Multiple Ephemeral Disks
It’s possible to specify multiple blockDevice entries to create an instance
with multiple ephemeral (local) disks. In order to create multiple ephemeral
disks, the sum of the total amount of ephemeral space must be less than or
equal to what the chosen flavor supports.
The following example shows how to create an instance with multiple ephemeral disks:
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const foo = new openstack.compute.Instance("foo", {
name: "terraform-test",
securityGroups: ["default"],
blockDevices: [
{
bootIndex: 0,
deleteOnTermination: true,
destinationType: "local",
sourceType: "image",
uuid: "<image uuid>",
},
{
bootIndex: -1,
deleteOnTermination: true,
destinationType: "local",
sourceType: "blank",
volumeSize: 1,
},
{
bootIndex: -1,
deleteOnTermination: true,
destinationType: "local",
sourceType: "blank",
volumeSize: 1,
},
],
});
import pulumi
import pulumi_openstack as openstack
foo = openstack.compute.Instance("foo",
name="terraform-test",
security_groups=["default"],
block_devices=[
{
"boot_index": 0,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "image",
"uuid": "<image uuid>",
},
{
"boot_index": -1,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "blank",
"volume_size": 1,
},
{
"boot_index": -1,
"delete_on_termination": True,
"destination_type": "local",
"source_type": "blank",
"volume_size": 1,
},
])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "foo", &compute.InstanceArgs{
Name: pulumi.String("terraform-test"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("image"),
Uuid: pulumi.String("<image uuid>"),
},
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(-1),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("blank"),
VolumeSize: pulumi.Int(1),
},
&compute.InstanceBlockDeviceArgs{
BootIndex: pulumi.Int(-1),
DeleteOnTermination: pulumi.Bool(true),
DestinationType: pulumi.String("local"),
SourceType: pulumi.String("blank"),
VolumeSize: pulumi.Int(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var foo = new OpenStack.Compute.Instance("foo", new()
{
Name = "terraform-test",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = 0,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "image",
Uuid = "<image uuid>",
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = -1,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "blank",
VolumeSize = 1,
},
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
BootIndex = -1,
DeleteOnTermination = true,
DestinationType = "local",
SourceType = "blank",
VolumeSize = 1,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
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 foo = new Instance("foo", InstanceArgs.builder()
.name("terraform-test")
.securityGroups("default")
.blockDevices(
InstanceBlockDeviceArgs.builder()
.bootIndex(0)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("image")
.uuid("<image uuid>")
.build(),
InstanceBlockDeviceArgs.builder()
.bootIndex(-1)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("blank")
.volumeSize(1)
.build(),
InstanceBlockDeviceArgs.builder()
.bootIndex(-1)
.deleteOnTermination(true)
.destinationType("local")
.sourceType("blank")
.volumeSize(1)
.build())
.build());
}
}
resources:
foo:
type: openstack:compute:Instance
properties:
name: terraform-test
securityGroups:
- default
blockDevices:
- bootIndex: 0
deleteOnTermination: true
destinationType: local
sourceType: image
uuid: <image uuid>
- bootIndex: -1
deleteOnTermination: true
destinationType: local
sourceType: blank
volumeSize: 1
- bootIndex: -1
deleteOnTermination: true
destinationType: local
sourceType: blank
volumeSize: 1
Instances and Security Groups
When referencing a security group resource in an instance resource, always use the name of the security group. If you specify the ID of the security group, Terraform will remove and reapply the security group upon each call. This is because the OpenStack Compute API returns the names of the associated security groups and not their IDs.
Note the following example:
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const sg1 = new openstack.networking.SecGroup("sg_1", {name: "sg_1"});
const foo = new openstack.compute.Instance("foo", {
name: "terraform-test",
securityGroups: [sg1.name],
});
import pulumi
import pulumi_openstack as openstack
sg1 = openstack.networking.SecGroup("sg_1", name="sg_1")
foo = openstack.compute.Instance("foo",
name="terraform-test",
security_groups=[sg1.name])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
sg1, err := networking.NewSecGroup(ctx, "sg_1", &networking.SecGroupArgs{
Name: pulumi.String("sg_1"),
})
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "foo", &compute.InstanceArgs{
Name: pulumi.String("terraform-test"),
SecurityGroups: pulumi.StringArray{
sg1.Name,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var sg1 = new OpenStack.Networking.SecGroup("sg_1", new()
{
Name = "sg_1",
});
var foo = new OpenStack.Compute.Instance("foo", new()
{
Name = "terraform-test",
SecurityGroups = new[]
{
sg1.Name,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.SecGroup;
import com.pulumi.openstack.networking.SecGroupArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
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 sg1 = new SecGroup("sg1", SecGroupArgs.builder()
.name("sg_1")
.build());
var foo = new Instance("foo", InstanceArgs.builder()
.name("terraform-test")
.securityGroups(sg1.name())
.build());
}
}
resources:
sg1:
type: openstack:networking:SecGroup
name: sg_1
properties:
name: sg_1
foo:
type: openstack:compute:Instance
properties:
name: terraform-test
securityGroups:
- ${sg1.name}
Instances and Ports
Neutron Ports are a great feature and provide a lot of functionality. However, there are some notes to be aware of when mixing Instances and Ports:
In OpenStack environments prior to the Kilo release, deleting or recreating an Instance will cause the Instance’s Port(s) to be deleted. One way of working around this is to taint any Port(s) used in Instances which are to be recreated. See here for further information.
When attaching an Instance to one or more networks using Ports, place the security groups on the Port and not the Instance. If you place the security groups on the Instance, the security groups will not be applied upon creation, but they will be applied upon a refresh. This is a known OpenStack bug.
Network IP information is not available within an instance for networks that are attached with Ports. This is mostly due to the flexibility Neutron Ports provide when it comes to IP addresses. For example, a Neutron Port can have multiple Fixed IP addresses associated with it. It’s not possible to know which single IP address the user would want returned to the Instance’s state information. Therefore, in order for a Provisioner to connect to an Instance via it’s network Port, customize the
connectioninformation:
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const port1 = new openstack.networking.Port("port_1", {
name: "port_1",
adminStateUp: true,
networkId: "0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d",
securityGroupIds: [
"2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f",
"ca1e5ed7-dae8-4605-987b-fadaeeb30461",
],
});
const instance1 = new openstack.compute.Instance("instance_1", {
name: "instance_1",
networks: [{
port: port1.id,
}],
});
import pulumi
import pulumi_openstack as openstack
port1 = openstack.networking.Port("port_1",
name="port_1",
admin_state_up=True,
network_id="0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d",
security_group_ids=[
"2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f",
"ca1e5ed7-dae8-4605-987b-fadaeeb30461",
])
instance1 = openstack.compute.Instance("instance_1",
name="instance_1",
networks=[{
"port": port1.id,
}])
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
port1, err := networking.NewPort(ctx, "port_1", &networking.PortArgs{
Name: pulumi.String("port_1"),
AdminStateUp: pulumi.Bool(true),
NetworkId: pulumi.String("0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d"),
SecurityGroupIds: pulumi.StringArray{
pulumi.String("2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f"),
pulumi.String("ca1e5ed7-dae8-4605-987b-fadaeeb30461"),
},
})
if err != nil {
return err
}
_, err = compute.NewInstance(ctx, "instance_1", &compute.InstanceArgs{
Name: pulumi.String("instance_1"),
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Port: port1.ID(),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var port1 = new OpenStack.Networking.Port("port_1", new()
{
Name = "port_1",
AdminStateUp = true,
NetworkId = "0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d",
SecurityGroupIds = new[]
{
"2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f",
"ca1e5ed7-dae8-4605-987b-fadaeeb30461",
},
});
var instance1 = new OpenStack.Compute.Instance("instance_1", new()
{
Name = "instance_1",
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Port = port1.Id,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.Port;
import com.pulumi.openstack.networking.PortArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 port1 = new Port("port1", PortArgs.builder()
.name("port_1")
.adminStateUp(true)
.networkId("0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d")
.securityGroupIds(
"2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f",
"ca1e5ed7-dae8-4605-987b-fadaeeb30461")
.build());
var instance1 = new Instance("instance1", InstanceArgs.builder()
.name("instance_1")
.networks(InstanceNetworkArgs.builder()
.port(port1.id())
.build())
.build());
}
}
resources:
port1:
type: openstack:networking:Port
name: port_1
properties:
name: port_1
adminStateUp: 'true'
networkId: 0a1d0a27-cffa-4de3-92c5-9d3fd3f2e74d
securityGroupIds:
- 2f02d20a-8dca-49b7-b26f-b6ce9fddaf4f
- ca1e5ed7-dae8-4605-987b-fadaeeb30461
instance1:
type: openstack:compute:Instance
name: instance_1
properties:
name: instance_1
networks:
- port: ${port1.id}
Instances and Networks
Instances almost always require a network. Here are some notes to be aware of with how Instances and Networks relate:
In scenarios where you only have one network available, you can create an instance without specifying a
networkblock. OpenStack will automatically launch the instance on this network.If you have access to more than one network, you will need to specify a network with a
networkblock. Not specifying a network will result in the following error:
* openstack_compute_instance_v2.instance: Error creating OpenStack server:
Expected HTTP response code [201 202] when accessing [POST https://example.com:8774/v2.1/servers], but got 409 instead
{"conflictingRequest": {"message": "Multiple possible networks found, use a Network ID to be more specific.", "code": 409}}
- If you intend to use the
openstack.compute.InterfaceAttachresource, you still need to make sure one of the above points is satisfied. An instance cannot be created without a valid network configuration even if you intend to useopenstack.compute.InterfaceAttachafter the instance has been created.
Create Instance Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Instance(name: string, args?: InstanceArgs, opts?: CustomResourceOptions);@overload
def Instance(resource_name: str,
args: Optional[InstanceArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Instance(resource_name: str,
opts: Optional[ResourceOptions] = None,
admin_pass: Optional[str] = None,
availability_zone: Optional[str] = None,
availability_zone_hints: Optional[str] = None,
block_devices: Optional[Sequence[InstanceBlockDeviceArgs]] = None,
config_drive: Optional[bool] = None,
flavor_id: Optional[str] = None,
flavor_name: Optional[str] = None,
force_delete: Optional[bool] = None,
hypervisor_hostname: Optional[str] = None,
image_id: Optional[str] = None,
image_name: Optional[str] = None,
key_pair: Optional[str] = None,
metadata: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
network_mode: Optional[str] = None,
networks: Optional[Sequence[InstanceNetworkArgs]] = None,
personalities: Optional[Sequence[InstancePersonalityArgs]] = None,
power_state: Optional[str] = None,
region: Optional[str] = None,
scheduler_hints: Optional[Sequence[InstanceSchedulerHintArgs]] = None,
security_groups: Optional[Sequence[str]] = None,
stop_before_destroy: Optional[bool] = None,
tags: Optional[Sequence[str]] = None,
user_data: Optional[str] = None,
vendor_options: Optional[InstanceVendorOptionsArgs] = None)func NewInstance(ctx *Context, name string, args *InstanceArgs, opts ...ResourceOption) (*Instance, error)public Instance(string name, InstanceArgs? args = null, CustomResourceOptions? opts = null)
public Instance(String name, InstanceArgs args)
public Instance(String name, InstanceArgs args, CustomResourceOptions options)
type: openstack:compute:Instance
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args InstanceArgs
- 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 instanceResource = new OpenStack.Compute.Instance("instanceResource", new()
{
AdminPass = "string",
AvailabilityZone = "string",
AvailabilityZoneHints = "string",
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
SourceType = "string",
BootIndex = 0,
DeleteOnTermination = false,
DestinationType = "string",
DeviceType = "string",
DiskBus = "string",
GuestFormat = "string",
Multiattach = false,
Uuid = "string",
VolumeSize = 0,
VolumeType = "string",
},
},
ConfigDrive = false,
FlavorId = "string",
FlavorName = "string",
ForceDelete = false,
HypervisorHostname = "string",
ImageId = "string",
ImageName = "string",
KeyPair = "string",
Metadata =
{
{ "string", "string" },
},
Name = "string",
NetworkMode = "string",
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
AccessNetwork = false,
FixedIpV4 = "string",
FixedIpV6 = "string",
Mac = "string",
Name = "string",
Port = "string",
Uuid = "string",
},
},
Personalities = new[]
{
new OpenStack.Compute.Inputs.InstancePersonalityArgs
{
Content = "string",
File = "string",
},
},
PowerState = "string",
Region = "string",
SchedulerHints = new[]
{
new OpenStack.Compute.Inputs.InstanceSchedulerHintArgs
{
AdditionalProperties =
{
{ "string", "string" },
},
BuildNearHostIp = "string",
DifferentCells = new[]
{
"string",
},
DifferentHosts = new[]
{
"string",
},
Group = "string",
Queries = new[]
{
"string",
},
SameHosts = new[]
{
"string",
},
TargetCell = "string",
},
},
SecurityGroups = new[]
{
"string",
},
StopBeforeDestroy = false,
Tags = new[]
{
"string",
},
UserData = "string",
VendorOptions = new OpenStack.Compute.Inputs.InstanceVendorOptionsArgs
{
DetachPortsBeforeDestroy = false,
IgnoreResizeConfirmation = false,
},
});
example, err := compute.NewInstance(ctx, "instanceResource", &compute.InstanceArgs{
AdminPass: pulumi.String("string"),
AvailabilityZone: pulumi.String("string"),
AvailabilityZoneHints: pulumi.String("string"),
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
SourceType: pulumi.String("string"),
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(false),
DestinationType: pulumi.String("string"),
DeviceType: pulumi.String("string"),
DiskBus: pulumi.String("string"),
GuestFormat: pulumi.String("string"),
Multiattach: pulumi.Bool(false),
Uuid: pulumi.String("string"),
VolumeSize: pulumi.Int(0),
VolumeType: pulumi.String("string"),
},
},
ConfigDrive: pulumi.Bool(false),
FlavorId: pulumi.String("string"),
FlavorName: pulumi.String("string"),
ForceDelete: pulumi.Bool(false),
HypervisorHostname: pulumi.String("string"),
ImageId: pulumi.String("string"),
ImageName: pulumi.String("string"),
KeyPair: pulumi.String("string"),
Metadata: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
NetworkMode: pulumi.String("string"),
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
AccessNetwork: pulumi.Bool(false),
FixedIpV4: pulumi.String("string"),
FixedIpV6: pulumi.String("string"),
Mac: pulumi.String("string"),
Name: pulumi.String("string"),
Port: pulumi.String("string"),
Uuid: pulumi.String("string"),
},
},
Personalities: compute.InstancePersonalityArray{
&compute.InstancePersonalityArgs{
Content: pulumi.String("string"),
File: pulumi.String("string"),
},
},
PowerState: pulumi.String("string"),
Region: pulumi.String("string"),
SchedulerHints: compute.InstanceSchedulerHintArray{
&compute.InstanceSchedulerHintArgs{
AdditionalProperties: pulumi.StringMap{
"string": pulumi.String("string"),
},
BuildNearHostIp: pulumi.String("string"),
DifferentCells: pulumi.StringArray{
pulumi.String("string"),
},
DifferentHosts: pulumi.StringArray{
pulumi.String("string"),
},
Group: pulumi.String("string"),
Queries: pulumi.StringArray{
pulumi.String("string"),
},
SameHosts: pulumi.StringArray{
pulumi.String("string"),
},
TargetCell: pulumi.String("string"),
},
},
SecurityGroups: pulumi.StringArray{
pulumi.String("string"),
},
StopBeforeDestroy: pulumi.Bool(false),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
UserData: pulumi.String("string"),
VendorOptions: &compute.InstanceVendorOptionsArgs{
DetachPortsBeforeDestroy: pulumi.Bool(false),
IgnoreResizeConfirmation: pulumi.Bool(false),
},
})
var instanceResource = new com.pulumi.openstack.compute.Instance("instanceResource", com.pulumi.openstack.compute.InstanceArgs.builder()
.adminPass("string")
.availabilityZone("string")
.availabilityZoneHints("string")
.blockDevices(InstanceBlockDeviceArgs.builder()
.sourceType("string")
.bootIndex(0)
.deleteOnTermination(false)
.destinationType("string")
.deviceType("string")
.diskBus("string")
.guestFormat("string")
.multiattach(false)
.uuid("string")
.volumeSize(0)
.volumeType("string")
.build())
.configDrive(false)
.flavorId("string")
.flavorName("string")
.forceDelete(false)
.hypervisorHostname("string")
.imageId("string")
.imageName("string")
.keyPair("string")
.metadata(Map.of("string", "string"))
.name("string")
.networkMode("string")
.networks(InstanceNetworkArgs.builder()
.accessNetwork(false)
.fixedIpV4("string")
.fixedIpV6("string")
.mac("string")
.name("string")
.port("string")
.uuid("string")
.build())
.personalities(InstancePersonalityArgs.builder()
.content("string")
.file("string")
.build())
.powerState("string")
.region("string")
.schedulerHints(InstanceSchedulerHintArgs.builder()
.additionalProperties(Map.of("string", "string"))
.buildNearHostIp("string")
.differentCells("string")
.differentHosts("string")
.group("string")
.queries("string")
.sameHosts("string")
.targetCell("string")
.build())
.securityGroups("string")
.stopBeforeDestroy(false)
.tags("string")
.userData("string")
.vendorOptions(InstanceVendorOptionsArgs.builder()
.detachPortsBeforeDestroy(false)
.ignoreResizeConfirmation(false)
.build())
.build());
instance_resource = openstack.compute.Instance("instanceResource",
admin_pass="string",
availability_zone="string",
availability_zone_hints="string",
block_devices=[{
"source_type": "string",
"boot_index": 0,
"delete_on_termination": False,
"destination_type": "string",
"device_type": "string",
"disk_bus": "string",
"guest_format": "string",
"multiattach": False,
"uuid": "string",
"volume_size": 0,
"volume_type": "string",
}],
config_drive=False,
flavor_id="string",
flavor_name="string",
force_delete=False,
hypervisor_hostname="string",
image_id="string",
image_name="string",
key_pair="string",
metadata={
"string": "string",
},
name="string",
network_mode="string",
networks=[{
"access_network": False,
"fixed_ip_v4": "string",
"fixed_ip_v6": "string",
"mac": "string",
"name": "string",
"port": "string",
"uuid": "string",
}],
personalities=[{
"content": "string",
"file": "string",
}],
power_state="string",
region="string",
scheduler_hints=[{
"additional_properties": {
"string": "string",
},
"build_near_host_ip": "string",
"different_cells": ["string"],
"different_hosts": ["string"],
"group": "string",
"queries": ["string"],
"same_hosts": ["string"],
"target_cell": "string",
}],
security_groups=["string"],
stop_before_destroy=False,
tags=["string"],
user_data="string",
vendor_options={
"detach_ports_before_destroy": False,
"ignore_resize_confirmation": False,
})
const instanceResource = new openstack.compute.Instance("instanceResource", {
adminPass: "string",
availabilityZone: "string",
availabilityZoneHints: "string",
blockDevices: [{
sourceType: "string",
bootIndex: 0,
deleteOnTermination: false,
destinationType: "string",
deviceType: "string",
diskBus: "string",
guestFormat: "string",
multiattach: false,
uuid: "string",
volumeSize: 0,
volumeType: "string",
}],
configDrive: false,
flavorId: "string",
flavorName: "string",
forceDelete: false,
hypervisorHostname: "string",
imageId: "string",
imageName: "string",
keyPair: "string",
metadata: {
string: "string",
},
name: "string",
networkMode: "string",
networks: [{
accessNetwork: false,
fixedIpV4: "string",
fixedIpV6: "string",
mac: "string",
name: "string",
port: "string",
uuid: "string",
}],
personalities: [{
content: "string",
file: "string",
}],
powerState: "string",
region: "string",
schedulerHints: [{
additionalProperties: {
string: "string",
},
buildNearHostIp: "string",
differentCells: ["string"],
differentHosts: ["string"],
group: "string",
queries: ["string"],
sameHosts: ["string"],
targetCell: "string",
}],
securityGroups: ["string"],
stopBeforeDestroy: false,
tags: ["string"],
userData: "string",
vendorOptions: {
detachPortsBeforeDestroy: false,
ignoreResizeConfirmation: false,
},
});
type: openstack:compute:Instance
properties:
adminPass: string
availabilityZone: string
availabilityZoneHints: string
blockDevices:
- bootIndex: 0
deleteOnTermination: false
destinationType: string
deviceType: string
diskBus: string
guestFormat: string
multiattach: false
sourceType: string
uuid: string
volumeSize: 0
volumeType: string
configDrive: false
flavorId: string
flavorName: string
forceDelete: false
hypervisorHostname: string
imageId: string
imageName: string
keyPair: string
metadata:
string: string
name: string
networkMode: string
networks:
- accessNetwork: false
fixedIpV4: string
fixedIpV6: string
mac: string
name: string
port: string
uuid: string
personalities:
- content: string
file: string
powerState: string
region: string
schedulerHints:
- additionalProperties:
string: string
buildNearHostIp: string
differentCells:
- string
differentHosts:
- string
group: string
queries:
- string
sameHosts:
- string
targetCell: string
securityGroups:
- string
stopBeforeDestroy: false
tags:
- string
userData: string
vendorOptions:
detachPortsBeforeDestroy: false
ignoreResizeConfirmation: false
Instance 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 Instance resource accepts the following input properties:
- Admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- Availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - Availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - Block
Devices List<Pulumi.Open Stack. Compute. Inputs. Instance Block Device> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- Config
Drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- Flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- Flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- Force
Delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- Hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - Image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - Image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - Key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- Metadata Dictionary<string, string>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- Name string
- A unique name for the resource.
- Network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - Networks
List<Pulumi.
Open Stack. Compute. Inputs. Instance Network> - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- Personalities
List<Pulumi.
Open Stack. Compute. Inputs. Instance Personality> - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - Power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- Region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - Scheduler
Hints List<Pulumi.Open Stack. Compute. Inputs. Instance Scheduler Hint> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- Security
Groups List<string> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- Stop
Before boolDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<string>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- User
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- Vendor
Options Pulumi.Open Stack. Compute. Inputs. Instance Vendor Options - Map of additional vendor-specific options. Supported options are described below.
- Admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- Availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - Availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - Block
Devices []InstanceBlock Device Args - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- Config
Drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- Flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- Flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- Force
Delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- Hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - Image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - Image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - Key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- Metadata map[string]string
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- Name string
- A unique name for the resource.
- Network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - Networks
[]Instance
Network Args - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- Personalities
[]Instance
Personality Args - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - Power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- Region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - Scheduler
Hints []InstanceScheduler Hint Args - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- Security
Groups []string - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- Stop
Before boolDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- []string
- A set of string tags for the instance. Changing this updates the existing instance tags.
- User
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- Vendor
Options InstanceVendor Options Args - Map of additional vendor-specific options. Supported options are described below.
- admin
Pass String - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- availability
Zone String - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone StringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices List<InstanceBlock Device> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive Boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- flavor
Id String - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name String - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete Boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname String - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id String - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name String - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair String - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Map<String,String>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name String
- A unique name for the resource.
- network
Mode String - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
List<Instance
Network> - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
List<Instance
Personality> - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State String - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region String
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints List<InstanceScheduler Hint> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups List<String> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before BooleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<String>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- user
Data String - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options InstanceVendor Options - Map of additional vendor-specific options. Supported options are described below.
- admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices InstanceBlock Device[] - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata {[key: string]: string}
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name string
- A unique name for the resource.
- network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
Instance
Network[] - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
Instance
Personality[] - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints InstanceScheduler Hint[] - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups string[] - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before booleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- string[]
- A set of string tags for the instance. Changing this updates the existing instance tags.
- user
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options InstanceVendor Options - Map of additional vendor-specific options. Supported options are described below.
- admin_
pass str - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- availability_
zone str - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability_
zone_ strhints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block_
devices Sequence[InstanceBlock Device Args] - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config_
drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- flavor_
id str - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor_
name str - The name of the desired flavor for the server. Changing this resizes the existing server.
- force_
delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor_
hostname str - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image_
id str - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image_
name str - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key_
pair str - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Mapping[str, str]
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name str
- A unique name for the resource.
- network_
mode str - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
Sequence[Instance
Network Args] - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
Sequence[Instance
Personality Args] - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power_
state str - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region str
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler_
hints Sequence[InstanceScheduler Hint Args] - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security_
groups Sequence[str] - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop_
before_ booldestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- Sequence[str]
- A set of string tags for the instance. Changing this updates the existing instance tags.
- user_
data str - The user data to provide when launching the instance. Changing this creates a new server.
- vendor_
options InstanceVendor Options Args - Map of additional vendor-specific options. Supported options are described below.
- admin
Pass String - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- availability
Zone String - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone StringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices List<Property Map> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive Boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- flavor
Id String - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name String - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete Boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname String - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id String - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name String - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair String - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Map<String>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name String
- A unique name for the resource.
- network
Mode String - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks List<Property Map>
- An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities List<Property Map>
- Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State String - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region String
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints List<Property Map> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups List<String> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before BooleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<String>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- user
Data String - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options Property Map - Map of additional vendor-specific options. Supported options are described below.
Outputs
All input properties are implicitly available as output properties. Additionally, the Instance resource produces the following output properties:
- Access
Ip stringV4 - The first detected Fixed IPv4 address.
- Access
Ip stringV6 - The first detected Fixed IPv6 address.
- All
Metadata Dictionary<string, string> - Contains all instance metadata, even metadata not set by Terraform.
- List<string>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- Created string
- The creation time of the instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Updated string
- The time when the instance was last updated.
- Access
Ip stringV4 - The first detected Fixed IPv4 address.
- Access
Ip stringV6 - The first detected Fixed IPv6 address.
- All
Metadata map[string]string - Contains all instance metadata, even metadata not set by Terraform.
- []string
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- Created string
- The creation time of the instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Updated string
- The time when the instance was last updated.
- access
Ip StringV4 - The first detected Fixed IPv4 address.
- access
Ip StringV6 - The first detected Fixed IPv6 address.
- all
Metadata Map<String,String> - Contains all instance metadata, even metadata not set by Terraform.
- List<String>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- created String
- The creation time of the instance.
- id String
- The provider-assigned unique ID for this managed resource.
- updated String
- The time when the instance was last updated.
- access
Ip stringV4 - The first detected Fixed IPv4 address.
- access
Ip stringV6 - The first detected Fixed IPv6 address.
- all
Metadata {[key: string]: string} - Contains all instance metadata, even metadata not set by Terraform.
- string[]
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- created string
- The creation time of the instance.
- id string
- The provider-assigned unique ID for this managed resource.
- updated string
- The time when the instance was last updated.
- access_
ip_ strv4 - The first detected Fixed IPv4 address.
- access_
ip_ strv6 - The first detected Fixed IPv6 address.
- all_
metadata Mapping[str, str] - Contains all instance metadata, even metadata not set by Terraform.
- Sequence[str]
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- created str
- The creation time of the instance.
- id str
- The provider-assigned unique ID for this managed resource.
- updated str
- The time when the instance was last updated.
- access
Ip StringV4 - The first detected Fixed IPv4 address.
- access
Ip StringV6 - The first detected Fixed IPv6 address.
- all
Metadata Map<String> - Contains all instance metadata, even metadata not set by Terraform.
- List<String>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- created String
- The creation time of the instance.
- id String
- The provider-assigned unique ID for this managed resource.
- updated String
- The time when the instance was last updated.
Look up Existing Instance Resource
Get an existing Instance 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?: InstanceState, opts?: CustomResourceOptions): Instance@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_ip_v4: Optional[str] = None,
access_ip_v6: Optional[str] = None,
admin_pass: Optional[str] = None,
all_metadata: Optional[Mapping[str, str]] = None,
all_tags: Optional[Sequence[str]] = None,
availability_zone: Optional[str] = None,
availability_zone_hints: Optional[str] = None,
block_devices: Optional[Sequence[InstanceBlockDeviceArgs]] = None,
config_drive: Optional[bool] = None,
created: Optional[str] = None,
flavor_id: Optional[str] = None,
flavor_name: Optional[str] = None,
force_delete: Optional[bool] = None,
hypervisor_hostname: Optional[str] = None,
image_id: Optional[str] = None,
image_name: Optional[str] = None,
key_pair: Optional[str] = None,
metadata: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
network_mode: Optional[str] = None,
networks: Optional[Sequence[InstanceNetworkArgs]] = None,
personalities: Optional[Sequence[InstancePersonalityArgs]] = None,
power_state: Optional[str] = None,
region: Optional[str] = None,
scheduler_hints: Optional[Sequence[InstanceSchedulerHintArgs]] = None,
security_groups: Optional[Sequence[str]] = None,
stop_before_destroy: Optional[bool] = None,
tags: Optional[Sequence[str]] = None,
updated: Optional[str] = None,
user_data: Optional[str] = None,
vendor_options: Optional[InstanceVendorOptionsArgs] = None) -> Instancefunc GetInstance(ctx *Context, name string, id IDInput, state *InstanceState, opts ...ResourceOption) (*Instance, error)public static Instance Get(string name, Input<string> id, InstanceState? state, CustomResourceOptions? opts = null)public static Instance get(String name, Output<String> id, InstanceState state, CustomResourceOptions options)resources: _: type: openstack:compute:Instance get: id: ${id}- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Access
Ip stringV4 - The first detected Fixed IPv4 address.
- Access
Ip stringV6 - The first detected Fixed IPv6 address.
- Admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- All
Metadata Dictionary<string, string> - Contains all instance metadata, even metadata not set by Terraform.
- List<string>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- Availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - Availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - Block
Devices List<Pulumi.Open Stack. Compute. Inputs. Instance Block Device> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- Config
Drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- Created string
- The creation time of the instance.
- Flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- Flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- Force
Delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- Hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - Image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - Image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - Key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- Metadata Dictionary<string, string>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- Name string
- A unique name for the resource.
- Network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - Networks
List<Pulumi.
Open Stack. Compute. Inputs. Instance Network> - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- Personalities
List<Pulumi.
Open Stack. Compute. Inputs. Instance Personality> - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - Power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- Region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - Scheduler
Hints List<Pulumi.Open Stack. Compute. Inputs. Instance Scheduler Hint> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- Security
Groups List<string> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- Stop
Before boolDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<string>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- Updated string
- The time when the instance was last updated.
- User
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- Vendor
Options Pulumi.Open Stack. Compute. Inputs. Instance Vendor Options - Map of additional vendor-specific options. Supported options are described below.
- Access
Ip stringV4 - The first detected Fixed IPv4 address.
- Access
Ip stringV6 - The first detected Fixed IPv6 address.
- Admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- All
Metadata map[string]string - Contains all instance metadata, even metadata not set by Terraform.
- []string
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- Availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - Availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - Block
Devices []InstanceBlock Device Args - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- Config
Drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- Created string
- The creation time of the instance.
- Flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- Flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- Force
Delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- Hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - Image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - Image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - Key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- Metadata map[string]string
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- Name string
- A unique name for the resource.
- Network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - Networks
[]Instance
Network Args - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- Personalities
[]Instance
Personality Args - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - Power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- Region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - Scheduler
Hints []InstanceScheduler Hint Args - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- Security
Groups []string - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- Stop
Before boolDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- []string
- A set of string tags for the instance. Changing this updates the existing instance tags.
- Updated string
- The time when the instance was last updated.
- User
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- Vendor
Options InstanceVendor Options Args - Map of additional vendor-specific options. Supported options are described below.
- access
Ip StringV4 - The first detected Fixed IPv4 address.
- access
Ip StringV6 - The first detected Fixed IPv6 address.
- admin
Pass String - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- all
Metadata Map<String,String> - Contains all instance metadata, even metadata not set by Terraform.
- List<String>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- availability
Zone String - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone StringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices List<InstanceBlock Device> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive Boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- created String
- The creation time of the instance.
- flavor
Id String - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name String - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete Boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname String - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id String - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name String - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair String - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Map<String,String>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name String
- A unique name for the resource.
- network
Mode String - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
List<Instance
Network> - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
List<Instance
Personality> - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State String - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region String
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints List<InstanceScheduler Hint> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups List<String> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before BooleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<String>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- updated String
- The time when the instance was last updated.
- user
Data String - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options InstanceVendor Options - Map of additional vendor-specific options. Supported options are described below.
- access
Ip stringV4 - The first detected Fixed IPv4 address.
- access
Ip stringV6 - The first detected Fixed IPv6 address.
- admin
Pass string - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- all
Metadata {[key: string]: string} - Contains all instance metadata, even metadata not set by Terraform.
- string[]
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- availability
Zone string - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone stringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices InstanceBlock Device[] - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- created string
- The creation time of the instance.
- flavor
Id string - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name string - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname string - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id string - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name string - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair string - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata {[key: string]: string}
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name string
- A unique name for the resource.
- network
Mode string - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
Instance
Network[] - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
Instance
Personality[] - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State string - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region string
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints InstanceScheduler Hint[] - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups string[] - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before booleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- string[]
- A set of string tags for the instance. Changing this updates the existing instance tags.
- updated string
- The time when the instance was last updated.
- user
Data string - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options InstanceVendor Options - Map of additional vendor-specific options. Supported options are described below.
- access_
ip_ strv4 - The first detected Fixed IPv4 address.
- access_
ip_ strv6 - The first detected Fixed IPv6 address.
- admin_
pass str - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- all_
metadata Mapping[str, str] - Contains all instance metadata, even metadata not set by Terraform.
- Sequence[str]
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- availability_
zone str - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability_
zone_ strhints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block_
devices Sequence[InstanceBlock Device Args] - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config_
drive bool - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- created str
- The creation time of the instance.
- flavor_
id str - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor_
name str - The name of the desired flavor for the server. Changing this resizes the existing server.
- force_
delete bool - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor_
hostname str - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image_
id str - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image_
name str - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key_
pair str - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Mapping[str, str]
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name str
- A unique name for the resource.
- network_
mode str - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks
Sequence[Instance
Network Args] - An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities
Sequence[Instance
Personality Args] - Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power_
state str - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region str
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler_
hints Sequence[InstanceScheduler Hint Args] - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security_
groups Sequence[str] - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop_
before_ booldestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- Sequence[str]
- A set of string tags for the instance. Changing this updates the existing instance tags.
- updated str
- The time when the instance was last updated.
- user_
data str - The user data to provide when launching the instance. Changing this creates a new server.
- vendor_
options InstanceVendor Options Args - Map of additional vendor-specific options. Supported options are described below.
- access
Ip StringV4 - The first detected Fixed IPv4 address.
- access
Ip StringV6 - The first detected Fixed IPv6 address.
- admin
Pass String - The administrative password to assign to the server. Changing this changes the root password on the existing server.
- all
Metadata Map<String> - Contains all instance metadata, even metadata not set by Terraform.
- List<String>
- The collection of tags assigned on the instance, which have been explicitly and implicitly added.
- availability
Zone String - The availability zone in which to create
the server. Conflicts with
availabilityZoneHints. Changing this creates a new server. - availability
Zone StringHints - The availability zone in which to
create the server. This argument is preferred to
availabilityZone, when scheduling the server on a particular host or node. Conflicts withavailabilityZone. Changing this creates a new server. - block
Devices List<Property Map> - Configuration of block devices. The blockDevice structure is documented below. Changing this creates a new server. You can specify multiple block devices which will create an instance with multiple disks. This configuration is very flexible, so please see the following reference for more information.
- config
Drive Boolean - Whether to use the configDrive feature to configure the instance. Changing this creates a new server.
- created String
- The creation time of the instance.
- flavor
Id String - The flavor ID of the desired flavor for the server. Changing this resizes the existing server.
- flavor
Name String - The name of the desired flavor for the server. Changing this resizes the existing server.
- force
Delete Boolean - Whether to force the OpenStack instance to be forcefully deleted. This is useful for environments that have reclaim / soft deletion enabled.
- hypervisor
Hostname String - Specifies the exact hypervisor hostname on
which to create the instance. When provided, this parameter is included in
the request to Nova, directing the scheduler to launch the instance on the
specified host. Note: This option requires administrative privileges and a
Nova microversion of 2.74 or later. Conflicts with
personality. Changing this value forces a new instance to be created. - image
Id String - (Optional; Required if
imageNameis empty and not booting from a volume. Do not specify if booting from a volume.) The image ID of the desired image for the server. Changing this rebuilds the existing server. - image
Name String - (Optional; Required if
imageIdis empty and not booting from a volume. Do not specify if booting from a volume.) The name of the desired image for the server. Changing this rebuilds the existing server. - key
Pair String - The name of a key pair to put on the server. The key pair must already be created and associated with the tenant's account. Changing this creates a new server.
- metadata Map<String>
- Metadata key/value pairs to make available from within the instance. Changing this updates the existing server metadata.
- name String
- A unique name for the resource.
- network
Mode String - Special string for
networkoption to create the server.networkModecan be"auto"or"none". Please see the following reference for more information. Conflicts withnetwork. - networks List<Property Map>
- An array of one or more networks to attach to the instance. The network object structure is documented below. Changing this creates a new server.
- personalities List<Property Map>
- Customize the personality of an instance by
defining one or more files and their contents. The personality structure is
described below. Conflicts with
hypervisorHostname. Changing this rebuilds the existing server. - power
State String - Provide the VM state. Only 'active', 'shutoff', 'paused' and 'shelved_offloaded' are supported values. Note: If the initial powerState is the shutoff or paused the VM will be stopped immediately after build and the provisioners like remote-exec or files are not supported.
- region String
- The region in which to create the server instance. If
omitted, the
regionargument of the provider is used. Changing this creates a new server. - scheduler
Hints List<Property Map> - Provide the Nova scheduler with hints on how the instance should be launched. The available hints are described below.
- security
Groups List<String> - An array of one or more security group names to associate with the server. Changing this results in adding/removing security groups from the existing server. Note: When attaching the instance to networks using Ports, place the security groups on the Port and not the instance. Note: Names should be used and not ids, as ids trigger unnecessary updates.
- stop
Before BooleanDestroy - Whether to try stop instance gracefully before destroying it, thus giving chance for guest OS daemons to stop correctly. If instance doesn't stop within timeout, it will be destroyed anyway.
- List<String>
- A set of string tags for the instance. Changing this updates the existing instance tags.
- updated String
- The time when the instance was last updated.
- user
Data String - The user data to provide when launching the instance. Changing this creates a new server.
- vendor
Options Property Map - Map of additional vendor-specific options. Supported options are described below.
Supporting Types
InstanceBlockDevice, InstanceBlockDeviceArgs
- Source
Type string - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- Boot
Index int - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- Delete
On boolTermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- Destination
Type string - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- Device
Type string - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- Disk
Bus string - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- Guest
Format string - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - Multiattach bool
- Enable the attachment of multiattach-capable volumes.
- Uuid string
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- Volume
Size int - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- Volume
Type string - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
- Source
Type string - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- Boot
Index int - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- Delete
On boolTermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- Destination
Type string - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- Device
Type string - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- Disk
Bus string - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- Guest
Format string - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - Multiattach bool
- Enable the attachment of multiattach-capable volumes.
- Uuid string
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- Volume
Size int - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- Volume
Type string - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
- source
Type String - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- boot
Index Integer - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- delete
On BooleanTermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- destination
Type String - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- device
Type String - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- disk
Bus String - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- guest
Format String - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - multiattach Boolean
- Enable the attachment of multiattach-capable volumes.
- uuid String
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- volume
Size Integer - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- volume
Type String - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
- source
Type string - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- boot
Index number - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- delete
On booleanTermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- destination
Type string - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- device
Type string - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- disk
Bus string - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- guest
Format string - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - multiattach boolean
- Enable the attachment of multiattach-capable volumes.
- uuid string
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- volume
Size number - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- volume
Type string - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
- source_
type str - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- boot_
index int - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- delete_
on_ booltermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- destination_
type str - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- device_
type str - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- disk_
bus str - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- guest_
format str - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - multiattach bool
- Enable the attachment of multiattach-capable volumes.
- uuid str
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- volume_
size int - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- volume_
type str - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
- source
Type String - The source type of the device. Must be one of "blank", "image", "volume", or "snapshot". Changing this creates a new server.
- boot
Index Number - The boot index of the volume. It defaults to 0. Changing this creates a new server.
- delete
On BooleanTermination - Delete the volume / block device upon termination of the instance. Defaults to false. Changing this creates a new server.
- destination
Type String - The type that gets created. Possible values are "volume" and "local". Changing this creates a new server.
- device
Type String - The low-level device type that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- disk
Bus String - The low-level disk bus that will be used. Most common thing is to leave this empty. Changing this creates a new server.
- guest
Format String - Specifies the guest server disk file system format,
such as
ext2,ext3,ext4,xfsorswap. Swap block device mappings have the following restrictions: sourceType must be blank and destinationType must be local and only one swap disk per server and the size of the swap disk must be less than or equal to the swap size of the flavor. Changing this creates a new server. - multiattach Boolean
- Enable the attachment of multiattach-capable volumes.
- uuid String
- The UUID of the image, volume, or snapshot. Changing this creates a new server.
- volume
Size Number - The size of the volume to create (in gigabytes). Required in the following combinations: source=image and destination=volume, source=blank and destination=local, and source=blank and destination=volume. Changing this creates a new server.
- volume
Type String - The volume type that will be used, for example SSD or HDD storage. The available options depend on how your specific OpenStack cloud is configured and what classes of storage are provided. Changing this creates a new server.
InstanceNetwork, InstanceNetworkArgs
- Access
Network bool - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- Fixed
Ip stringV4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- Fixed
Ip stringV6 - Mac string
- Name string
- The human-readable name of the network. Changing this creates a new server.
- Port string
- The port UUID of a network to attach to the server. Changing this creates a new server.
- Uuid string
- The network UUID to attach to the server. Changing this creates a new server.
- Access
Network bool - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- Fixed
Ip stringV4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- Fixed
Ip stringV6 - Mac string
- Name string
- The human-readable name of the network. Changing this creates a new server.
- Port string
- The port UUID of a network to attach to the server. Changing this creates a new server.
- Uuid string
- The network UUID to attach to the server. Changing this creates a new server.
- access
Network Boolean - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- fixed
Ip StringV4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- fixed
Ip StringV6 - mac String
- name String
- The human-readable name of the network. Changing this creates a new server.
- port String
- The port UUID of a network to attach to the server. Changing this creates a new server.
- uuid String
- The network UUID to attach to the server. Changing this creates a new server.
- access
Network boolean - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- fixed
Ip stringV4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- fixed
Ip stringV6 - mac string
- name string
- The human-readable name of the network. Changing this creates a new server.
- port string
- The port UUID of a network to attach to the server. Changing this creates a new server.
- uuid string
- The network UUID to attach to the server. Changing this creates a new server.
- access_
network bool - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- fixed_
ip_ strv4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- fixed_
ip_ strv6 - mac str
- name str
- The human-readable name of the network. Changing this creates a new server.
- port str
- The port UUID of a network to attach to the server. Changing this creates a new server.
- uuid str
- The network UUID to attach to the server. Changing this creates a new server.
- access
Network Boolean - Specifies if this network should be used for provisioning access. Accepts true or false. Defaults to false.
- fixed
Ip StringV4 - Specifies a fixed IPv4 address to be used on this network. Changing this creates a new server.
- fixed
Ip StringV6 - mac String
- name String
- The human-readable name of the network. Changing this creates a new server.
- port String
- The port UUID of a network to attach to the server. Changing this creates a new server.
- uuid String
- The network UUID to attach to the server. Changing this creates a new server.
InstancePersonality, InstancePersonalityArgs
InstanceSchedulerHint, InstanceSchedulerHintArgs
- Additional
Properties Dictionary<string, string> - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- Build
Near stringHost Ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- Different
Cells List<string> - The names of cells where not to build the instance.
- Different
Hosts List<string> - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- Group string
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- Queries List<string>
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - Same
Hosts List<string> - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- Target
Cell string - The name of a cell to host the instance.
- Additional
Properties map[string]string - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- Build
Near stringHost Ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- Different
Cells []string - The names of cells where not to build the instance.
- Different
Hosts []string - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- Group string
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- Queries []string
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - Same
Hosts []string - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- Target
Cell string - The name of a cell to host the instance.
- additional
Properties Map<String,String> - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- build
Near StringHost Ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- different
Cells List<String> - The names of cells where not to build the instance.
- different
Hosts List<String> - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- group String
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- queries List<String>
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - same
Hosts List<String> - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- target
Cell String - The name of a cell to host the instance.
- additional
Properties {[key: string]: string} - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- build
Near stringHost Ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- different
Cells string[] - The names of cells where not to build the instance.
- different
Hosts string[] - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- group string
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- queries string[]
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - same
Hosts string[] - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- target
Cell string - The name of a cell to host the instance.
- additional_
properties Mapping[str, str] - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- build_
near_ strhost_ ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- different_
cells Sequence[str] - The names of cells where not to build the instance.
- different_
hosts Sequence[str] - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- group str
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- queries Sequence[str]
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - same_
hosts Sequence[str] - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- target_
cell str - The name of a cell to host the instance.
- additional
Properties Map<String> - Arbitrary key/value pairs of additional properties to pass to the scheduler.
- build
Near StringHost Ip - An IP Address in CIDR form. The instance will be placed on a compute node that is in the same subnet.
- different
Cells List<String> - The names of cells where not to build the instance.
- different
Hosts List<String> - A list of instance UUIDs. The instance will be scheduled on a different host than all other instances.
- group String
- A UUID of a Server Group. The instance will be placed into that group. See reference for details on managing servergroup resources
- queries List<String>
- A conditional query that a compute node must pass in
order to host an instance. The query must use the
JsonFiltersyntax which is described here. At this time, only simple queries are supported. Compound queries usingand,or, ornotare not supported. An example of a simple query is:[">=", "$free_ram_mb", "1024"] - same
Hosts List<String> - A list of instance UUIDs. The instance will be scheduled on the same host of those specified.
- target
Cell String - The name of a cell to host the instance.
InstanceVendorOptions, InstanceVendorOptionsArgs
- Detach
Ports boolBefore Destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- Ignore
Resize boolConfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
- Detach
Ports boolBefore Destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- Ignore
Resize boolConfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
- detach
Ports BooleanBefore Destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- ignore
Resize BooleanConfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
- detach
Ports booleanBefore Destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- ignore
Resize booleanConfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
- detach_
ports_ boolbefore_ destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- ignore_
resize_ boolconfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
- detach
Ports BooleanBefore Destroy - Whether to try to detach all attached ports to the vm before destroying it to make sure the port state is correct after the vm destruction. This is helpful when the port is not deleted.
- ignore
Resize BooleanConfirmation - Boolean to control whether to ignore manual confirmation of the instance resizing. This can be helpful to work with some OpenStack clouds which automatically confirm resizing of instances after some timeout.
Import
ing instances
Importing instances can be tricky, since the nova api does not offer all information provided at creation time for later retrieval. Network interface attachment order, and number and sizes of ephemeral disks are examples of this.
Importing basic instance
Assume you want to import an instance with one ephemeral root disk, and one network interface.
Your configuration would look like the following:
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const basicInstance = new openstack.compute.Instance("basic_instance", {
name: "basic",
flavorId: "<flavor_id>",
keyPair: "<keyname>",
securityGroups: ["default"],
imageId: "<image_id>",
networks: [{
name: "<network_name>",
}],
});
import pulumi
import pulumi_openstack as openstack
basic_instance = openstack.compute.Instance("basic_instance",
name="basic",
flavor_id="<flavor_id>",
key_pair="<keyname>",
security_groups=["default"],
image_id="<image_id>",
networks=[{
"name": "<network_name>",
}])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var basicInstance = new OpenStack.Compute.Instance("basic_instance", new()
{
Name = "basic",
FlavorId = "<flavor_id>",
KeyPair = "<keyname>",
SecurityGroups = new[]
{
"default",
},
ImageId = "<image_id>",
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "<network_name>",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "basic_instance", &compute.InstanceArgs{
Name: pulumi.String("basic"),
FlavorId: pulumi.String("<flavor_id>"),
KeyPair: pulumi.String("<keyname>"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
ImageId: pulumi.String("<image_id>"),
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("<network_name>"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 basicInstance = new Instance("basicInstance", InstanceArgs.builder()
.name("basic")
.flavorId("<flavor_id>")
.keyPair("<keyname>")
.securityGroups("default")
.imageId("<image_id>")
.networks(InstanceNetworkArgs.builder()
.name("<network_name>")
.build())
.build());
}
}
resources:
basicInstance:
type: openstack:compute:Instance
name: basic_instance
properties:
name: basic
flavorId: <flavor_id>
keyPair: <keyname>
securityGroups:
- default
imageId: <image_id>
networks:
- name: <network_name>
Then you execute
terraform import openstack_compute_instance_v2.basic_instance instance_id
Importing an instance with multiple emphemeral disks
The importer cannot read the emphemeral disk configuration of an instance, so just specify imageId as in the configuration of the basic instance example.
Importing instance with multiple network interfaces.
Nova returns the network interfaces grouped by network, thus not in creation order. That means that if you have multiple network interfaces you must take care of the order of networks in your configuration.
As example we want to import an instance with one ephemeral root disk, and 3 network interfaces.
Examples
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const boot_from_volume = new openstack.compute.Instance("boot-from-volume", {
name: "boot-from-volume",
flavorId: "<flavor_id",
keyPair: "<keyname>",
imageId: "<image_id>",
securityGroups: ["default"],
networks: [
{
name: "<network1>",
},
{
name: "<network2>",
},
{
name: "<network1>",
fixedIpV4: "<fixed_ip_v4>",
},
],
});
import pulumi
import pulumi_openstack as openstack
boot_from_volume = openstack.compute.Instance("boot-from-volume",
name="boot-from-volume",
flavor_id="<flavor_id",
key_pair="<keyname>",
image_id="<image_id>",
security_groups=["default"],
networks=[
{
"name": "<network1>",
},
{
"name": "<network2>",
},
{
"name": "<network1>",
"fixed_ip_v4": "<fixed_ip_v4>",
},
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var boot_from_volume = new OpenStack.Compute.Instance("boot-from-volume", new()
{
Name = "boot-from-volume",
FlavorId = "<flavor_id",
KeyPair = "<keyname>",
ImageId = "<image_id>",
SecurityGroups = new[]
{
"default",
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "<network1>",
},
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "<network2>",
},
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "<network1>",
FixedIpV4 = "<fixed_ip_v4>",
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewInstance(ctx, "boot-from-volume", &compute.InstanceArgs{
Name: pulumi.String("boot-from-volume"),
FlavorId: pulumi.String("<flavor_id"),
KeyPair: pulumi.String("<keyname>"),
ImageId: pulumi.String("<image_id>"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("<network1>"),
},
&compute.InstanceNetworkArgs{
Name: pulumi.String("<network2>"),
},
&compute.InstanceNetworkArgs{
Name: pulumi.String("<network1>"),
FixedIpV4: pulumi.String("<fixed_ip_v4>"),
},
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
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 boot_from_volume = new Instance("boot-from-volume", InstanceArgs.builder()
.name("boot-from-volume")
.flavorId("<flavor_id")
.keyPair("<keyname>")
.imageId("<image_id>")
.securityGroups("default")
.networks(
InstanceNetworkArgs.builder()
.name("<network1>")
.build(),
InstanceNetworkArgs.builder()
.name("<network2>")
.build(),
InstanceNetworkArgs.builder()
.name("<network1>")
.fixedIpV4("<fixed_ip_v4>")
.build())
.build());
}
}
resources:
boot-from-volume:
type: openstack:compute:Instance
properties:
name: boot-from-volume
flavorId: <flavor_id
keyPair: <keyname>
imageId: <image_id>
securityGroups:
- default
networks:
- name: <network1>
- name: <network2>
- name: <network1>
fixedIpV4: <fixed_ip_v4>
In the above configuration the networks are out of order compared to what nova and thus the import code returns, which means the plan will not be empty after import.
So either with care check the plan and modify configuration, or read the network order in the state file after import and modify your configuration accordingly.
- A note on ports. If you have created a neutron port independent of an instance, then the import code has no way to detect that the port is created idenpendently, and therefore on deletion of imported instances you might have port resources in your project, which you expected to be created by the instance and thus to also be deleted with the instance.
Importing instances with multiple block storage volumes.
We have an instance with two block storage volumes, one bootable and one
non-bootable.
Note that we only configure the bootable device as block_device.
The other volumes can be specified as openstack.blockstorage.Volume
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const instance2 = new openstack.compute.Instance("instance_2", {
name: "instance_2",
imageId: "<image_id>",
flavorId: "<flavor_id>",
keyPair: "<keyname>",
securityGroups: ["default"],
blockDevices: [{
uuid: "<image_id>",
sourceType: "image",
destinationType: "volume",
bootIndex: 0,
deleteOnTermination: true,
}],
networks: [{
name: "<network_name>",
}],
});
const volume1 = new openstack.blockstorage.Volume("volume_1", {
size: 1,
name: "<vol_name>",
});
const va1 = new openstack.compute.VolumeAttach("va_1", {
volumeId: volume1.id,
instanceId: instance2.id,
});
import pulumi
import pulumi_openstack as openstack
instance2 = openstack.compute.Instance("instance_2",
name="instance_2",
image_id="<image_id>",
flavor_id="<flavor_id>",
key_pair="<keyname>",
security_groups=["default"],
block_devices=[{
"uuid": "<image_id>",
"source_type": "image",
"destination_type": "volume",
"boot_index": 0,
"delete_on_termination": True,
}],
networks=[{
"name": "<network_name>",
}])
volume1 = openstack.blockstorage.Volume("volume_1",
size=1,
name="<vol_name>")
va1 = openstack.compute.VolumeAttach("va_1",
volume_id=volume1.id,
instance_id=instance2.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var instance2 = new OpenStack.Compute.Instance("instance_2", new()
{
Name = "instance_2",
ImageId = "<image_id>",
FlavorId = "<flavor_id>",
KeyPair = "<keyname>",
SecurityGroups = new[]
{
"default",
},
BlockDevices = new[]
{
new OpenStack.Compute.Inputs.InstanceBlockDeviceArgs
{
Uuid = "<image_id>",
SourceType = "image",
DestinationType = "volume",
BootIndex = 0,
DeleteOnTermination = true,
},
},
Networks = new[]
{
new OpenStack.Compute.Inputs.InstanceNetworkArgs
{
Name = "<network_name>",
},
},
});
var volume1 = new OpenStack.BlockStorage.Volume("volume_1", new()
{
Size = 1,
Name = "<vol_name>",
});
var va1 = new OpenStack.Compute.VolumeAttach("va_1", new()
{
VolumeId = volume1.Id,
InstanceId = instance2.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/blockstorage"
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
instance2, err := compute.NewInstance(ctx, "instance_2", &compute.InstanceArgs{
Name: pulumi.String("instance_2"),
ImageId: pulumi.String("<image_id>"),
FlavorId: pulumi.String("<flavor_id>"),
KeyPair: pulumi.String("<keyname>"),
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
BlockDevices: compute.InstanceBlockDeviceArray{
&compute.InstanceBlockDeviceArgs{
Uuid: pulumi.String("<image_id>"),
SourceType: pulumi.String("image"),
DestinationType: pulumi.String("volume"),
BootIndex: pulumi.Int(0),
DeleteOnTermination: pulumi.Bool(true),
},
},
Networks: compute.InstanceNetworkArray{
&compute.InstanceNetworkArgs{
Name: pulumi.String("<network_name>"),
},
},
})
if err != nil {
return err
}
volume1, err := blockstorage.NewVolume(ctx, "volume_1", &blockstorage.VolumeArgs{
Size: pulumi.Int(1),
Name: pulumi.String("<vol_name>"),
})
if err != nil {
return err
}
_, err = compute.NewVolumeAttach(ctx, "va_1", &compute.VolumeAttachArgs{
VolumeId: volume1.ID(),
InstanceId: instance2.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.inputs.InstanceBlockDeviceArgs;
import com.pulumi.openstack.compute.inputs.InstanceNetworkArgs;
import com.pulumi.openstack.blockstorage.Volume;
import com.pulumi.openstack.blockstorage.VolumeArgs;
import com.pulumi.openstack.compute.VolumeAttach;
import com.pulumi.openstack.compute.VolumeAttachArgs;
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 instance2 = new Instance("instance2", InstanceArgs.builder()
.name("instance_2")
.imageId("<image_id>")
.flavorId("<flavor_id>")
.keyPair("<keyname>")
.securityGroups("default")
.blockDevices(InstanceBlockDeviceArgs.builder()
.uuid("<image_id>")
.sourceType("image")
.destinationType("volume")
.bootIndex(0)
.deleteOnTermination(true)
.build())
.networks(InstanceNetworkArgs.builder()
.name("<network_name>")
.build())
.build());
var volume1 = new Volume("volume1", VolumeArgs.builder()
.size(1)
.name("<vol_name>")
.build());
var va1 = new VolumeAttach("va1", VolumeAttachArgs.builder()
.volumeId(volume1.id())
.instanceId(instance2.id())
.build());
}
}
resources:
instance2:
type: openstack:compute:Instance
name: instance_2
properties:
name: instance_2
imageId: <image_id>
flavorId: <flavor_id>
keyPair: <keyname>
securityGroups:
- default
blockDevices:
- uuid: <image_id>
sourceType: image
destinationType: volume
bootIndex: 0
deleteOnTermination: true
networks:
- name: <network_name>
volume1:
type: openstack:blockstorage:Volume
name: volume_1
properties:
size: 1
name: <vol_name>
va1:
type: openstack:compute:VolumeAttach
name: va_1
properties:
volumeId: ${volume1.id}
instanceId: ${instance2.id}
To import the instance outlined in the above configuration do the following:
terraform import openstack_compute_instance_v2.instance_2 instance_id
import openstack_blockstorage_volume_v3.volume_1 volume_id
terraform import openstack_compute_volume_attach_v2.va_1
instance_id/volume_id
- A note on block storage volumes, the importer does not read deleteOnTermination flag, and always assumes true. If you import an instance created with deleteOnTermination false, you end up with “orphaned” volumes after destruction of instances.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
openstackTerraform Provider.
published on Friday, Apr 10, 2026 by Pulumi
