Commit Graph

21211 Commits

Author SHA1 Message Date
Martin Atkins 7c8efe103e configs: allow overrides files to omit args that primary files can't
Some of the fields in our config structs are either mandatory in primary
files or there is a default value that we apply if absent.

Unfortunately override files impose the additional constraint that we
be allowed to omit required fields (which have presumably already been
set in the primary files) and that we are able to distinguish between a
default value and omitting a value entirely.

Since most of our fields were already acceptable for override files, here
we just add some new fields to deal with the few cases where special
handling is required and a helper function to disable the "Required" flag
on attributes in a given schema.
2018-02-15 15:56:38 -08:00
Martin Atkins 4e5efa498a configs: Parser.LoadConfigDir
This method wraps LoadConfigFile to load all of the .tf and .tf.json files
in a given directory and then bundle them together into a Module object.

This function also deals with the distinction between primary and override
files, first appending together the primary files in lexicographic order
by filename, and then merging in override files in the same order.

The merging behavior is not fully implemented as of this commit, and so
will be expanded in future commits.
2018-02-15 15:56:37 -08:00
Martin Atkins 9be399d49c configs: Another simple test for _invalid_ config files
Much like TestParserLoadConfigFileSuccess, this is intended to be an
easy-to-maintain collection of bad examples to test different permutations
of our error handling.

As with TestParserLoadConfigFileSuccess, we should also have more specific
tests alongside this that check that the error outcome is what was
expected, since this test just accepts any error and may thus not be
testing what we think it is.
2018-02-15 15:56:37 -08:00
Martin Atkins e524d1eb95 configs: Simple test of loading valid configuration files
This test is intended to be an easy-to-maintain catalog of good examples
that we can use to catch certain parsing or decoding regressions easily.

It's not a fully-comprehensive test since it doesn't check the result
of decoding, instead just accepting any decode that completes without
errors. However, an easy-to-maintain test like this is a good complement
to some more specialized tests since we can easily collect good examples
over time and just add them in here.
2018-02-15 15:56:37 -08:00
Martin Atkins e15ec486bf configs: Parser.LoadConfigFile
This is a first pass of decoding of the main Terraform configuration file
format. It hasn't yet been tested with any real-world configurations, so
it will need to be revised further as we test it more thoroughly.
2018-02-15 15:56:37 -08:00
Martin Atkins b865d62bb8 govendor fetch github.com/hashicorp/hcl2/...
This just catches us up with the latest fixes and improvements in upstream
HCL2.
2018-02-15 15:56:37 -08:00
Martin Atkins 13fa73c63e configs: stub out main configuration structs
These types represent the individual elements within configuration, the
modules a configuration is made of, and the configuration (static module
tree) itself.
2018-02-15 15:56:37 -08:00
Martin Atkins 05e3b47ba1 configs: Parser.LoadValuesFile
This method loads a "values file" -- also known as a "tfvars file" -- and
returns the values found inside.

A values file is an HCL file (in either native or JSON syntax) whose
top-level body is treated as a set of arbitrary key/value pairs whose
values may not depend on any variables or functions.

We will load values files through a configs.Parser -- even though values
files are not strictly-speaking part of configuration -- because this
causes them to be registered in our source code cache so that we can
generate source code snippets if we need to report any diagnostics.
2018-02-15 15:56:37 -08:00
Martin Atkins a0f4a313ef configs: Parser type
configs.Parser is the entry-point for this package, providing functions to
load and parse HCL-based configuration files.

We use the library "afero" to decouple the parser from the physical OS
filesystem, which here allows us to easily use an in-memory filesystem
for testing and will, in future, allow us to read files from more unusual
places, such as configuration embedded in a plan file.
2018-02-15 15:56:36 -08:00
Martin Atkins 7987a2fdb2 configs: new package for HCL2-based configuration
There's a lot of complexity in our existing "config" package that results
from our approach to handling configuration with HCL and HIL. A lot of
that functionality is no longer needed -- or must work in a significantly
different way -- for HCL2.

The new package "configs", which is named following the convention of some
Go standard library packages like "strings", is a re-imagination of some
of the functionality from the "config" package for an HCL2-only world.

