Skip to content

Commit

Permalink
docs: Add additional detail to the data source example.
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsomething committed Sep 19, 2024
1 parent 63d0729 commit fd00f12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datasource/image/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func filterImages(c *Config, images []godo.Image) (godo.Image, error) {
return godo.Image{}, fmt.Errorf("More than one matching image found: %v", result)
}
if len(result) == 0 {
return godo.Image{}, errors.New("No image matching found")
return godo.Image{}, errors.New("No matching image found")
}

return result[0], nil
Expand Down
9 changes: 7 additions & 2 deletions docs/datasources/digitalocean-image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ for use as a builder source.

## Example Usage

In this example, we combine `name_regex` and `latest` to find the most recent
user generated image matching the name `golden-image-.*`. The ID of the found
image is then passed to the builder where it is used as the base for creating
a new image.

```hcl
data "digitalocean-image" "example" {
name_regex = "golden-image-2022.*"
name_regex = "golden-image-.*"
region = "nyc3"
type = "user"
latest = true
Expand All @@ -39,7 +44,7 @@ locals {
}
source "digitalocean" "example" {
snapshot_name = "updated-golden-image"
snapshot_name = "golden-image-{{isotime}}"
image = local.image_id
region = "nyc3"
size = "s-1vcpu-1gb"
Expand Down

0 comments on commit fd00f12

Please sign in to comment.