Add more docs examples on using droplet snapshots (#846)

This commit is contained in:
Mikołaj Młodzikowski 2022-07-12 21:37:38 +02:00 committed by GitHub
parent c0291e061a
commit e3551e0399
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View File

@ -20,6 +20,24 @@ data "digitalocean_droplet_snapshot" "web-snapshot" {
}
```
Create image from snapshot:
```hcl
data "digitalocean_droplet_snapshot" "web-snapshot" {
name_regex = "^web"
region = "nyc3"
most_recent = true
}
resource "digitalocean_droplet" "from-snapshot" {
image = data.digitalocean_droplet_snapshot.web-snapshot.id
name = "web-02"
region = "nyc3"
size = "s-2vcpu-4gb"
}
```
## Argument Reference
* `name` - (Optional) The name of the Droplet snapshot.

View File

@ -24,7 +24,7 @@ resource "digitalocean_droplet" "web" {
The following arguments are supported:
* `image` - (Required) The Droplet image ID or slug.
* `image` - (Required) The Droplet image ID or slug. This could be either image ID or droplet snapshot ID.
* `name` - (Required) The Droplet name.
* `region` - (Required) The region to start in.
* `size` - (Required) The unique slug that indentifies the type of Droplet. You can find a list of available slugs on [DigitalOcean API documentation](https://docs.digitalocean.com/reference/api/api-reference/#tag/Sizes).

View File

@ -20,6 +20,14 @@ resource "digitalocean_droplet_snapshot" "web-snapshot" {
droplet_id = digitalocean_droplet.web.id
name = "web-snapshot-01"
}
resource "digitalocean_droplet" "from-snapshot" {
image = digitalocean_droplet_snapshot.web-snapshot.id
name = "web-02"
region = "nyc3"
size = "s-2vcpu-4gb"
}
```
## Argument Reference