github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/website/source/docs/post-processors/atlas.html.md (about)

     1  ---
     2  description: |
     3      The Atlas post-processor for Packer receives an artifact from a Packer build
     4      and uploads it to Atlas. Atlas hosts and serves artifacts, allowing you to
     5      version and distribute them in a simple way.
     6  layout: docs
     7  page_title: 'Atlas - Post-Processor'
     8  sidebar_current: 'docs-post-processors-atlas'
     9  ---
    10  
    11  # Atlas Post-Processor
    12  
    13  !> The Packer and Artifact Registry features of Atlas will no longer be
    14  actively developed or maintained and will be fully decommissioned.
    15  Please see our [guide on building immutable infrastructure with
    16  Packer on CI/CD](/guides/packer-on-cicd/) for ideas on implementing these
    17  features yourself.
    18  
    19  Type: `atlas`
    20  
    21  The Atlas post-processor uploads artifacts from your packer builds to Atlas for
    22  hosting. Artifacts hosted in Atlas are automatically made available for use
    23  with Terraform, and Atlas provides additional features for managing
    24  versions and releases. [Learn more about packer in
    25  Atlas.](https://atlas.hashicorp.com/help/packer/features)
    26  
    27  You can also use the push command to [run packer builds in
    28  Atlas](/docs/commands/push.html). The push command and Atlas post-processor
    29  can be used together or independently.
    30  
    31  ~> If you'd like to publish a Vagrant box to [Vagrant Cloud](https://vagrantcloud.com), you must use the [`vagrant-cloud`](/docs/post-processors/vagrant-cloud.html) post-processor.
    32  
    33  ## Workflow
    34  
    35  To take full advantage of Packer and Atlas, it's important to understand the
    36  workflow for creating artifacts with Packer and storing them in Atlas using this
    37  post-processor. The goal of the Atlas post-processor is to streamline the
    38  distribution of public or private artifacts by hosting them in a central
    39  location in Atlas.
    40  
    41  Here is an example workflow:
    42  
    43  1.  Packer builds an AMI with the [Amazon AMI
    44      builder](/docs/builders/amazon.html)
    45  2.  The `atlas` post-processor takes the resulting AMI and uploads it to Atlas.
    46      The `atlas` post-processor is configured with the name of the AMI, for
    47      example `hashicorp/foobar`, to create the artifact in Atlas or update the
    48      version if the artifact already exists
    49  3.  The new version is ready and available to be used in deployments with a
    50      tool like [Terraform](https://www.terraform.io)
    51  
    52  ## Configuration
    53  
    54  The configuration allows you to specify and access the artifact in Atlas.
    55  
    56  ### Required:
    57  
    58  -   `artifact` (string) - The shorthand tag for your artifact that maps to
    59      Atlas, i.e `hashicorp/foobar` for `atlas.hashicorp.com/hashicorp/foobar`.
    60      You must have access to the organization—hashicorp in this example—in order
    61      to add an artifact to the organization in Atlas.
    62  
    63  -   `artifact_type` (string) - For uploading artifacts to Atlas.
    64      `artifact_type` can be set to any unique identifier, however, the following
    65      are recommended for consistency - `amazon.image`, `azure.image`,
    66      `cloudstack.image`, `digitalocean.image`, `docker.image`,
    67      `googlecompute.image`, `hyperv.image`, `oneandone.image`,
    68      `openstack.image`, `parallels.image`, `profitbricks.image`, `qemu.image`,
    69      `triton.image`, `virtualbox.image`, `vmware.image`, and `custom.image`.
    70  
    71  ### Optional:
    72  
    73  -   `token` (string) - Your access token for the Atlas API.
    74  
    75  -> Login to Atlas to [generate an Atlas
    76  Token](https://atlas.hashicorp.com/settings/tokens). The most convenient way to
    77  configure your token is to set it to the `ATLAS_TOKEN` environment variable, but
    78  you can also use `token` configuration option.
    79  
    80  -   `atlas_url` (string) - Override the base URL for Atlas. This is useful if
    81      you're using Atlas Enterprise in your own network. Defaults to
    82      `https://atlas.hashicorp.com/api/v1`.
    83  
    84  -   `metadata` (map) - Send metadata about the artifact.
    85  
    86      -   `description` (string) - Inside the metadata blob you can add a information
    87          about the uploaded artifact to Atlas. This will be reflected in the box
    88          description on Atlas.
    89  
    90      -   `provider` (string) - Used by Atlas to help determine, what should be used
    91          to run the artifact.
    92  
    93      -   `version` (string) - Used by Atlas to give a semantic version to the
    94          uploaded artifact.
    95  
    96  ## Environment Variables
    97  
    98  -   `ATLAS_CAFILE` (path) - This should be a path to an X.509 PEM-encoded public key. If specified, this will be used to validate the certificate authority that signed certificates used by an Atlas installation.
    99  
   100  -   `ATLAS_CAPATH` - This should be a path which contains an X.509 PEM-encoded public key file. If specified, this will be used to validate the certificate authority that signed certificates used by an Atlas installation.
   101  
   102  ### Example Configuration
   103  
   104  ``` json
   105  {
   106    "variables": {
   107      "aws_access_key": "ACCESS_KEY_HERE",
   108      "aws_secret_key": "SECRET_KEY_HERE",
   109      "atlas_token": "ATLAS_TOKEN_HERE"
   110    },
   111    "builders": [
   112      {
   113        "type": "amazon-ebs",
   114        "access_key": "{{user `aws_access_key`}}",
   115        "secret_key": "{{user `aws_secret_key`}}",
   116        "region": "us-east-1",
   117        "source_ami": "ami-fce3c696",
   118        "instance_type": "t2.micro",
   119        "ssh_username": "ubuntu",
   120        "ami_name": "atlas-example {{timestamp}}"
   121      }
   122    ],
   123    "provisioners": [
   124      {
   125        "type": "shell",
   126        "inline": [
   127          "sleep 30",
   128          "sudo apt-get update",
   129          "sudo apt-get install apache2 -y"
   130        ]
   131      }
   132    ],
   133    "post-processors": [
   134      {
   135        "type": "atlas",
   136        "token": "{{user `atlas_token`}}",
   137        "artifact": "hashicorp/foobar",
   138        "artifact_type": "amazon.image",
   139        "metadata": {
   140          "created_at": "{{timestamp}}"
   141        }
   142      }
   143    ]
   144  }
   145  ```
   146  
   147  More information on the correct configuration of the `amazon-ebs` builder in this example can be found in the [amazon-ebs builder documentation](/docs/builders/amazon-ebs.html).