Skip to content

Commit 4dc1425

Browse files
authored
Merge pull request #112 from maveonair/source-instance
Use another instance as the source for a new instance
2 parents 3d7b157 + e2dec1a commit 4dc1425

File tree

3 files changed

+534
-114
lines changed

3 files changed

+534
-114
lines changed

docs/resources/instance.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,35 @@ resource "incus_instance" "instance2" {
7272
}
7373
```
7474

75+
## Example to create a new instance from an existing instance
76+
77+
```hcl
78+
resource "incus_instance" "instance1" {
79+
project = "default"
80+
name = "instance1"
81+
image = "images:debian/12"
82+
}
83+
84+
resource "incus_instance" "instance2" {
85+
project = "default"
86+
name = "instance2"
87+
88+
source_instance = {
89+
project = "default"
90+
name = "instance1"
91+
}
92+
}
93+
```
94+
7595
## Argument Reference
7696

7797
* `name` - **Required** - Name of the instance.
7898

79-
* `image` - **Required** - Base image from which the instance will be created. Must
99+
* `image` - *Optional* - Base image from which the instance will be created. Must
80100
specify [an image accessible from the provider remote](https://linuxcontainers.org/incus/docs/main/reference/remote_image_servers/).
81101

102+
* `source_instance` - *Optional* - The source instance from which the instance will be created. See reference below.
103+
82104
* `description` - *Optional* - Description of the instance.
83105

84106
* `type` - *Optional* - Instance type. Can be `container`, or `virtual-machine`. Defaults to `container`.
@@ -111,6 +133,14 @@ resource "incus_instance" "instance2" {
111133

112134
* `target` - *Optional* - Specify a target node in a cluster.
113135

136+
The `source_instance` block supports:
137+
138+
* `project` - **Required** - Name of the project in which the source instance exists.
139+
140+
* `name` - **Required** - Name of the source instance.
141+
142+
* `snapshot`- *Optiona** - Name of the snapshot of the source instance
143+
114144
The `device` block supports:
115145

116146
* `name` - **Required** - Name of the device.

0 commit comments

Comments
 (0)