From 6ced245898469794bc3fbce2e4b9179331af485d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 24 Jul 2014 16:28:20 -0700 Subject: [PATCH 1/5] website: configuration --- .../docs/configuration/interpolation.html.md | 42 +++++++++++++++ .../source/docs/configuration/load.html.md | 8 ++- .../docs/configuration/override.html.md | 52 +++++++++++++++++++ .../source/docs/configuration/syntax.html.md | 5 ++ website/source/layouts/docs.erb | 4 ++ 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 website/source/docs/configuration/interpolation.html.md create mode 100644 website/source/docs/configuration/override.html.md diff --git a/website/source/docs/configuration/interpolation.html.md b/website/source/docs/configuration/interpolation.html.md new file mode 100644 index 000000000..d2de8f35c --- /dev/null +++ b/website/source/docs/configuration/interpolation.html.md @@ -0,0 +1,42 @@ +--- +layout: "docs" +page_title: "Interpolation Syntax" +sidebar_current: "docs-config-interpolation" +--- + +# Interpolation Syntax + +Embedded within strings in Terraform, whether you're using the +Terraform syntax or JSON syntax, you can interpolate other values +into strings. These interpolations are wrapped in `${}`, such as +`${var.foo}`. + +The interpolation syntax is powerful and allows you to reference +variables, attributes of resources, call functions, etc. + +To reference variables, use the `var.` prefix followed by the +variable name. For example, `${var.foo}` will interpolate the +`foo` variable value. If the variable is a mapping, then you +can reference static keys in the map with the syntax +`var.MAP.KEY`. For example, `${var.amis.us-east-1}` would +get the value of the `us-east-1` key within the `amis` variable +that is a mapping. + +To reference attributes of other resources, the syntax is +`TYPE.NAME.ATTRIBUTE`. For example, `${aws_instance.web.id}` +will interpolate the ID attribute from the "aws\_instance" +resource named "web". + +Finally, Terraform ships with built-in functions. Functions +are called with the syntax `name(arg, arg2, ...)`. For example, +to read a file: `${file("path.txt")}`. The built-in functions +are documented below. + +## Built-in Functions + +The supported built-in functions are: + + * `file(path)` - Reads the contents of a file into the string. + + * `lookup(map, key)` - Performs a dynamic lookup into a mapping + variable. diff --git a/website/source/docs/configuration/load.html.md b/website/source/docs/configuration/load.html.md index 66ed02b9a..7966e89f7 100644 --- a/website/source/docs/configuration/load.html.md +++ b/website/source/docs/configuration/load.html.md @@ -8,9 +8,13 @@ sidebar_current: "docs-config-load" When invoking any command that loads the Terraform configuration, Terraform loads all configuration files within the directory -specified in alphabetical order. The flies loaded must end in +specified in alphabetical order. + +The files loaded must end in either `.tf` or `.tf.json` to specify the format that is in use. -Otherwise, the files are ignored. +Otherwise, the files are ignored. Multiple file formats can +be present in the same directory; it is okay to have one Terraform +configuration file be Terraform syntax and another be JSON. [Override](/docs/configuration/override.html) files are the exception, as they're loaded after all non-override diff --git a/website/source/docs/configuration/override.html.md b/website/source/docs/configuration/override.html.md new file mode 100644 index 000000000..cb77da49d --- /dev/null +++ b/website/source/docs/configuration/override.html.md @@ -0,0 +1,52 @@ +--- +layout: "docs" +page_title: "Overrides" +sidebar_current: "docs-config-override" +--- + +# Overrides + +Terraform loads all configuration files within a directory and +appends them together. Terraform also has a concept of _overrides_, +a way to create files that are loaded last and _merged_ into your +configuration, rather than appended. + +Overrides have a few use cases: + + * Machines (tools) can create overrides to modify Terraform + behavior without having to edit the Terraform configuration + tailored to human readability. + + * Temporary modifications can be made to Terraform configurations + without having to modify the configuration itself. + +Overrides names must be `override` or end in `_override`, excluding +the extension. Examples of valid override files are `override.tf`, +`override.tf.json`, `temp_override.tf`. + +Override files are loaded last in alphabetical order. + +Override files can be in Terraform syntax or JSON, just like non-override +Terraform configurations. + +## Example + +If you have a Terraform configuration `example.tf` with the contents: + +``` +resource "aws_instance" "web" { + ami = "ami-1234567" +} +``` + +And you created a file `override.tf` with the contents: + +``` +resource "aws_instance" "web" { + ami = "foo" +} +``` + +Then the AMI for the one resource will be replaced with "foo". Note +that the override syntax can be Terraform syntax or JSON. You can +mix and match syntaxes without issue. diff --git a/website/source/docs/configuration/syntax.html.md b/website/source/docs/configuration/syntax.html.md index 6d930de32..c162d2ec6 100644 --- a/website/source/docs/configuration/syntax.html.md +++ b/website/source/docs/configuration/syntax.html.md @@ -47,6 +47,11 @@ Basic bullet point reference: * Strings are in double-quotes. + * Strings can interpolate other values using syntax wrapped + in `${}`, such as `${var.foo}`. The full syntax for interpolation + is + [documented here](/docs/configuration/interpolation.html). + * Numbers are assumed to be base 10. If you prefix a number with `0x`, it is treated as a hexadecimal number. diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index c5125efb3..2387b8544 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -17,6 +17,10 @@ Configuration Syntax + > + Interpolation Syntax + + > Overrides From 228c8db134095cbab62b4afd78674e5028568b23 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Thu, 24 Jul 2014 19:32:43 -0400 Subject: [PATCH 2/5] providers/dnsimple: add hostname as computed resource --- builtin/providers/dnsimple/resource_dnsimple_record.go | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/providers/dnsimple/resource_dnsimple_record.go b/builtin/providers/dnsimple/resource_dnsimple_record.go index b3d2da13f..165210f86 100644 --- a/builtin/providers/dnsimple/resource_dnsimple_record.go +++ b/builtin/providers/dnsimple/resource_dnsimple_record.go @@ -142,6 +142,7 @@ func resource_dnsimple_record_diff( "priority", "domain_id", "ttl", + "hostname", }, } From 058dfaf2c45b064cb9ea4e81be58294e44938b1b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 24 Jul 2014 16:33:24 -0700 Subject: [PATCH 3/5] website: more config pages --- website/source/layouts/docs.erb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index 2387b8544..cf1989395 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -24,6 +24,23 @@ > Overrides + + > + Resources + + + > + Providers + + + > + Variables + + + > + Outputs + + From decc837fa3436be6681aaf54a3c17141caf0eaeb Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 24 Jul 2014 19:16:03 -0400 Subject: [PATCH 4/5] website: Document the new DO resources --- .../docs/providers/do/r/domain.html.markdown | 33 +++++++++++++ .../docs/providers/do/r/record.html.markdown | 46 +++++++++++++++++++ website/source/layouts/digitalocean.erb | 8 ++++ 3 files changed, 87 insertions(+) create mode 100644 website/source/docs/providers/do/r/domain.html.markdown create mode 100644 website/source/docs/providers/do/r/record.html.markdown diff --git a/website/source/docs/providers/do/r/domain.html.markdown b/website/source/docs/providers/do/r/domain.html.markdown new file mode 100644 index 000000000..d1baae682 --- /dev/null +++ b/website/source/docs/providers/do/r/domain.html.markdown @@ -0,0 +1,33 @@ +--- +layout: "digitalocean" +page_title: "DigitalOcean: digitalocean_domain" +sidebar_current: "docs-do-resource-domain" +--- + +# digitalocean\_domain + +Provides a DigitalOcean domain resource. + +## Example Usage + +``` +# Create a new domain record +resource "digitalocean_domain" "default" { + name = "www.example.com" + ip_address = "${digitalocean_droplet.foo.ipv4_address}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the domain +* `ip_address` - (Required) The IP address of the domain + +## Attributes Reference + +The following attributes are exported: + +* `id` - The name of the domain + diff --git a/website/source/docs/providers/do/r/record.html.markdown b/website/source/docs/providers/do/r/record.html.markdown new file mode 100644 index 000000000..bfd6ee7c7 --- /dev/null +++ b/website/source/docs/providers/do/r/record.html.markdown @@ -0,0 +1,46 @@ +--- +layout: "digitalocean" +page_title: "DigitalOcean: digitalocean_record" +sidebar_current: "docs-do-resource-record" +--- + +# digitalocean\_record + +Provides a DigitalOcean domain resource. + +## Example Usage + +``` +# Create a new domain record +resource "digitalocean_domain" "default" { + name = "www.example.com" + ip_address = "${digitalocean_droplet.foo.ipv4_address}" +} + +# Add a record to the domain +resource "digitalocean_record" "foobar" { + domain = "${digitalocean_domain.default.name}" + type = "A" + name = "foobar" + value = "192.168.0.11" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `type` - (Required) The type of record +* `domain` - (Required) The domain to add the record to +* `value` - (Optional) The value of the record +* `name` - (Optional) The name of the record +* `weight` - (Optional) The weight of the record +* `port` - (Optional) The port of the record +* `priority` - (Optional) The priority of the record + +## Attributes Reference + +The following attributes are exported: + +* `id` - The record ID + diff --git a/website/source/layouts/digitalocean.erb b/website/source/layouts/digitalocean.erb index 1a6023be2..cfffcd85f 100644 --- a/website/source/layouts/digitalocean.erb +++ b/website/source/layouts/digitalocean.erb @@ -13,9 +13,17 @@ > Resources From a5098f167c384fedaff1fb7d7b65307add0a32c7 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Thu, 24 Jul 2014 19:35:40 -0400 Subject: [PATCH 5/5] website: document dnsimple --- .../providers/dnsimple/index.html.markdown | 37 +++++++++++++++ .../providers/dnsimple/r/record.html.markdown | 46 +++++++++++++++++++ website/source/layouts/_footer.erb | 1 - website/source/layouts/dnsimple.erb | 26 +++++++++++ website/source/layouts/docs.erb | 4 ++ website/source/stylesheets/_docs.less | 1 + website/source/stylesheets/main.css | 3 ++ 7 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 website/source/docs/providers/dnsimple/index.html.markdown create mode 100644 website/source/docs/providers/dnsimple/r/record.html.markdown create mode 100644 website/source/layouts/dnsimple.erb diff --git a/website/source/docs/providers/dnsimple/index.html.markdown b/website/source/docs/providers/dnsimple/index.html.markdown new file mode 100644 index 000000000..ac84f177d --- /dev/null +++ b/website/source/docs/providers/dnsimple/index.html.markdown @@ -0,0 +1,37 @@ +--- +layout: "dnsimple" +page_title: "Provider: DNSimple" +sidebar_current: "docs-dnsimple-index" +--- + +# DNSimple Provider + +The DNSimple provider is used to interact with the +resources supported by DNSimple. The provider needs to be configured +with the proper credentials before it can be used. + +Use the navigation to the left to read about the available resources. + +## Example Usage + +``` +# Configure the DNSimple provider +provider "dnsimple" { + token = "${var.dnsimple_token}" + email = "${var.dnsimple_email}" +} + +# Create a record +resource "dnsimple_record" "www" { + ... +} +``` + +## Argument Reference + +The following arguments are supported: + +* `token` - (Required) The DNSimple API token +* `email` - (Required) The email associated with the token + + diff --git a/website/source/docs/providers/dnsimple/r/record.html.markdown b/website/source/docs/providers/dnsimple/r/record.html.markdown new file mode 100644 index 000000000..bf6afae09 --- /dev/null +++ b/website/source/docs/providers/dnsimple/r/record.html.markdown @@ -0,0 +1,46 @@ +--- +layout: "dnsimple" +page_title: "DNSimple: dnsimple_record" +sidebar_current: "docs-dnsimple-resource-record" +--- + +# dnsimple\_record + +Provides a DNSimple record resource. + +## Example Usage + +``` +# Add a record to the domain +resource "dnsimple_record" "foobar" { + domain = "${var.dnsimple_domain}" + name = "terraform" + value = "192.168.0.11" + type = "A" + ttl = 3600 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `domain` - (Required) The domain to add the record to +* `name` - (Required) The name of the record +* `value` - (Required) The value of the record +* `type` - (Required) The type of the record +* `ttl` - (Optional) The TTL of the record + +## Attributes Reference + +The following attributes are exported: + +* `id` - The record ID +* `name` - The name of the record +* `value` - The value of the record +* `type` - The type of the record +* `ttl` - The ttl of the record +* `priority` - The priority of the record +* `domain_id` - The domain ID of the record +* `hostname` - The FQDN of the record + diff --git a/website/source/layouts/_footer.erb b/website/source/layouts/_footer.erb index 4baa7bccd..75290181d 100644 --- a/website/source/layouts/_footer.erb +++ b/website/source/layouts/_footer.erb @@ -7,7 +7,6 @@
  • Intro
  • Docs
  • Community
  • -
  • Demo