diff --git a/datasource/packer-image-iteration/data.go b/datasource/packer-image-iteration/data.go index c53065871..a698a060d 100644 --- a/datasource/packer-image-iteration/data.go +++ b/datasource/packer-image-iteration/data.go @@ -25,9 +25,9 @@ type Datasource struct { type Config struct { common.PackerConfig `mapstructure:",squash"` // The name of the bucket your image is in. - Bucket string `mapstructure:"bucket_name"` + Bucket string `mapstructure:"bucket_name" required:"true"` // The name of the channel to use when retrieving your image - Channel string `mapstructure:"channel"` + Channel string `mapstructure:"channel" required:"true"` // TODO: Version string `mapstructure:"version"` // TODO: Label string `mapstructure:"label"` } diff --git a/datasource/packer-image-iteration/data.hcl2spec.go b/datasource/packer-image-iteration/data.hcl2spec.go index 064c18a03..9da8a7efb 100644 --- a/datasource/packer-image-iteration/data.hcl2spec.go +++ b/datasource/packer-image-iteration/data.hcl2spec.go @@ -18,8 +18,8 @@ type FlatConfig struct { PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` - Bucket *string `mapstructure:"bucket_name" cty:"bucket_name" hcl:"bucket_name"` - Channel *string `mapstructure:"channel" cty:"channel" hcl:"channel"` + Bucket *string `mapstructure:"bucket_name" required:"true" cty:"bucket_name" hcl:"bucket_name"` + Channel *string `mapstructure:"channel" required:"true" cty:"channel" hcl:"channel"` } // FlatMapstructure returns a new FlatConfig. diff --git a/website/content/docs/datasources/packer-image-iteration.mdx b/website/content/docs/datasources/packer-image-iteration.mdx new file mode 100644 index 000000000..7e7edbdda --- /dev/null +++ b/website/content/docs/datasources/packer-image-iteration.mdx @@ -0,0 +1,43 @@ +--- +description: | + The Packer Image Iteration Data Source retrieves information about an + iteration from the HCP Packer registry. This information can be parsed to + provide a source image to various Packer builders. +page_title: Packer Image Iteration - Data Sources +--- + +# Packer Image Iteration Data Source + +Type: `packer-image-iteration` + +The `Packer Image Iteration` Data Source retrieves information about an +iteration from the HCP Packer registry. This information can be parsed to +provide a source image to various Packer builders. + +Please note: The HCP Packer registry is in development, and is not yet available +for public use. For more information about HCP Packer, see https://www.hashicorp.com/blog/announcing-hcp-packer + +## Basic Example + +Below is a fully functioning example. It stores information about an image +iteration, which can then be parsed and accessed using HCL tools. + +```hcl +data "packer-image-iteration" "hardened-source" { + bucket = "hardened-ubuntu-16-04" + channel = "production-stable" +} +``` + +## Configuration Reference + +Configuration options are organized below into two categories: required and +optional. Within each category, the available options are alphabetized and +described. + +### Required: + +@include 'datasource/packer-image-iteration/RunConfig-required.mdx' + +There are currently no optional fields for this datasource, though we intend +to add filtering fields in the future. \ No newline at end of file diff --git a/website/content/partials/datasource/packer-artifact-registry/DatasourceOutput.mdx b/website/content/partials/datasource/packer-artifact-registry/DatasourceOutput.mdx deleted file mode 100644 index d98178434..000000000 --- a/website/content/partials/datasource/packer-artifact-registry/DatasourceOutput.mdx +++ /dev/null @@ -1,11 +0,0 @@ - - -- `Id` (string) - Id - -- `incremental_version` (int32) - Incremental Version - -- `created_at` (string) - Created At - -- `builds` (map[string]interface{}) - Builds - - diff --git a/website/content/partials/datasource/packer-artifact-registry/Config-not-required.mdx b/website/content/partials/datasource/packer-image-iteration/Config-required.mdx similarity index 69% rename from website/content/partials/datasource/packer-artifact-registry/Config-not-required.mdx rename to website/content/partials/datasource/packer-image-iteration/Config-required.mdx index 989d06be6..55ebde6eb 100644 --- a/website/content/partials/datasource/packer-artifact-registry/Config-not-required.mdx +++ b/website/content/partials/datasource/packer-image-iteration/Config-required.mdx @@ -1,7 +1,7 @@ - + - `bucket_name` (string) - The name of the bucket your image is in. - `channel` (string) - The name of the channel to use when retrieving your image - +