The scope of this package will be slightly smaller than "config", since
it only deals with config loading and not with expression evaluation.
Another package "lang" (mentioned in the docstring here but not yet added)
will deal with the more dynamic portions of of configuration handling,
including populating an hcl.EvalContext to evaluate expressions.
2018-02-15 15:10:01 -08:00
Martin Atkins 976d85ae92 govendor fetch github.com/spf13/afero/... 2018-02-15 15:10:01 -08:00
Brian Flad b2dae9b06c
Merge pull request #17349 from hashicorp/d-importability
docs/import: Remove out of date listing of importable resources
2018-02-14 17:15:46 -05:00
Brian Flad 5576b889ab docs/import: Remove out of date listing of importable resources and note where to find the information 2018-02-14 12:02:45 -05:00
Clint c2306be0fa
Update CHANGELOG.md 2018-02-13 14:15:24 -06:00
Nolan Davidson f43e592849 [provisioner-habitat] Detect if hab user exists (#17195)
Currently the provisioner will fail if the `hab` user already exists on
the target system.

This adds a check to see if we need to create the user before trying to
add it.

Fixes #17159

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2018-02-13 14:13:22 -06:00
Nolan Davidson 848375b9a6 [provisioner-habitat] Allow custom service name (#17196)
This change allows the Habitat supervisor service name to be
configurable. Currently it is hard coded to `hab-supervisor`.

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
2018-02-13 14:11:59 -06:00
Joshua Carp 52f6abf47b Document aws_route53_record importable (#17306)
See https://github.com/hashicorp/terraform-website/issues/20
2018-02-13 14:07:05 -06:00
Brian Flad 7475ce669e
Update CHANGELOG for #17216 2018-02-13 11:50:42 -05:00
Brian Flad 69dad6f1cf
Merge pull request #17329 from hashicorp/v-terraform-provider-aws-v1.9.0
deps: Bump terraform-provider-aws@v1.9.0 and aws-sdk-go@v1.12.73
2018-02-13 11:45:19 -05:00
James Bardin a65089fcea
Merge pull request #17323 from hashicorp/jbardin/shutdown
Fix race in writing state during hard cancelation
2018-02-13 10:14:48 -05:00
Brian Flad 74598ff9fe deps: Bump terraform-provider-aws@v1.9.0 and aws-sdk-go@v1.12.73 2018-02-13 06:26:02 -05:00
JeongHoon Byun (aka Outsider) 8566ade0c3 website: fix incorrect anchor links for registry API pagination 2018-02-12 19:36:52 -08:00
Michael Mell 4b598860bb website: document the naming conventions for outputs 2018-02-12 19:33:57 -08:00
James Bardin ef8ed1e275 coalesce the backened interrupt code
Moves the nested select statements for backend operations into a single
function. The only difference in this part was that apply called
PersistState, which should be harmless regardless of the type of
operation being run.
2018-02-12 11:56:54 -05:00
James Bardin ecd9ef0f77 ignore error in plan shutdown test
The error was being silently dropped before.

There is an interpolation error, because the plan is canceled before
some of the resources can be evaluated. There might be a better way to
handle this in the walk cancellation, but the behavior has not changed.

Make the plan and apply shutdown match implementation-wise
2018-02-12 11:56:54 -05:00
James Bardin 67a6152091 move backend operation cancellation into meta
Create a single command method for running and operation with
cancellation.
2018-02-12 11:56:54 -05:00
James Bardin 7cba68326a always wait for a RunningOperation to return
If the user wishes to interrupt the running operation, only the first
interrupt was communicated to the operation by canceling the provided
context. A second interrupt would start the shutdown process, but not
communicate this to the running operation. This order of event could
cause partial writes of state.

What would happen is that once the command returns, the plugin system
would stop the provider processes. Once the provider processes dies, all
pending Eval operations would return return with an error, and quickly
cause the operation to complete. Since the backend code didn't know that
the process was shutting down imminently, it would continue by
attempting to write out the last known state. Under the right
conditions, the process would exit part way through the writing of the
state file.

Add Stop and Cancel CancelFuncs to the RunningOperation, to allow it to
easily differentiate between the two signals. The backend will then be
able to detect a shutdown and abort more gracefully.

In order to ensure that the backend is not in the process of writing the
state out, the command will always attempt to wait for the process to
complete after cancellation.
2018-02-12 11:56:03 -05:00
Alvaro Miranda Aguilera 3821c0b45a
Merge pull request #17321 from hashicorp/kikitux-patch-1
fix CenturyLink typo
2018-02-12 11:29:23 +01:00
Alvaro Miranda Aguilera bf18ad3eb9
Update cloud-index.html.markdown 2018-02-12 11:08:28 +01:00
Ryan Uber a25d98b6d1
Merge pull request #17312 from hashicorp/b-state-uuid
terraform: use hashicorp/go-uuid for lineage generation
2018-02-09 15:21:10 -08:00
Ryan Uber 71ac5034e9 terraform: use hashicorp/go-uuid for lineage generation 2018-02-09 15:02:32 -08:00
Justin Campbell 58840f6588
Merge pull request #17309 from hashicorp/docs-registry-examples
website: Clarify Registry examples behavior
2018-02-09 16:25:48 -05:00
Justin Campbell c3872b42b5 website: Clarify Registry examples behavior 2018-02-09 12:51:19 -05:00
Nick Fagerlund f0a009c573 website: private module registry documentation 2018-02-07 09:15:55 -08:00
Chris Griggs 1e12e49878 Website: Restructure Community providers list (#17286)
* restructure community providers list

* add vRA

* add Gandi provider

* re-organize
2018-02-06 15:35:12 -08:00
Brian Flad ec25a320e1
Merge pull request #17216 from hashicorp/f-aws-cn-northwest-1
deps: Bump AWS provider to support cn-northwest-1 state
2018-02-06 18:01:42 -05:00
Brian Flad b924e8cba5 deps: Bump terraform-provider-aws@v1.8.0 and aws-sdk-go@v1.12.70 2018-02-05 20:06:50 -05:00
Chris Griggs 4f38f4f9eb Website Update provider name (#17270)
* edit prvoider name
2018-02-02 12:17:30 -06:00
Radek Simko bb844504bd
Update CHANGELOG.md 2018-02-01 13:34:08 +00:00
Radek Simko a4388b0ef2
Merge pull request #17261 from hashicorp/b-diff-crash-set
helper/schema: Prevent crash on removal of computed field in CustomizeDiff
2018-02-01 13:33:28 +00:00
Radek Simko 7af1c2b3a4
helper/schema: Prevent crash on removal of computed field in CustomizeDiff 2018-02-01 12:05:22 +00:00
James Bardin 1ba8691f35
Merge pull request #17241 from hashicorp/jbardin/destroy-with-locals
Fix destroy-time handling of outputs and local values
2018-01-31 17:40:19 -05:00
James Bardin 4b617986c8
Merge pull request #17260 from hashicorp/jbardin/plan-shutdown-test
slow down the plan shutdown tests for slow hosts
2018-01-31 17:38:12 -05:00
James Bardin 6f41a80b3a slow down the plan shutdown tests for slow hosts
The plan shutdown test often fail on slow CI hosts, becase the plan
completes befor the main thread can cancel it. Since attempting to make
the MockProvider concurrent proved too invasive for now, just slow the
test down a bit to help ensure Stop gets called.
2018-01-31 17:09:48 -05:00
James Bardin 7217aba5f0 release: clean up after v0.11.3 2018-01-31 21:00:32 +00:00
James Bardin 3802b14260
v0.11.3 2018-01-31 20:48:39 +00:00
Aidan Feldman c9481ab012 website: improve the Module Sources documentation
Better section linking within Module Sources page, and centralize the documentation on Terraform Registry sources.
2018-01-31 11:52:14 -08:00
Blake Stoddard f918fb8583 website: fix ordering of interpolation functions 2018-01-31 11:50:00 -08:00
James Bardin 7fbc35a36c Make sure outputs are removed when targeting
Similar to NodeApplyableOuptut, NodeDestroyableOutputs also need to stay
in the graph if any ancestor nodes

Use the same GraphNodeTargetDownstream method to keep them from being
pruned, since they are dependent on the output node and all its
descendants.
2018-01-31 13:51:40 -05:00
Chris Griggs 3d23a14a7a Website: Provider link (#17246)
* Website: add PANOS links

* fix type

* edit
2018-01-31 10:29:48 -06:00