github.com/hashicorp/packer@v1.14.3/website/content/docs/datasources/hcp/hcp-packer-iteration.mdx (about)

     1  ---
     2  description: |
     3    The `hcp-packer-iteration` data source retrieves information about an iteration from the HCP Packer registry. This data source is deprecated. Use the `hcpe-packer-verion` data source instead.
     4  page_title: hcp-packer-iteration data source reference
     5  ---
     6  
     7  <BadgesHeader>
     8    <PluginBadge type="official" />
     9  </BadgesHeader>
    10  
    11  # `hcp-packer-iteration`
    12  
    13  ~> **This data source is deprecated**. Use the [`hcp-packer-version`](/packer/docs/datasources/hcp/hcp-packer-version) data source instead.
    14  
    15  The `HCP Packer Iteration` Data Source retrieves information about an
    16  iteration from the HCP Packer registry. This information can be used to query
    17  HCP for a source image for various Packer builders.
    18  
    19  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).
    20  
    21  ~> **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.
    22  
    23  ## Revoked Iterations
    24  
    25  If an iteration is revoked, the `hcp-packer-iteration` data source will fail and Packer won't proceed with the build. Building new images from a revoked image is not compliant.
    26  Iterations that are scheduled to be revoked will still be considered valid until the revocation date.
    27  
    28  ## Basic Example
    29  
    30  Below is a fully functioning example. It stores information about an image
    31  iteration, which can then be accessed as a variable.
    32  
    33  ```hcl
    34  data "hcp-packer-iteration" "hardened-source" {
    35    bucket_name = "hardened-ubuntu-16-04"
    36    channel = "packer-test"
    37  }
    38  ```
    39  
    40  ## Full Example
    41  
    42  This data source can be used in conjunction with the hcp-packer-image
    43  data source to retrieve an image ID using a channel. You provide the channel
    44  name to the iteration data source, then use the iteration source inside the
    45  image data source, then use the image data source inside your source block.
    46  
    47  ```hcl
    48  # Retrieves information about the HCP Packer "iteration"; an "iteration" can be
    49  # thought of as all the metadata created by a single call of `packer build`.
    50  data "hcp-packer-iteration" "hardened-source" {
    51    bucket_name = "hardened-ubuntu-16-04"
    52    channel = "packer-test"
    53  }
    54  
    55  # Retrieves information about the HCP Packer "image"; an image can be thought
    56  # of as all the metadata (including the artifact names) created by a single
    57  # "source" builder; this can include multiple images so we provide a cloud
    58  # region to disambiguate.
    59  data "hcp-packer-image" "foo" {
    60    bucket_name = "hardened-ubuntu-16-04"
    61    iteration_id = data.hcp-packer-iteration.hardened-source.id
    62    cloud_provider = "aws"
    63    region = "us-east-1"
    64  }
    65  
    66  # This source uses the output from a previous Packer build. By using the
    67  # HCP Packer registry in this way, you can easily create build pipelines where
    68  # a single base image can be customized in multiple secondary layers.
    69  source "amazon-ebs" "packer-secondary" {
    70    source_ami       = data.hcp-packer-image.foo.id
    71    ...
    72  }
    73  ```
    74  
    75  ## Configuration Reference
    76  
    77  Configuration options are organized below into two categories: required and
    78  optional. Within each category, the available options are alphabetized and
    79  described.
    80  
    81  ### Required:
    82  
    83  @include 'datasource/hcp-packer-iteration/Config-required.mdx'
    84  
    85  There are currently no optional fields for this datasource, though we intend
    86  to add filtering fields in the future.
    87  
    88  ### Output Fields:
    89  
    90  @include 'datasource/hcp-packer-iteration/DatasourceOutput.mdx'