Skip to content

Commit

Permalink
add doc for data source
Browse files Browse the repository at this point in the history
Signed-off-by: outscale_hmi <[email protected]>
  • Loading branch information
outscale-hmi committed Mar 31, 2023
1 parent 8720d5c commit 056e027
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
10 changes: 5 additions & 5 deletions datasource/omi/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ func (d *Datasource) Configure(raws ...interface{}) error {
}

type DatasourceOutput struct {
// The ID of the AMI.
// The ID of the OMI.
ID string `mapstructure:"id"`
// The name of the AMI.
// The name of the OMI.
Name string `mapstructure:"name"`
// The date of creation of the AMI.
// The date of creation of the OMI.
CreationDate string `mapstructure:"creation_date"`
// The AWS account ID of the owner.
// The Outscale account Id of the owner.
Owner string `mapstructure:"owner"`
// The owner alias.
OwnerName string `mapstructure:"owner_name"`
// The key/value combination of the tags assigned to the AMI.
// The key/value combination of the tags assigned to the OMI.
Tags map[string]string `mapstructure:"tags"`
}

Expand Down
15 changes: 15 additions & 0 deletions docs-partials/datasource/omi/DatasourceOutput.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Code generated from the comments of the DatasourceOutput struct in datasource/omi/data.go; DO NOT EDIT MANUALLY -->

- `id` (string) - The ID of the OMI.

- `name` (string) - The name of the OMI.

- `creation_date` (string) - The date of creation of the OMI.

- `owner` (string) - The Outscale account Id of the owner.

- `owner_name` (string) - The owner alias.

- `tags` (map[string]string) - The key/value combination of the tags assigned to the OMI.

<!-- End of code generated from the comments of the DatasourceOutput struct in datasource/omi/data.go; -->
33 changes: 33 additions & 0 deletions docs/datasources/omi.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
description: |
The Outscale OMI data source provides information from an OMI that will be fetched based
on the filter options provided in the configuration.

page_title: Outscale OMI - Data Source
nav_title: Outscale OMI
---

# Outscale OMI Data Source

Type: `outscale-omi`

The Outscale OMI Data source will filter and fetch an Outscale OMI, and output all the OMI information that will
be then available to use in the [Outscale builders](https://developer.hashicorp.com/packer/plugins/builders/outscale).

-> **Note:** Data sources is a feature exclusively available to HCL2 templates.

Basic example of usage:

```hcl
data "outscale-omi" "basic-example" {
filters = {
virtualization-type = "hvm"
name = "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*"
root-device-type = "ebs"
}
owners = ["099720109477"]
most_recent = true
}
```
This selects the most recent Ubuntu 16.04 HVM EBS OMI from Canonical. Note that the data source will fail unless
*exactly* one OMI is returned. In the above example, `most_recent` will cause this to succeed by selecting the newest image.

0 comments on commit 056e027

Please sign in to comment.