Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs with nomenclature changes #12795

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions website/content/docs/datasources/hcp/hcp-packer-artifact.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
description: |
The HCP Packer Artifact Data Source retrieves information about an
artifact from the HCP Packer Registry. This information can be used to
provide a source artifact to various Packer builders.
page_title: HCP Packer Artifact - Data Sources
---

<BadgesHeader>
<PluginBadge type="official" />
<PluginBadge type="hcp_packer_ready" />
</BadgesHeader>

# HCP Packer Artifact Data Source

Type: `hcp-packer-artifact`

The `HCP Packer Artifact` Data Source retrieves information about an
artifact from the HCP Packer Registry. This information can be used to
provide a source artifact to various Packer builders.

To get started with HCP Packer, refer to the [HCP Packer documentation](/hcp/docs/packer) or try
the [Get Started with HCP Packer tutorials](/packer/tutorials/hcp-get-started).

~> **Note:** You will receive an error if you try to reference metadata from a deactivated or deleted registry.
An administrator can manually deactivate or delete a registry, and HCP Packer automatically deactivates registries
with billing issues. Contact [HashiCorp Support](https://support.hashicorp.com/) with questions.

## Revoked Versions

If an HCP Packer Version is revoked, the `hcp-packer-version` data source will fail and Packer won't proceed with
the build. Building new artifacts from a revoked artifact is not compliant.
Versions that are scheduled to be revoked will still be considered valid until the revocation date.

## Basic Example

Below is a fully functioning example. It stores information about an image artifact,
which can then be parsed and accessed as a variable.

```hcl
data "hcp-packer-artifact" "example" {
bucket_name = "hardened-ubuntu-16-04"
version_fingerprint = "${data.hcp-packer-version.hardened-source.fingerprint}"
platform = "aws"
region = "us-east-1"
}
```

## Full Example

This data source can be used in conjunction with the hcp-packer-version
data source to retrieve a version fingerprint using a channel. You provide the version fingerprint and channel
name to the version data source, then use the version source inside the
artifact data source, then use the artifact data source inside your source block.

```hcl
# Retrieves information about the HCP Packer Version; a "version" can be
# thought of as all the metadata created by a single call of `packer build`.
data "hcp-packer-version" "hardened-source" {
bucket_name = "hardened-ubuntu-16-04"
channel_name = "dev"
}

# Retrieves information about the HCP Packer Artifact; an artifact can be thought
# of as all the metadata (including the artifact names) created by a single
# "source" builder; this can include multiple artifacts so we provide a
# region to disambiguate.
data "hcp-packer-artifact" "example" {
bucket_name = "hardened-ubuntu-16-04"
version_fingerprint = data.hcp_packer_version.hardened-source.fingerprint
platform = "aws"
region = "us-east-1"
}

# This source uses the output from a previous Packer build. By using the
# HCP Packer Registry in this way, you can easily create build pipelines where
# a single base artifact can be customized in multiple secondary layers.
source "amazon-ebs" "packer-secondary" {
source_ami = data.hcp-packer-artifact.example.external_identifier
...
}
```

## 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/hcp-packer-artifact/Config-required.mdx'

### Optional:

~> **Note:** This data source only returns the first found artifact's metadata filtered by the given options,
from the returned list of artifacts associated with the specified version. Therefore, if multiple artifacts exist
in the same region, it will only pick one of them. In this case, you can filter artifact by a source build name
(Ex: `amazon-ebs.example`) using the `component_type` option.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 good call out here.


@include 'datasource/hcp-packer-artifact/Config-not-required.mdx'

### Output Fields:

@include 'datasource/hcp-packer-artifact/DatasourceOutput.mdx'
4 changes: 3 additions & 1 deletion website/content/docs/datasources/hcp/hcp-packer-image.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: |
This data source has been deprecated, please use HCP Packer Artifact data source instead.
The HCP Packer Image Data Source retrieves information about an
image from the HCP Packer registry. This information can be used to
provide a source image to various Packer builders.
Expand All @@ -8,11 +9,12 @@ page_title: HCP Packer Image - Data Sources

<BadgesHeader>
<PluginBadge type="official" />
<PluginBadge type="hcp_packer_ready" />
</BadgesHeader>

# HCP Packer Image Data Source

~> **Note:** This data source has been deprecated, please use [HCP Packer Artifact](/packer/docs/datasources/hcp/hcp-packer-artifact) data source instead.

Type: `hcp-packer-image`

The `HCP Packer Image` Data Source retrieves information about an
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: |
This data source has been deprecated, please use HCP Packer Version data source instead.
The HCP Packer Iteration Data Source retrieves information about an
iteration from the HCP Packer registry. This information can be used to
query HCP for a source image for various Packer builders.
Expand All @@ -8,11 +9,12 @@ page_title: HCP Packer Iteration - Data Sources

<BadgesHeader>
<PluginBadge type="official" />
<PluginBadge type="hcp_packer_ready" />
</BadgesHeader>

# HCP Packer Iteration Data Source

~> **Note:** This data source has been deprecated, please use [HCP Packer Version](/packer/docs/datasources/hcp/hcp-packer-version) data source instead.

Type: `hcp-packer-iteration`

The `HCP Packer Iteration` Data Source retrieves information about an
Expand Down
96 changes: 96 additions & 0 deletions website/content/docs/datasources/hcp/hcp-packer-version.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
description: |
The HCP Packer Version Data Source retrieves information about
HCP Packer Version from the HCP Packer Registry. This information can be used to
query HCP for a source external identifier for various Packer builders.
page_title: HCP Packer Version - Data Sources
---

<BadgesHeader>
<PluginBadge type="official" />
<PluginBadge type="hcp_packer_ready" />
</BadgesHeader>

# HCP Packer Version Data Source

Type: `hcp-packer-version`

The `HCP Packer Version` Data Source retrieves information about
HCP Packer Version from the HCP Packer Registry. This information can be used to
query HCP for a source external identifier for various Packer builders.

To get started with HCP Packer, refer to the [HCP Packer documentation](/hcp/docs/packer) or try the
[Get Started with HCP Packer tutorials](/packer/tutorials/hcp-get-started).

~> **Note:** You will receive an error if you try to reference metadata from a deactivated or deleted registry.
An administrator can manually deactivate or delete a registry, and HCP Packer automatically deactivates registries
with billing issues. Contact [HashiCorp Support](https://support.hashicorp.com/) with questions.

## Revoked Versions

If an HCP Packer Version is revoked, the `hcp-packer-version` data source will fail and Packer won't proceed with
the build. Building new artifacts from a revoked artifact is not compliant.
Versions that are scheduled to be revoked will still be considered valid until the revocation date.

## Basic Example

Below is a fully functioning example. It stores information about an HCP Packer Version, which can then be accessed as a variable.

```hcl
data "hcp-packer-version" "hardened-source" {
bucket_name = "hardened-ubuntu-16-04"
channel_name = "dev"
}
```

## Full Example

This data source can be used in conjunction with the `hcp-packer-artifact`
data source to retrieve an artifact identifier. You provide the version fingerprint and channel
name to the version data source, then use the version source inside the
artifact data source, then use the artifact data source inside your source block.

```hcl
# Retrieves information about the HCP Packer Version; a "version" can be
# thought of as all the metadata created by a single call of `packer build`.
data "hcp-packer-version" "hardened-source" {
bucket_name = "hardened-ubuntu-16-04"
channel_name = "dev"
}

# Retrieves information about the HCP Packer Artifact; an artifact can be thought
# of as all the metadata (including the artifact names) created by a single
# "source" builder; this can include multiple artifacts so we provide a
# region to disambiguate.
data "hcp-packer-artifact" "example" {
bucket_name = "hardened-ubuntu-16-04"
version_fingerprint = data.hcp_packer_version.hardened-source.fingerprint
platform = "aws"
region = "us-east-1"
}

# This source uses the output from a previous Packer build. By using the
# HCP Packer Registry in this way, you can easily create build pipelines where
# a single base artifact can be customized in multiple secondary layers.
source "amazon-ebs" "packer-secondary" {
source_ami = data.hcp-packer-artifact.example.external_identifier
...
}
```

## 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/hcp-packer-version/Config-required.mdx'

There are currently no optional fields for this datasource, though we intend
to add filtering fields in the future.

### Output Fields:

@include 'datasource/hcp-packer-version/DatasourceOutput.mdx'
28 changes: 17 additions & 11 deletions website/content/docs/datasources/hcp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,37 @@ sidebar_title: Overview

# HCP Packer Registry Data sources

The HCP Packer registry bridges the gap between image factories and image
The HCP Packer Registry bridges the gap between artifact factories and artifact
deployments, allowing development and security teams to work together to create,
manage, and consume images in a centralized way.

The HCP Packer registry stores metadata about your images, including when they
were created, where the image exists in the cloud, and what (if any) git commit
is associated with your image build. You can use the registry to track
information about the golden images your Packer builds produce, clearly
designate which images are appropriate for test and production environments,
and query for the right golden images to use in both Packer and Terraform
manage, and consume artifacts in a centralized way.

The HCP Packer Registry stores metadata about your artifacts, including when they
were created, where the artifacts exists in the cloud, and what (if any) git commit
is associated with your build. You can use the registry to track
information about the artifacts your Packer builds produce, clearly
designate which artifacts are appropriate for test and production environments,
and query for the right artifacts to use in both Packer and Terraform
configurations.

Packer has two data sources that work together to retrieve information from the
HCP Packer registry:

- [hcp-packer-version](/packer/docs/datasources/hcp/hcp-packer-version) -
retrieves information about an HCP Packer Version in HCP Packer Registry
- [hcp-packer-artifact](/packer/docs/datasources/hcp/hcp-packer-artifact) - retrieves
information about a specific artifact created in the HCP Packer registry

Deprecated data sources: (Please use above given data sources instead)
- [hcp-packer-iteration](/packer/docs/datasources/hcp/hcp-packer-iteration) -
retrieves information about an iteration in HCP Packer registry
- [hcp-packer-image](/packer/docs/datasources/hcp/hcp-packer-image) - retrieves
information about a specific image created in the HCP Packer registry

These data sources are intended to be used together to determine source images
These data sources are intended to be used together to determine source artifact
for pipelined Packer builds.

## How to use this plugin

This plugin comes bundled with the Packer core, so you do not need to install
it separately. Please install Packer v1.7.7 or above to use the latest version
of the HCP Packer registry datasources.
of the HCP Packer Registry data sources.
Loading