From bbb8d1fe6d3f3432782640b19a573f008762dfbd Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Fri, 7 Apr 2017 00:00:12 -0400 Subject: [PATCH] Update artifact docs --- .../artifacts/artifact-provider.html.md | 49 +++++++++-------- .../artifacts/creating-amis.html.md | 2 +- .../docs/enterprise/artifacts/index.html.md | 12 ++-- .../artifacts/managing-versions.html.md | 55 ++++++++++--------- 4 files changed, 63 insertions(+), 55 deletions(-) diff --git a/website/source/docs/enterprise/artifacts/artifact-provider.html.md b/website/source/docs/enterprise/artifacts/artifact-provider.html.md index c0045d4c1..a68a1e5c6 100755 --- a/website/source/docs/enterprise/artifacts/artifact-provider.html.md +++ b/website/source/docs/enterprise/artifacts/artifact-provider.html.md @@ -1,6 +1,6 @@ --- layout: "enterprise" -page_title: "Artifact Provider" +page_title: "Provider - Artifacts - Terraform Enterprise" sidebar_current: "docs-enterprise-artifacts-provider" description: |- Terraform has a provider for managing artifacts called `atlas_artifact`. @@ -10,37 +10,40 @@ description: |- 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 -Terraform for interpolation. In the following example, an artifact -is defined and references an AMI ID stored in Terraform Enterprise. +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. - provider "atlas" { - # You can also set the atlas token by exporting - # ATLAS_TOKEN into your env - token = "${var.atlas_token}" - } +```hcl +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 "atlas_artifact" "web-worker" { + name = "my-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" - } +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" +``` +-/+ 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. +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). diff --git a/website/source/docs/enterprise/artifacts/creating-amis.html.md b/website/source/docs/enterprise/artifacts/creating-amis.html.md index 4ed135467..1469c65a7 100755 --- a/website/source/docs/enterprise/artifacts/creating-amis.html.md +++ b/website/source/docs/enterprise/artifacts/creating-amis.html.md @@ -1,6 +1,6 @@ --- layout: "enterprise" -page_title: "Creating AMI Artifacts" +page_title: "Creating AMIs - Artifacts - Terraform Enterprise" sidebar_current: "docs-enterprise-artifacts-amis" description: |- Creating AMI Artifacts with Packer. diff --git a/website/source/docs/enterprise/artifacts/index.html.md b/website/source/docs/enterprise/artifacts/index.html.md index bd313a112..4655f1eb0 100755 --- a/website/source/docs/enterprise/artifacts/index.html.md +++ b/website/source/docs/enterprise/artifacts/index.html.md @@ -1,6 +1,6 @@ --- layout: "enterprise" -page_title: "Terraform Artifacts" +page_title: "Artifacts - Terraform Enterprise" sidebar_current: "docs-enterprise-artifacts" description: |- Terraform Enterprise can be used to store artifacts for use by Terraform. Typically, artifacts are stored with Packer. @@ -8,14 +8,14 @@ description: |- # About Terraform Artifacts -Terraform Enterprise can be used to store artifacts for use by Terraform. Typically, -artifacts are [stored with Packer](https://packer.io/docs). +Terraform Enterprise can be used to store artifacts for use by Terraform. +Typically, artifacts are [stored with Packer](https://packer.io/docs). Artifacts can be used in to deploy and manage images of configuration. Artifacts are generic, but can be of varying types like `amazon.image`. See the Packer [`artifact_type`](https://packer.io/docs/post-processors/atlas.html#artifact_type) docs for more information. -Packer can create artifacts both while running in and out of Terraform Enterprise -network. This is possible due to the post-processors use of the public -artifact API to store the artifacts. \ No newline at end of file +Packer can create artifacts both while running in and out of Terraform +Enterprise network. This is possible due to the post-processors use of the +public artifact API to store the artifacts. diff --git a/website/source/docs/enterprise/artifacts/managing-versions.html.md b/website/source/docs/enterprise/artifacts/managing-versions.html.md index 074e86f9f..04ad0fbd1 100755 --- a/website/source/docs/enterprise/artifacts/managing-versions.html.md +++ b/website/source/docs/enterprise/artifacts/managing-versions.html.md @@ -1,6 +1,6 @@ --- layout: "enterprise" -page_title: "Managing Artifact Versions" +page_title: "Managing Versions - Artifacts - Terraform Enterprise" sidebar_current: "docs-enterprise-artifacts-versions" description: |- Artifacts are versioned and assigned a version number, here is how to manage the versions. @@ -8,9 +8,9 @@ description: |- # Managing Artifact Versions -Artifacts stored in Terraform Enterprise are versioned and assigned a version number. -Versions are useful to roll back, audit and deploy images specific versions -of images to certain environments in a targeted way. +Artifacts stored in Terraform Enterprise are versioned and assigned a version +number. Versions are useful to roll back, audit and deploy images specific +versions of images to certain environments in a targeted way. This assumes you are familiar with the [artifact provider](https://terraform.io/docs/providers/atlas/index.html) in Terraform. @@ -24,14 +24,16 @@ be used to use the latest version of the artifact. The following output is from `terraform show`. - atlas_artifact.web-worker: - id = us-east-1:ami-3a0a1d52 - build = latest - metadata_full.# = 1 - metadata_full.region-us-east-1 = ami-3a0a1d52 - name = %{DEFAULT_USERNAME}/web-worker - slug = %{DEFAULT_USERNAME}/web-worker/amazon.image/7 - type = amazon.image +```text +atlas_artifact.web-worker: + id = us-east-1:ami-3a0a1d52 + build = latest + metadata_full.# = 1 + metadata_full.region-us-east-1 = ami-3a0a1d52 + name = my-username/web-worker + slug = my-username/web-worker/amazon.image/7 + type = amazon.image +``` In this case, the version is 7 and can be found in the persisted slug attribute. @@ -41,11 +43,13 @@ attribute. You can pin artifacts to a specific version. This allows for a targeted deploy. - resource "atlas_artifact" "web-worker" { - name = "%{DEFAULT_USERNAME}/web-worker" - type = "amazon.image" - version = 7 - } +```hcl +resource "atlas_artifact" "web-worker" { + name = "my-username/web-worker" + type = "amazon.image" + version = 7 +} +``` This will use version 7 of the `web-worker` artifact. @@ -54,12 +58,13 @@ This will use version 7 of the `web-worker` artifact. Artifacts can also be pinned to an Terraform build number. This is only possible if Terraform Enterprise was used to build the artifact with Packer. - resource "atlas_artifact" "web-worker" { - name = "%{DEFAULT_USERNAME}/web-worker" - type = "amazon.image" - build = 5 - } +```hcl +resource "atlas_artifact" "web-worker" { + name = "my-username/web-worker" + type = "amazon.image" + build = 5 +} +``` -It's recommended to use versions, instead of builds, as it will -be easier to track when building outside of the Terraform Enterprise -environment. +It's recommended to use versions, instead of builds, as it will be easier to +track when building outside of the Terraform Enterprise environment.