terraform/website/source/docs/enterprise/artifacts/artifact-provider.html.md

56 lines
2.0 KiB
Markdown
Raw Normal View History

2017-03-16 20:42:33 +01:00
---
2017-04-03 19:53:38 +02:00
layout: "enterprise"
2017-04-07 06:00:12 +02:00
page_title: "Provider - Artifacts - Terraform Enterprise"
2017-03-23 20:28:10 +01:00
sidebar_current: "docs-enterprise-artifacts-provider"
2017-03-17 22:34:04 +01:00
description: |-
2017-03-20 19:44:03 +01:00
Terraform has a provider for managing artifacts called `atlas_artifact`.
2017-03-16 20:42:33 +01:00
---
2017-03-17 22:34:04 +01:00
# Artifact Provider
2017-03-16 20:42:33 +01:00
2017-03-17 22:34:04 +01:00
Terraform has a [provider](https://terraform.io/docs/providers/index.html) for managing Terraform Enterprise artifacts called `atlas_artifact`.
2017-04-07 06:00:12 +02:00
This is used to make data stored in Artifacts available to Terraform for
interpolation. In the following example, an artifact is defined and references
an AMI ID stored in Terraform Enterprise.
2017-03-16 20:42:33 +01:00
2017-04-07 17:36:49 +02:00
~> **Why is this called "atlas"?** Atlas was previously a commercial offering
from HashiCorp that included a full suite of enterprise products. The products
have since been broken apart into their individual products, like **Terraform
Enterprise**. While this transition is in progress, you may see references to
"atlas" in the documentation. We apologize for the inconvenience.
2017-04-07 06:00:12 +02:00
```hcl
provider "atlas" {
# You can also set the atlas token by exporting ATLAS_TOKEN into your env
token = "${var.atlas_token}"
}
2017-03-16 20:42:33 +01:00
data "atlas_artifact" "web-worker" {
2017-04-07 06:00:12 +02:00
name = "my-username/web-worker"
type = "amazon.image"
version = "latest"
}
2017-03-16 20:42:33 +01:00
2017-04-07 06:00:12 +02:00
resource "aws_instance" "worker-machine" {
ami = "${atlas_artifact.web-worker.metadata_full.region-us-east-1}"
instance_type = "m1.small"
}
```
2017-03-16 20:42:33 +01:00
This automatically pulls the "latest" artifact version.
Following a new artifact version being created via a Packer build, the following
diff would be generated when running `terraform plan`.
2017-04-07 06:00:12 +02:00
```
-/+ aws_instance.worker-machine
ami: "ami-168f9d7e" => "ami-2f3a9df2" (forces new resource)
instance_type: "m1.small" => "m1.small"
```
2017-03-16 20:42:33 +01:00
2017-04-07 06:00:12 +02:00
This allows you to reference changing artifacts and trigger new deployments upon
pushing subsequent Packer builds.
2017-03-16 20:42:33 +01:00
2017-04-07 17:36:49 +02:00
Read more about artifacts in the [Terraform documentation](https://terraform.io/docs/providers/terraform-enterprise/r/artifact.html).