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

47 lines
1.6 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-03-17 22:34:04 +01:00
page_title: "Artifact Provider"
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`.
This is used to make data stored in Artifacts available to
2017-03-16 20:42:33 +01:00
Terraform for interpolation. In the following example, an artifact
2017-03-17 22:34:04 +01:00
is defined and references an AMI ID stored in Terraform Enterprise.
2017-03-16 20:42:33 +01:00
provider "atlas" {
# You can also set the atlas token by exporting
# ATLAS_TOKEN into your env
token = "${var.atlas_token}"
}
resource "atlas_artifact" "web-worker" {
name = "%{DEFAULT_USERNAME}/web-worker"
type = "amazon.image"
version = "latest"
}
resource "aws_instance" "worker-machine" {
ami = "${atlas_artifact.web-worker.metadata_full.region-us-east-1}"
instance_type = "m1.small"
}
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`.
-/+ aws_instance.worker-machine
ami: "ami-168f9d7e" => "ami-2f3a9df2" (forces new resource)
instance_type: "m1.small" => "m1.small"
This allows you to reference changing artifacts and trigger new deployments
upon pushing subsequent Packer builds.
Read more about artifacts in the [Terraform documentation](https://terraform.io/docs/providers/atlas/r/artifact.html).