Update FAQ and Glossary

This commit is contained in:
Seth Vargo 2017-04-07 00:00:26 -04:00
parent bbb8d1fe6d
commit 85900595bc
No known key found for this signature in database
GPG Key ID: C921994F9C27E0FF
4 changed files with 310 additions and 290 deletions

View File

@ -1,6 +1,6 @@
---
layout: "enterprise"
page_title: "Terraform Enterprise FAQs"
page_title: "FAQ - Terraform Enterprise"
sidebar_current: "docs-enterprise-faq"
description: |-
Frequently Asked Questions.

View File

@ -1,6 +1,6 @@
---
layout: "enterprise"
page_title: "FAQ: Monolithic Artifacts"
page_title: "Monolithic Artifacts - FAQ - Terraform Enterprise"
sidebar_current: "docs-enterprise-faq-monolithic"
description: |-
How do I build multiple applications into one artifact?
@ -10,140 +10,150 @@ description: |-
*How do I build multiple applications into one artifact?*
Create your new Applications in Terraform Enterprise using the application compilation feature.
Create your new Applications in Terraform Enterprise using the application
compilation feature.
You can either link each Application to the single Build Template you will be using to create the monolithic artifact, or run periodic Packer builds.
You can either link each Application to the single Build Template you will be
using to create the monolithic artifact, or run periodic Packer builds.
Each time an Application is pushed, it will store the new application version in the artifact registry as a tarball. These will be available for you to download at build-time on the machines they belong.
Each time an Application is pushed, it will store the new application version in
the artifact registry as a tarball. These will be available for you to download
at build-time on the machines they belong.
Here's an example `compile.json` template that you will include with the rest of your application files that do the compiling:
Here's an example `compile.json` template that you will include with the rest of
your application files that do the compiling:
```json
{
"variables": {
"app_slug": "{{ env `ATLAS_APPLICATION_SLUG` }}"
},
"builders": [
{
"variables": {
"app_slug": "{{ env `ATLAS_APPLICATION_SLUG` }}"
},
"builders": [
{
"type": "docker",
"image": "ubuntu:14.04",
"commit": true
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"apt-get -y update"
]
},
{
"type": "file",
"source": ".",
"destination": "/tmp/app"
},
{
"type": "shell",
"inline": [
"cd /tmp/app",
"make"
]
},
{
"type": "file",
"source": "/tmp/compiled-app.tar.gz",
"destination": "compiled-app.tar.gz",
"direction": "download"
}
],
"post-processors": [
[
{
"type": "artifice",
"files": ["compiled-app.tar.gz"]
},
{
"type": "atlas",
"artifact": "{{user `app_slug` }}",
"artifact_type": "archive"
}
]
]
"type": "docker",
"image": "ubuntu:14.04",
"commit": true
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"apt-get -y update"
]
},
{
"type": "file",
"source": ".",
"destination": "/tmp/app"
},
{
"type": "shell",
"inline": [
"cd /tmp/app",
"make"
]
},
{
"type": "file",
"source": "/tmp/compiled-app.tar.gz",
"destination": "compiled-app.tar.gz",
"direction": "download"
}
],
"post-processors": [
[
{
"type": "artifice",
"files": ["compiled-app.tar.gz"]
},
{
"type": "atlas",
"artifact": "{{user `app_slug` }}",
"artifact_type": "archive"
}
]
]
}
```
In your Packer template, you can download each of the latest applications
artifacts onto the host using the shell provisioner:
In your Packer template, you can download each of the latest applications artifacts onto the host using the shell provisioner:
```curl -L -H "X-Atlas-Token: ${ATLAS_TOKEN}" https://atlas.hashicorp.com/api/v1/artifacts/hashicorp/example/archive/latest/file -o example.tar.gz```
```text
$ curl -L -H "X-Atlas-Token: ${ATLAS_TOKEN}" https://atlas.hashicorp.com/api/v1/artifacts/hashicorp/example/archive/latest/file -o example.tar.gz
```
Here's an example Packer template:
```json
{
"variables": {
"atlas_username": "{{env `ATLAS_USERNAME`}}",
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_region": "{{env `AWS_DEFAULT_REGION`}}",
"instance_type": "c3.large",
"source_ami": "ami-9a562df2",
"name": "example",
"ssh_username": "ubuntu",
"app_dir": "/app"
},
"push": {
"name": "{{user `atlas_username`}}/{{user `name`}}",
"vcs": false
},
"builders": [
{
"variables": {
"atlas_username": "{{env `ATLAS_USERNAME`}}",
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_region": "{{env `AWS_DEFAULT_REGION`}}",
"instance_type": "c3.large",
"source_ami": "ami-9a562df2",
"name": "example",
"ssh_username": "ubuntu",
"app_dir": "/app"
},
"push": {
"name": "{{user `atlas_username`}}/{{user `name`}}",
"vcs": false
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `aws_region`}}",
"vpc_id": "",
"subnet_id": "",
"instance_type": "{{user `instance_type`}}",
"source_ami": "{{user `source_ami`}}",
"ami_regions": [],
"ami_name": "{{user `name`}} {{timestamp}}",
"ami_description": "{{user `name`}} AMI",
"run_tags": { "ami-create": "{{user `name`}}" },
"tags": { "ami": "{{user `name`}}" },
"ssh_username": "{{user `ssh_username`}}",
"ssh_timeout": "10m",
"ssh_private_ip": false,
"associate_public_ip_address": true
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo {{user `ssh_username`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"apt-get -y update",
"apt-get -y upgrade",
"apt-get -y install curl unzip tar",
"mkdir -p {{user `app_dir`}}",
"chmod a+w {{user `app_dir`}}",
"cd /tmp",
"curl -L -H "X-Atlas-Token: ${ATLAS_TOKEN}" https://atlas.hashicorp.com/api/v1/artifacts/{{user `atlas_username`}}/{{user `name`}}/archive/latest/file -o example.tar.gz",
"tar -xzf example.tar.gz -C {{user `app_dir`}}"
]
}
],
"post-processors": [
{
"type": "atlas",
"artifact": "{{user `atlas_username`}}/{{user `name`}}",
"artifact_type": "amazon.image",
"metadata": {
"created_at": "{{timestamp}}"
}
}
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "{{user `aws_region`}}",
"vpc_id": "",
"subnet_id": "",
"instance_type": "{{user `instance_type`}}",
"source_ami": "{{user `source_ami`}}",
"ami_regions": [],
"ami_name": "{{user `name`}} {{timestamp}}",
"ami_description": "{{user `name`}} AMI",
"run_tags": { "ami-create": "{{user `name`}}" },
"tags": { "ami": "{{user `name`}}" },
"ssh_username": "{{user `ssh_username`}}",
"ssh_timeout": "10m",
"ssh_private_ip": false,
"associate_public_ip_address": true
}
],
"provisioners": [
{
"type": "shell",
"execute_command": "echo {{user `ssh_username`}} | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"inline": [
"apt-get -y update",
"apt-get -y upgrade",
"apt-get -y install curl unzip tar",
"mkdir -p {{user `app_dir`}}",
"chmod a+w {{user `app_dir`}}",
"cd /tmp",
"curl -L -H 'X-Atlas-Token: ${ATLAS_TOKEN}' https://atlas.hashicorp.com/api/v1/artifacts/{{user `atlas_username`}}/{{user `name`}}/archive/latest/file -o example.tar.gz",
"tar -xzf example.tar.gz -C {{user `app_dir`}}"
]
}
],
"post-processors": [
{
"type": "atlas",
"artifact": "{{user `atlas_username`}}/{{user `name`}}",
"artifact_type": "amazon.image",
"metadata": {
"created_at": "{{timestamp}}"
}
}
]
}
```
Once downloaded, you can place each application slug where it needs to go to produce the monolithic artifact your are accustom to.
Once downloaded, you can place each application slug where it needs to go to
produce the monolithic artifact your are accustom to.

View File

@ -1,6 +1,6 @@
---
layout: "enterprise"
page_title: "FAQ: Rolling Deployments"
page_title: "Rolling Deployments - FAQ - Terraform Enterprise"
sidebar_current: "docs-enterprise-faq-deployments"
description: |-
How do I configure rolling deployments in Terraform Enterprise?
@ -10,71 +10,85 @@ description: |-
*How do I configure rolling deployments?*
User are able to quickly change out an Artifact version that is being utilized by Terraform, using variables within Terraform Enterprise. This is
particularly useful when testing specific versions of the given artifact without performing a full rollout. This configuration also allows one
to deploy any version of an artifact with ease, simply by changing a version variable in Terraform and re-deploying.
User are able to quickly change out an Artifact version that is being utilized
by Terraform, using variables within Terraform Enterprise. This is particularly
useful when testing specific versions of the given artifact without performing a
full rollout. This configuration also allows one to deploy any version of an
artifact with ease, simply by changing a version variable in Terraform and
re-deploying.
Here is an example:
variable "type" { default = "amazon.image" }
variable "region" { }
variable "atlas_username" { }
variable "pinned_name" { }
variable "pinned_version" { default = "latest" }
```hcl
variable "type" { default = "amazon.image" }
variable "region" {}
variable "atlas_username" {}
variable "pinned_name" {}
variable "pinned_version" { default = "latest" }
resource "atlas_artifact" "pinned" {
name = "${var.atlas_username}/${var.pinned_name}"
type = "${var.type}"
version = "${var.pinned_version}"
resource "atlas_artifact" "pinned" {
name = "${var.atlas_username}/${var.pinned_name}"
type = "${var.type}"
version = "${var.pinned_version}"
lifecycle { create_before_destroy = true }
lifecycle { create_before_destroy = true }
metadata {
region = "${var.region}"
}
}
metadata {
region = "${var.region}"
}
}
output "pinned" { value = "${atlas_artifact.pinned.metadata_full.ami_id}" }
output "pinned" { value = "${atlas_artifact.pinned.metadata_full.ami_id}" }
```
In the above example we have an `atlas_artifact` resource where you pass in the version number via the variable `pinned_version`. (_note: this variable defaults to latest_).
If you ever want to deploy any other version, you just update the variable `pinned_version` and redeploy.
In the above example we have an `atlas_artifact` resource where you pass in the
version number via the variable `pinned_version`. (_note: this variable defaults
to latest_). If you ever want to deploy any other version, you just update the
variable `pinned_version` and redeploy.
Below is similar to the first example, but it is in the form of a module that handles the creation of artifacts:
Below is similar to the first example, but it is in the form of a module that
handles the creation of artifacts:
variable "type" { default = "amazon.image" }
variable "region" { }
variable "atlas_username" { }
variable "artifact_name" { }
variable "artifact_version" { default = "latest" }
```hcl
variable "type" { default = "amazon.image" }
variable "region" {}
variable "atlas_username" {}
variable "artifact_name" {}
variable "artifact_version" { default = "latest" }
resource "atlas_artifact" "artifact" {
name = "${var.atlas_username}/${var.artifact_name}"
type = "${var.type}"
count = "${length(split(",", var.artifact_version))}"
version = "${element(split(",", var.artifact_version), count.index)}"
resource "atlas_artifact" "artifact" {
name = "${var.atlas_username}/${var.artifact_name}"
type = "${var.type}"
count = "${length(split(",", var.artifact_version))}"
version = "${element(split(",", var.artifact_version), count.index)}"
lifecycle { create_before_destroy = true }
metadata { region = "${var.region}" }
}
lifecycle { create_before_destroy = true }
metadata { region = "${var.region}" }
}
output "amis" { value = "${join(",", atlas_artifact.artifact.*.metadata_full.ami_id)}" }
output "amis" { value = "${join(",", atlas_artifact.artifact.*.metadata_full.ami_id)}" }
```
One can then use the module as follows (_note: the source will likely be different depending on the location of the module_):
One can then use the module as follows (_note: the source will likely be
different depending on the location of the module_):
module "artifact_consul" {
source = "../../../modules/aws/util/artifact"
```hcl
module "artifact_consul" {
source = "../../../modules/aws/util/artifact"
type = "${var.artifact_type}"
region = "${var.region}"
atlas_username = "${var.atlas_username}"
artifact_name = "${var.consul_artifact_name}"
artifact_version = "${var.consul_artifacts}"
}
type = "${var.artifact_type}"
region = "${var.region}"
atlas_username = "${var.atlas_username}"
artifact_name = "${var.consul_artifact_name}"
artifact_version = "${var.consul_artifacts}"
}
```
In the above example, we have created artifacts for Consul. In this example, we can create two versions of the artifact,
"latest" and "pinned". This is useful when rolling a cluster (like Consul) one node at a time, keeping some nodes pinned to current version and others
deployed with the latest Artifact.
In the above example, we have created artifacts for Consul. In this example, we
can create two versions of the artifact, "latest" and "pinned". This is useful
when rolling a cluster (like Consul) one node at a time, keeping some nodes
pinned to current version and others deployed with the latest Artifact.
There are additional details for implementing rolling deployments in the [Best-Practices Repo](https://github.com/hashicorp/best-practices/blob/master/terraform/providers/aws/us_east_1_prod/us_east_1_prod.tf#L105-L123), as there are some things uncovered in this FAQ (i.e Using the Terraform Enterprise Artifact in an instance).

View File

@ -1,6 +1,6 @@
---
layout: "enterprise"
page_title: "Terraform Enterprise Glossary"
page_title: "Glossary - Terraform Enterprise"
sidebar_current: "docs-enterprise-glossary"
description: |-
Terminology for Terraform Enterprise.
@ -8,119 +8,117 @@ description: |-
# Glossary
Terraform Enterprise, and this documentation, covers a large set of terminology adopted
from tools, industry standards and the community. This glossary
seeks to define as many of those terms as possible to help increase
understanding in interfacing with the platform and reading documentation.
Terraform Enterprise, and this documentation, covers a large set of terminology
adopted from tools, industry standards and the community. This glossary seeks to
define as many of those terms as possible to help increase understanding in
interfacing with the platform and reading documentation.
### Authentication Tokens
## Authentication Tokens
Authentication tokens are tokens used to authenticate with Terraform Enterprise via
APIs or through tools. Authentication tokens can be revoked, expired
or created under any user.
Authentication tokens are tokens used to authenticate with Terraform Enterprise
via APIs or through tools. Authentication tokens can be revoked, expired or
created under any user.
### ACL
## ACL
ACL is an acronym for access control list. This defines access
to a set of resources. Access to an object in Terraform Enterprise limited to "read"
for certain users is an example of an ACL.
ACL is an acronym for access control list. This defines access to a set of
resources. Access to an object in Terraform Enterprise limited to "read" for
certain users is an example of an ACL.
### Alert
## Alert
An alert represents a health check status change on a Consul node that
is sent to Terraform Enterprise, and then recorded and distributed to various
An alert represents a health check status change on a Consul node that is sent
to Terraform Enterprise, and then recorded and distributed to various
notification methods.
### Application
## Application
An application is a set of code that represents an application that should
be deployed. Applications can be linked to builds to be made
available in the Packer environment.
An application is a set of code that represents an application that should be
deployed. Applications can be linked to builds to be made available in the
Packer environment.
### Apply
## Apply
An apply is the second step of the two steps required for
Terraform to make changes to infrastructure. The apply is the process
of communicating with external APIs to make the changes.
An apply is the second step of the two steps required for Terraform to make
changes to infrastructure. The apply is the process of communicating with
external APIs to make the changes.
### Artifact
## Artifact
An artifact is an abstract representation of something you wish to
store and use again that has undergone configuration, compilation or
some other build process. An artifact is typically
an image created by Packer that is then deployed by Terraform, or used
locally with Vagrant.
An artifact is an abstract representation of something you wish to store and use
again that has undergone configuration, compilation or some other build process.
An artifact is typically an image created by Packer that is then deployed by
Terraform, or used locally with Vagrant.
### Box
## Box
Boxes are a Vagrant specific package format. Vagrant can install
and uses images in box format.
Boxes are a Vagrant specific package format. Vagrant can install and uses images
in box format.
### Build
## Build
Builds are resources that represent Packer configurations. A build
is a generic name, sometimes called a "Build Configuration" when
defined in the Terraform Enterprise UI.
Builds are resources that represent Packer configurations. A build is a generic
name, sometimes called a "Build Configuration" when defined in the Terraform
Enterprise UI.
### Build Configuration
## Build Configuration
A build configuration are settings associated with a resource that
creates artifacts via builds. A build configuration is the name
in `packer push -name acemeinc/web`.
A build configuration are settings associated with a resource that creates
artifacts via builds. A build configuration is the name in `packer push -name
acemeinc/web`.
### Catalog
## Catalog
The box catalog is a publicly available index of Vagrant Boxes
that can be downloaded from Terraform Enterprise and used for development.
The box catalog is a publicly available index of Vagrant Boxes that can be
downloaded from Terraform Enterprise and used for development.
### Consul
## Consul
[Consul](https://consul.io) is a HashiCorp tool for service discovery, configuration,
and orchestration. Consul enables rapid deployment, configuration, monitoring and
maintenance of service-oriented architectures.
[Consul](https://consul.io) is a HashiCorp tool for service discovery,
configuration, and orchestration. Consul enables rapid deployment,
configuration, monitoring and maintenance of service-oriented architectures.
### Datacenter
## Datacenter
A datacenter represents a group of nodes in the same network or
datacenter within Consul.
A datacenter represents a group of nodes in the same network or datacenter
within Consul.
### Environment
## Environment
Environments show the real-time status of your infrastructure,
any pending changes, and its change history. Environments can be configured
to use any or all of these three components.
Environments show the real-time status of your infrastructure, any pending
changes, and its change history. Environments can be configured to use any or
all of these three components.
Environments are the namespace of your Terraform Enterprise managed infrastructure.
As an example, if you to have a production environment
for a company named Acme Inc., your environment
may be named `%{DEFAULT_USERNAME}/production`.
Environments are the namespace of your Terraform Enterprise managed
infrastructure. As an example, if you to have a production environment for a
company named Acme Inc., your environment may be named
`my-username/production`.
To read more about features provided under environments,
read the [Terraform](/docs/enterprise) sections.
To read more about features provided under environments, read the
[Terraform](/docs/enterprise) sections.
### Environment Variables
## Environment Variables
Environment variables injected into the environment of Packer builds or
Terraform Runs (plans and applies).
### Flapping
## Flapping
Flapping is something entering and leaving a healthy state rapidly. It is typically associated with a health checks that
briefly report unhealthy status before recovering.
Flapping is something entering and leaving a healthy state rapidly. It is
typically associated with a health checks that briefly report unhealthy status
before recovering.
### Health Check
## Health Check
Health checks trigger alerts by changing status on a Consul node. That status
change is seen by Terraform Enterprise, when connected, and an associated alert is
recorded and sent to any configured notification methods, like
email.
change is seen by Terraform Enterprise, when connected, and an associated alert
is recorded and sent to any configured notification methods, like email.
### Infrastructure
## Infrastructure
An infrastructure is a stateful representation of a set of Consul
datacenters.
An infrastructure is a stateful representation of a set of Consul datacenters.
### Managed Node
## Managed Node
Managed node is the billing metric for Terraform Enterprise. For Consul Enterprise, a node is a host
with a Consul agent on it. For Terraform Enterprise, a node is a compute
@ -130,79 +128,77 @@ as compute resources.
All [Terraform Enterprise features](/docs/enterprise) are paid.
### Operator
## Operator
An operator is a person who is making changes to infrastructure or
settings.
An operator is a person who is making changes to infrastructure or settings.
### Packer
## Packer
[Packer](https://packer.io) is a tool for creating images for platforms such as Amazon AWS,
OpenStack, VMware, VirtualBox, Docker, and more — all from a single
[Packer](https://packer.io) is a tool for creating images for platforms such as
Amazon AWS, OpenStack, VMware, VirtualBox, Docker, and more — all from a single
source configuration.
### Packer Template
## Packer Template
A Packer template is a JSON file that configure the various components
of Packer in order to create one or more machine images.
A Packer template is a JSON file that configure the various components of Packer
in order to create one or more machine images.
### Plan
## Plan
A plan is the second step of the two steps required for
Terraform to make changes to infrastructure. The plan is the process
of determining what changes will be made to.
A plan is the second step of the two steps required for Terraform to make
changes to infrastructure. The plan is the process of determining what changes
will be made to.
### Providers
## Providers
Providers are often referenced when discussing Packer
or Terraform. Terraform providers manage resources in Terraform.
Providers are often referenced when discussing Packer or Terraform. Terraform
providers manage resources in Terraform.
[Read more](https://terraform.io/docs/providers/index.html).
### Post-Processors
## Post-Processors
The post-processor section within a Packer template configures
any post-processing that will be done to images built by the builders.
Examples of post-processing would be compressing files, uploading
artifacts, etc..
The post-processor section within a Packer template configures any
post-processing that will be done to images built by the builders. Examples of
post-processing would be compressing files, uploading artifacts, etc..
### Registry
## Registry
Often referred to as the "Artifact Registry", the registry
stores artifacts, be it images or IDs for cloud provider images.
Often referred to as the "Artifact Registry", the registry stores artifacts, be
it images or IDs for cloud provider images.
### Run
## Run
A run represents a two step Terraform plan and a subsequent apply.
### Service
## Service
A service in Consul represents an application or service, which
could be active on any number of nodes.
A service in Consul represents an application or service, which could be active
on any number of nodes.
### Share
## Share
Shares are let you instantly share public access to your running
Vagrant environment (virtual machine).
Shares are let you instantly share public access to your running Vagrant
environment (virtual machine).
### State
## State
Terraform state is the state of your managed infrastructure from the last
time Terraform was run. By default this state is stored in a local file
named `terraform.tfstate`, but it can also be stored in Terraform Enterprise
and is then called "Remote state".
Terraform state is the state of your managed infrastructure from the last time
Terraform was run. By default this state is stored in a local file named
`terraform.tfstate`, but it can also be stored in Terraform Enterprise and is
then called "Remote state".
### Terraform
## Terraform
[Terraform](https://terraform.io) is a tool for safely and
efficiently changing infrastructure across providers.
[Terraform](https://terraform.io) is a tool for safely and efficiently changing
infrastructure across providers.
### Terraform Configuration
## Terraform Configuration
Terraform configuration is the configuration files and any
files that may be used in provisioners like `remote-exec`.
Terraform configuration is the configuration files and any files that may be
used in provisioners like `remote-exec`.
### Terraform Variables
## Terraform Variables
Variables in Terraform, uploaded with `terraform push` or
set in the UI. These differ from environment variables
as they are a first class Terraform variable used in interpolation.
Variables in Terraform, uploaded with `terraform push` or set in the UI. These
differ from environment variables as they are a first class Terraform variable
used in interpolation.