Commit Graph

644 Commits

Author SHA1 Message Date
Mitchell Hashimoto ec0ef95c6f
terraform: verify import providers only depend on vars 2016-11-09 15:09:13 -08:00
Mitchell Hashimoto 5107c33119
command/import: load configurations and allow empty config dirs
Fixes #7774

This modifies the `import` command to load configuration files from the
pwd. This also augments the configuration loading section for the CLI to
have a new option (default false, same as old behavior) to
allow directories with no Terraform configurations.
For import, we allow directories with no Terraform configurations so
this option is set to true.
2016-11-09 15:08:22 -08:00
Mitchell Hashimoto 646b3c1b68 Merge pull request #9158 from hashicorp/f-vault-provider
Vault Provider
2016-11-08 15:27:33 -08:00
Mitchell Hashimoto 57c0cadc79 Merge pull request #9666 from hashicorp/jbardin/debug
preliminary debug output
2016-11-04 09:03:58 -07:00
Mitchell Hashimoto f6dacab0ba Merge pull request #9794 from hashicorp/b-partial-input
command/meta: always ask for unset variable input
2016-11-04 08:48:05 -07:00
James Bardin 797a1b339d DebugInfo and DebugGraph
Implement debugInfo and the DebugGraph

DebugInfo will be a global variable through which graph debug
information can we written to a compressed archive. The DebugInfo
methods are all safe for concurrent use, and noop with a nil receiver.
The API outside of the terraform package will be to call SetDebugInfo
to create the archive, and CloseDebugInfo() to properly close the file.
Each write to the archive will be flushed and sync'ed individually, so
in the event of a crash or a missing call to Close, the archive can
still be recovered.

The DebugGraph is a representation of a terraform Graph to be written to
the debug archive, currently in dot format. The DebugGraph also contains
an internal buffer with Printf and Write methods to add to this buffer.
The buffer will be written to an accompanying file in the debug archive
along with the graph.

This also adds a GraphNodeDebugger interface. Any node implementing
`NodeDebug() string` can output information to annotate the debug graph
node, and add the data to the log. This interface may change or be
removed to provide richer options for debugging graph nodes.

The new graph builders all delegate the build to the BasicGraphBuilder.
Having a Name field lets us differentiate the actual builder
implementation in the debug graphs.
2016-11-04 11:30:51 -04:00
Mitchell Hashimoto d429e82661
command: show shadow errors to the user 2016-11-03 18:14:07 -07:00
Mitchell Hashimoto 6c801d0386
command/apply: add additional nil check to loading state for outputs 2016-11-02 22:33:49 -07:00
Mitchell Hashimoto 1248b147ac
command/meta: always ask for unset variable input
Fixes #7975

This changes the InputMode for the CLI to always be:

    InputModeProvider | InputModeVar | InputModeVarUnset

Which means:

  * Ask for provider variables
  * Ask for user variables _that are not already set_

The change is the latter point. Before, we'd only ask for variables if
zero were given. This forces the user to either have no variables set
via the CLI, env vars, tfvars or ALL variables, but no in between. As
reported in #7975, this isn't expected behavior.

The new change makes is so that unset variables are always asked for.
Users can retain the previous behavior by setting `-input=false`. This
would ensure that variables set by external sources cover all cases.
2016-11-01 19:16:43 -07:00
Mitchell Hashimoto ab0b7e2d89 Merge pull request #9660 from hashicorp/b-validate-help
command/validate: respond to --help
2016-10-31 13:24:58 -07:00
Mitchell Hashimoto 314a8ed134 Merge pull request #9706 from hashicorp/b-apply-plan
command/apply: apply from plan respects -backup and -state-out
2016-10-31 13:24:24 -07:00
Calle Pettersson 51ff5cba38 Align the help string of output with documentation (#9735) 2016-10-31 11:34:56 +00:00
Martin Atkins b2b5831205 "vault" provider registration
To reduce the risk of secret exposure via Terraform state and log output,
we default to creating a relatively-short-lived token (20 minutes) such
that Vault can, where possible, automatically revoke any retrieved
secrets shortly after Terraform has finished running.

This has some implications for usage of this provider that will be spelled
out in more detail in the docs that will be added in a later commit, but
the most significant implication is that a plan created by "terraform plan"
that includes secrets leased from Vault must be *applied* before the
lease period expires to ensure that the issued secrets remain valid.

No resources yet. They will follow in subsequent commits.
2016-10-29 23:16:57 -07:00
Mitchell Hashimoto 2019a44f04
command/apply: apply from plan respects -backup and -state-out
Fixes #5409

I didn't expect this to be such a rabbit hole!

Based on git history, it appears that for "historical reasons"(tm),
setting up the various `state.State` structures for a plan were
_completely different logic_ than a normal `terraform apply`. This meant
that it was skipping things like disabling backups with `-backup="-"`.

This PR unifies loading from a plan to the normal state setup mechanism.
A few tests that were failing prior to this PR were added, no existing
tests were changed.
2016-10-28 20:51:05 -04:00
Mitchell Hashimoto b2950bc205
command/validate: respond to --help
Fixes #5072

This is very simple: we need to process CLI flags on validate in order
to catch and respond to `--help`.
2016-10-27 13:43:01 -04:00
Mitchell Hashimoto 69b32223b8 Merge pull request #9633 from hashicorp/f-experiment
helper/experiment: a helper for setting, making experiments
2016-10-27 11:22:07 -04:00
Mitchell Hashimoto 9c2014d5b6 Merge pull request #9642 from hashicorp/b-var-bool
command: FlagTypedKV parses bool as string
2016-10-27 11:17:16 -04:00
Mitchell Hashimoto f9b0207304
command: FlagTypedKV parses bool as string
When passing a bool type to a variable such as `-var foo=true`, the CLI
would parse this as a `bool` type which Terraform core cannot handle.
It would then error with an invalid type error.

This changes the handling to convert the bool to its literally string
value given on the command-line.
2016-10-26 21:45:39 -04:00
James Bardin 43f860ddfd Fix panic during "terraform show" with empty state
It's possible to have > 1 result from the StateFilter, and not have any
instances to show.
2016-10-26 17:18:36 -04:00
Mitchell Hashimoto af82be19ea
helper/experiment: a helper for setting, making experiments
This creates a standard package and interface for defining, querying,
setting experiments (`-X` flags).

I expect we'll want to continue to introduce various features behind
experimental flags. I want to make doing this as easy as possible and I
want to make _removing_ experiments as easy as possible as well.

The goal with this packge has been to rely on the compiler enforcing our
experiment references as much as possible. This means that every
experiment is a global variable that must be referenced directly, so
when it is removed you'll get compiler errors where the experiment is
referenced.

This also unifies and makes it easy to grab CLI flags to enable/disable
experiments as well as env vars! This way defining an experiment is just
a couple lines of code (documented on the package).
2016-10-26 15:47:58 -04:00
Mitchell Hashimoto aed23a0a31 Merge pull request #9527 from hashicorp/f-destroy-builder2
terraform: destroy graph builder based on state
2016-10-26 12:53:20 -04:00
Mitchell Hashimoto bb5f6498e2
provider/nomad 2016-10-24 10:34:06 -07:00
Alexander Hellbom d02067a75e Add PagerDuty provider 2016-10-24 14:19:55 +02:00
Mitchell Hashimoto 1a418c1452
command/apply: -Xnew-destroy 2016-10-22 12:36:47 -07:00
Mitchell Hashimoto ae4f79e3b6
command/meta: add -shadow flag to disable shadow graph
Since it is still very much possible for this to cause problems, this
can be used to disable the shadow graph. We'll purposely not document
this since the goal is to remove this flag as we become more confident
with it.
2016-10-21 14:25:05 -07:00
Mitchell Hashimoto e8516f259d
command/apply: Xnew-apply 2016-10-19 13:39:28 -07:00
Mitchell Hashimoto ec15783f24
-Xnew-apply to enable the new apply graph 2016-10-19 13:39:28 -07:00
James Bardin f175497dd7 Fix vet issues
None were critical, but these will fail with the next version of vet.
2016-10-18 11:11:12 -04:00
James Bardin 54d50c90b1 Make TestApply_parallelism more reliable
Wait for our expected number of goroutines to be staged and ready, then
allow Run() to complete. Use a high-water-mark counter to ensure we
never exceeded the max expected concurrent goroutines at any point
during the run.
2016-10-17 18:26:16 -04:00
James Bardin 4f91507d05 Merge pull request #9268 from hashicorp/jbardin/hcl-maps
Get rid of the list when parsing HCL maps for vars
2016-10-13 14:18:29 -04:00
James Bardin 9fc50a76c3 Get rid of the list when parsing HCL maps for vars
When we parse a map from HCL, it's decoded into a list of maps because
HCL allows declaring a key multiple times to implicitly add it to a
list.  Since there's no terraform variable configuration that supports
this structure, we can always flatten a []map[string]interface{} value
to a map[string]interface{} and remove any type rrors trying to apply
that value.
2016-10-06 19:44:19 -04:00
James Bardin 286fea571f Fix push test to use something that is HCL
Fix the tfvars push test which was mistakingly using a single number to
trigger the HCL behavior.
2016-10-06 16:37:28 -04:00
James Bardin cf1cfccf06 Don't parse a TestFlagTypedKV value as a number
Don't try to parse a varibale as HCL if the value can be parse as a
single number. HCL will always attempt to convert the value to a number,
even if we later find the configured variable's type to be a string.
2016-10-06 16:27:33 -04:00
stack72 a2970e631c
Merge branch 'cwood/bitbucket-provider' of https://github.com/cwood/terraform into cwood-cwood/bitbucket-provider 2016-09-21 19:35:58 +01:00
Mitchell Hashimoto 609219fc65 command/meta: validate config immediately
* config: test for validating multi-vars (passes)

* command/plan: test invalid run

* command/meta: validate module on load
2016-09-03 15:26:49 -07:00
Mitchell Hashimoto fad1ce9915 Merge pull request #8620 from hashicorp/b-var-input
command: more resilient HCL check for inputs
2016-09-02 10:02:23 -07:00
Mitchell Hashimoto c84f699158
update HCL vendor 2016-09-02 09:58:05 -07:00
Paul Stack 05994cef31 Merge pull request #7694 from jtopjian/provider-rabbitmq
RabbitMQ Provider
2016-09-02 08:08:18 +01:00
Mitchell Hashimoto 0a2b5de67f
command: more resilient HCL check for inputs 2016-09-01 20:14:10 -07:00
Joe Topjian c2469c95f4 provider/rabbitmq: Initial Commit of RabbitMQ Provider
Contains provider configuration, a rabbitmq_vhost resource, and
acceptance test.
2016-09-01 03:19:16 +00:00
Mitchell Hashimoto 475d8750bb
command/push: make test more resilient 2016-08-26 13:38:02 -07:00
Radek Simko 8494cad8c4 Output 'destroy complete' when it's destroy (was: apply) (#8453) 2016-08-25 22:26:40 +01:00
Mitchell Hashimoto 2f8baa4580
command/push: fix tests to be vcs=false GH-8478 2016-08-25 14:09:34 -07:00
Mitchell Hashimoto 9a8209cfbd
command/push: create the proper parent directory entries in tar 2016-08-24 10:39:50 -07:00
Mitchell Hashimoto 928fdff33e
command/push: only add module directory to tar if it exists 2016-08-23 23:19:02 -07:00
Mitchell Hashimoto 92b15de080
command/push: remove the old test fixture for the new one 2016-08-23 23:16:30 -07:00
Mitchell Hashimoto a650455ed6
command/push: only explicitly include the state
modify the module include flag to flag whether we explicitly include or
exclude modules
2016-08-23 23:12:52 -07:00
Mitchell Hashimoto 3aecc52bf3
command/push: "Extra" value must be absolute 2016-08-23 22:58:58 -07:00
Mitchell Hashimoto f0de3c3e91
command/push: removed all the git stuff, turns out it doesn't matter 2016-08-23 22:51:37 -07:00
Mitchell Hashimoto e8267f4907
command/push: failing test for pushing with no modules 2016-08-23 22:49:00 -07:00
Mitchell Hashimoto 70cc108614
Revert "command/push: test that -upload-modules=false works"
This reverts commit edda576452.
2016-08-23 22:00:02 -07:00
Mitchell Hashimoto edda576452
command/push: test that -upload-modules=false works 2016-08-23 17:40:40 -07:00
Mitchell Hashimoto 2ac142abc3
command: use bufio.ReadString instead of scanning to get spaces
[GH-2628]
2016-08-22 12:59:48 -07:00
Mitchell Hashimoto d3792e4aef
command: correct outdated comment 2016-08-19 23:56:27 -04:00
Mitchell Hashimoto 43cfd3d1c9
command: fix regressions for state mv with count resource 2016-08-19 12:09:19 -04:00
Mitchell Hashimoto 0d1ea84d39
command: test for moving resource with count [GH-7797] 2016-08-19 12:05:20 -04:00
Mitchell Hashimoto 3b3f92cd9b
terraform: fix some test failures on state add with multiple modules 2016-08-18 17:39:07 -04:00
Mitchell Hashimoto a44c8b8760
terraform: state mv tests 2016-08-18 15:05:42 -04:00
James Nugent f933b2cf16 Merge pull request #8200 from hashicorp/fix-state-rm
core: Add `terraform state rm` command
2016-08-16 19:10:17 +01:00
Paul Stack 4d46812bab Update state_rm_test.go
Removing sort as it was imported and not used
2016-08-16 18:10:38 +01:00
Mitchell Hashimoto 3fdc08a9eb core: Add `terraform state rm` command and docs
This commit adds the `state rm` command for removing an address from
state. It is the result of a rebase from pull-request #5953 which was
lost at some point during the Terraform 0.7 feature branch merges.
2016-08-16 16:45:44 +01:00
Paul Hinze 84bbbfbe18
command: Fixup comment typo
Hat tip to @Ninir :)
2016-08-16 09:48:21 -05:00
Paul Hinze 50df583ffd Merge pull request #8120 from hashicorp/jbardin/null-state-module
Fix panic from a null resources module in a state file
2016-08-16 09:45:52 -05:00
James Bardin 1be5a650fc Add test for showing an empty state
Make sure we don't panic if there's no state to print
2016-08-12 15:01:25 -04:00
James Bardin 191d7c1007 Fix panic when showing empty state
Fixes a nil dereference when there's no state to print.

Fix some slice declaration to use the recommended style when allocations
don't matter.
2016-08-12 14:19:42 -04:00
James Bardin cdb80f68a8 Ensure better state normalization
Fix checksum issue with remote state

If we read a state file with "null" objects in a module and they become
initialized to an empty map the state file may be written out with empty
objects rather than "null", changing the checksum. If we can detect
this, increment the serial number to prevent a conflict in atlas.

Our fakeAtlas test server now needs to decode the state directly rather
than using the ReadState function, so as to be able to read the state
unaltered.

The terraform.State data structures have initialization spread out
throughout the package. More thoroughly initialize State during
ReadState, and add a call to init() during WriteState as another
normalization safeguard.

Expose State.init through an exported Init() method, so that a new State
can be completely realized outside of the terraform package.
Additionally, the internal init now completely walks all internal state
structures ensuring that all maps and slices are initialized.  While it
was mentioned before that the `init()` methods are problematic with too
many call sites, expanding this out better exposes the entry points that
will need to be refactored later for improved concurrency handling.

The State structures had a mix of `omitempty` fields. Remove omitempty
for all maps and slices as part of this normalization process. Make
Lineage mandatory, which is now explicitly set in some tests.
2016-08-12 11:09:50 -04:00
James Nugent e181d753fe build: Fix ordering of plugin list 2016-08-09 15:03:24 -04:00
Colin Wood bd9ddff0cc Bitbucket provider for terraform 2016-08-08 09:45:16 -07:00
Brad Sickles 70cadcf31d Implement archive provider and "archive_file" resource. (#7322) 2016-08-08 12:56:44 +12:00
James Bardin 1322aaf473 Merge pull request #7989 from hashicorp/jbardin/tf_push
Override atlas variables even if they aren't local
2016-08-05 08:43:51 -04:00
James Bardin 67bd4f29e0 Override atlas variables even if they aren't local
Some Atlas usage patterns expect to be able to override a variable set
in Atlas, even if it's not seen in the local context. This allows
overwriting a variable that is returned from atlas, and sends it back.

Also use a unique sential value in the context where we have variables
from atlas. This way atals variables aren't combined with the local
variables, and we don't do something like inadvertantly change the type,
double encode/escape, etc.
2016-08-04 17:26:41 -04:00
James Bardin d5fbb5f5c0 Modify the tfvars test to also use a cli var
Modify the test to demonstrate where cli vars were being lost because
they weren't interpreted as strings.
2016-08-04 17:19:02 -04:00
James Bardin 9d0faa2cae Strip off extra \n in hcl encoded variables
They don't change the value, but they do currently end up in the UI
2016-08-04 17:18:43 -04:00
James Bardin bf83b435e1 numeric variables aren't always interpreted as str
If we have a number value in our config variables, format it as a
string, and send it with the HCL=true flag just in case.

Also use %g for for float encoding, as the output is a generally a
little friendlier.
2016-08-04 11:19:26 -04:00
James Bardin 1af7ee87a2 Silence log output when not verbose
Set the default log package output to iotuil.Discard during tests if the
`-v` flag isn't set. If we are verbose, then apply the filter according
to the TF_LOG env variable.
2016-08-01 17:19:14 -04:00
James Bardin 2747d964cb Merge pull request #7877 from hashicorp/jbardin/races
core: Fix race conditions, mostly around diffs
2016-07-29 18:42:31 -04:00
James Nugent 9034196baf Merge pull request #7875 from hashicorp/b-outputs-by-module
core: Fix -module for terraform output command
2016-07-29 16:40:24 -05:00
James Nugent 0e4e94a86f core: Fix -module for terraform output command
The behaviour whereby outputs for a particular nested module can be
output was broken by the changes for lists and maps. This commit
restores the previous behaviour by passing the module path into the
outputsAsString function.

We also add a new test of this since the code path for indivdual output
vs all outputs for a module has diverged.
2016-07-29 16:39:59 -05:00
James Bardin 5802f76eaa Make all terraform package tests pass under -race
This isn't a pretty refactor, but fixes the race issues in this package
for now.

Fix race on RawConfig.Config()

fix command package races
2016-07-29 16:12:21 -04:00
James Bardin 0c714592f0 Fix variable handling on subsequent pushes
The handling of remote variables was completely disabled for push.
We still need to fetch variables from atlas for push, because if the
variable is only set remotely the Input walk will still prompt the user
for a value. We add the missing remote variables to the context
to disable input.

We now only handle remote variables as atlas.TFVar and explicitly pass
around that type rather than an `interface{}`.

Shorten the text fixture slightly to make the output a little more
readable on failures.
2016-07-28 15:06:53 -04:00
James Bardin b4b70193d2 whitespace fixes 2016-07-27 12:08:59 -04:00
James Bardin 8038e60a20 Add a function to quote HCL strings
The strings we have in the variables may contain escaped double-quotes,
which have already been parsed and had the `\`s removed. We need to
re-escape these, but only if we are in the outer string and not inside an
interpolation.
2016-07-27 10:03:04 -04:00
James Bardin de87267697 Add tf_vars to the variables sent in push
Add tf_vars to the data structures sent in terraform push.

This takes any value of type []interface{} or map[string]interface{} and
marshals it as a string representation of the equivalent HCL. This
prevents ambiguity in atlas between a string that looks like a json
structure, and an actual json structure.

For the time being we will need a way to serialize data as HCL, so the
command package has an internal encodeHCL function to do so. We can
remove this if we get complete package for marshaling HCL.
2016-07-26 20:38:50 -04:00
James Nugent 681d94ae20 core: Allow lists and maps as variable overrides
Terraform 0.7 introduces lists and maps as first-class values for
variables, in addition to string values which were previously available.
However, there was previously no way to override the default value of a
list or map, and the functionality for overriding specific map keys was
broken.

Using the environment variable method for setting variable values, there
was previously no way to give a variable a value of a list or map. These
now support HCL for individual values - specifying:

    TF_VAR_test='["Hello", "World"]'

will set the variable `test` to a two-element list containing "Hello"
and "World". Specifying

    TF_VAR_test_map='{"Hello = "World", "Foo" = "bar"}'

will set the variable `test_map` to a two-element map with keys "Hello"
and "Foo", and values "World" and "bar" respectively.

The same logic is applied to `-var` flags, and the file parsed by
`-var-files` ("autoVariables").

Note that care must be taken to not run into shell expansion for `-var-`
flags and environment variables.

We also merge map keys where appropriate. The override syntax has
changed (to be noted in CHANGELOG as a breaking change), so several
tests needed their syntax updating from the old `amis.us-east-1 =
"newValue"` style to `amis = "{ "us-east-1" = "newValue"}"` style as
defined in TF-002.

In order to continue supporting the `-var "foo=bar"` type of variable
flag (which is not valid HCL), a special case error is checked after HCL
parsing fails, and the old code path runs instead.
2016-07-26 15:27:29 -05:00
James Bardin 2712328d5a Merge pull request #7756 from hashicorp/jbardin/tf-atlas-version
core: send version info to atlas
2016-07-22 10:56:43 -04:00
James Bardin 885935962c Add a terraform version header to all atlas calls
Using the DefaultHeader added to the atlas.Client
2016-07-21 11:04:27 -04:00
David Glasser 50959a654c command: Remove second DefaultDataDirectory const (#7666) 2016-07-20 23:55:05 +01:00
James Nugent 3735140286 core: Don't set variables for Atlas until lib is updated 2016-07-18 13:10:33 -05:00
James Nugent 5d18f41f04 core: Convert context vars to map[string]interface{}
This is the first step in allowing overrides of map and list variables.
We convert Context.variables to map[string]interface{} from
map[string]string and fix up all the call sites.
2016-07-18 13:02:54 -05:00
Raphael Randschau 9081cabd6e Add scaleway provider (#7331)
* Add scaleway provider

this PR allows the entire scaleway stack to be managed with terraform

example usage looks like this:

```
provider "scaleway" {
  api_key = "snap"
  organization = "snip"
}

resource "scaleway_ip" "base" {
  server = "${scaleway_server.base.id}"
}

resource "scaleway_server" "base" {
  name = "test"
  # ubuntu 14.04
  image = "aecaed73-51a5-4439-a127-6d8229847145"
  type = "C2S"
}

resource "scaleway_volume" "test" {
  name = "test"
  size_in_gb = 20
  type = "l_ssd"
}

resource "scaleway_volume_attachment" "test" {
  server = "${scaleway_server.base.id}"
  volume = "${scaleway_volume.test.id}"
}

resource "scaleway_security_group" "base" {
  name = "public"
  description = "public gateway"
}

resource "scaleway_security_group_rule" "http-ingress" {
  security_group = "${scaleway_security_group.base.id}"

  action = "accept"
  direction = "inbound"
  ip_range = "0.0.0.0/0"
  protocol = "TCP"
  port = 80
}

resource "scaleway_security_group_rule" "http-egress" {
  security_group = "${scaleway_security_group.base.id}"

  action = "accept"
  direction = "outbound"
  ip_range = "0.0.0.0/0"
  protocol = "TCP"
  port = 80
}
```

Note that volume attachments require the server to be stopped, which can lead to
downtimes of you attach new volumes to already used servers

* Update IP read to handle 404 gracefully

* Read back resource on update

* Ensure IP detachment works as expected

Sadly this is not part of the official scaleway api just yet

* Adjust detachIP helper

based on feedback from @QuentinPerez in
https://github.com/scaleway/scaleway-cli/pull/378

* Cleanup documentation

* Rename api_key to access_key

following @stack72 suggestion and rename the provider api_key for more clarity

* Make tests less chatty by using custom logger
2016-07-13 21:03:41 +01:00
James Nugent b4048dfc1d core: Add -json flag to `terraform output`
This commit removes the ability to index into complex output types using
`terraform output a_list 1` (for example), and adds a `-json` flag to
the `terraform output` command, such that the output can be piped
through a post-processor such as jq or json. This removes the need to
allow arbitrary traversal of nested structures.

It also adds tests of human readable ("normal") output with nested lists
and maps, and of the new JSON output.
2016-07-13 10:42:55 -06:00
James Nugent ef3aad1231 core: Correctly format nested outputs
This commit pretty prints outputs which consist of nested complex
structures (e.g. lists of lists, lists of maps).

Fixes #7143.
2016-07-13 09:46:07 -06:00
James Nugent 1ca51ab454 Merge pull request #7589 from hashicorp/b-data-source-plan-counts
command: Do not count data sources in plan totals
2016-07-12 11:56:31 -06:00
Derek Abdine 7bdc060d24 provider/logentries: Implementing logentries provider (#7067)
* logentries provider

* logentries vendoring

* logentries docs
2016-07-12 14:14:39 +01:00
Paul Hinze d5a941a0a4
command: Do not count data sources in plan totals
Fixes #7483
2016-07-11 17:27:56 -05:00
James Bardin b0b2923027 Merge pull request #7443 from hashicorp/jbardin/GH-7264
core: Use -state-out option when applying from a plan
2016-07-01 14:19:30 -04:00
James Bardin 6b5ee73e86 Use -state-out option when applying from a plan
When working from an existing plan, we weren't setting the PathOut field
for a LocalState. This required adding an outPath argument to the
StateFromPlan function to avoid having to introspect the returned
state.State interface to find the appropriate field.

To test we run a plan first and provide the new plan to apply with
`-state-out` set.
2016-07-01 14:18:51 -04:00
James Bardin db83a779ab Fix plan output for data sources
Data sources are given a special plan output when the diff would show it
creating a new resource, to indicate that there is only a logical data
resource being read. Data sources nested in modules weren't formatted in
the plan output in the same way.

This checks for the "data." part of the path in nested modules, and adds
acceptance tests for the plan output.
2016-06-30 15:34:43 -04:00
James Nugent b190aa05a5 core: Add missing OutputStates in synthetic state
In cases where we construct state directly rather than reading it via
the usual methods, we need to ensure that the necessary maps are
initialized correctly.
2016-06-22 17:06:41 +03:00
James Nugent aa5dc453ee cli: Fix registration of `state mv`.
Fixes #7259.
2016-06-22 11:46:38 +03:00
James Nugent 75ab4a9970 core: Fix crash with tainted resource
This commit fixes a crash in `terraform show` where there is no primary
resource, but there is a tainted resource, because of the changes made
to tainted resource handling in 0.7.
2016-06-13 09:25:21 +02:00
James Nugent 7aec98237c core: Format empty lists and maps in output
`terraform output` and it's brethren now consolidate empty maps and
lists on a single line of output instead of the pathological behaviour
of taking three lines previously. The same code paths are used across
all output mechanisms:

```
$ cat main.tf
variable "emptystring" {
    type = "string"
    default = ""
}

variable "emptylist" {
    type = "list"
    default = []
}

variable "emptymap" {
    type = "map"
    default = {}
}

output "emptystring" {
    value = "${var.emptystring}"
}

output "emptylist" {
    value = "${var.emptylist}"
}

output "emptymap" {
    value = "${var.emptymap}"
}

$ terraform apply

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

emptylist = []
emptymap = {}
emptystring =

$ terraform output
emptylist = []
emptymap = {}
emptystring =

$ terraform show

Outputs:

emptylist = []
emptymap = {}
emptystring =
```
2016-06-12 11:47:25 +02:00
Paul Hinze 1a0893ddc7
command/plan: remove -backup from help text
The `-backup` flag no longer applies since `terrafom plan` does not
write state.

Fixes #7087
2016-06-10 18:05:28 -05:00
Maxime Bury c98f391bee Add basic implementation for remote state on azure (#7064)
* Add basic implementation for remote state on azure

* Don't auto-provision the container

* Fix compilation errors

* Add factory to the remote map

* Add documentation

* Add acceptance tests
2016-06-10 19:27:57 +02:00
James Nugent c96a8d5302 core: Update `terraform show` to deal with lists
Fixes #6931.
2016-05-31 17:13:04 -05:00
Matt Morrison cbfb4d8b86 remote state: Add GCS provider for remote state 2016-05-31 13:42:57 -05:00
Chris Marchesi 9d7fb89114 core: Adding Sensitive attribute to resource schema
This an effort to address hashicorp/terraform#516.

Adding the Sensitive attribute to the resource schema, opening up the
ability for resource maintainers to mark some fields as sensitive.
Sensitive fields are hidden in the output, and, possibly in the future,
could be encrypted.
2016-05-29 22:18:44 -07:00
James Nugent 5a0f6565d3 Merge pull request #6672 from apparentlymart/random-provider
Logical Resources for Random Values
2016-05-29 11:58:42 -07:00
Sander van Harmelen d97b24e3c1
Add tests and fix last issues 2016-05-26 19:56:03 -05:00
Sander van Harmelen 8560f50cbc
Change taint behaviour to act as a normal resource
This means it’s shown correctly in a plan and takes into account any
actions that are dependant on the tainted resource and, vice verse, any
actions that the tainted resource depends on.

So this changes the behaviour from saying this resource is tainted so
just forget about it and make sure it gets deleted in the background,
to saying I want that resource to be recreated (taking into account the
existing resource and it’s place in the graph).
2016-05-26 19:55:26 -05:00
Paul Hinze aee1520ac5
core: Make refresh message explicitly point out lack of state persist
Helps make clear to users that refresh only occurs in-memory during plan

per @jen20's recommendation
2016-05-24 18:07:56 -05:00
Paul Hinze ae73aa2fb4
core: Do not persist state after plans
This makes the behavior of plans much more predictable, as they no
longer potentially have side effects on shared remote state.
2016-05-23 17:28:40 -05:00
James Nugent 28ad394264 build: Update generated internal plugin list 2016-05-20 15:05:27 -05:00
James Nugent 8e732c104b core: Error over panic if output type unknown 2016-05-18 13:25:47 -05:00
James Nugent 3ea3c657b5 core: Use OutputState in JSON instead of map
This commit forward ports the changes made for 0.6.17, in order to store
the type and sensitive flag against outputs.

It also refactors the logic of the import for V0 to V1 state, and
fixes up the call sites of the new format for outputs in V2 state.

Finally we fix up tests which did not previously set a state version
where one is required.
2016-05-18 13:25:20 -05:00
Martin Atkins 3e34ddbf38 New "random" provider, representing randomness
This provider will have logical resources that allow Terraform to "manage"
randomness as a resource, producing random numbers on create and then
retaining the outcome in the state so that it will remain consistent
until something explicitly triggers generating new values.

Managing randomness in this way allows configurations to do things like
random distributions and ids without causing "perma-diffs".
2016-05-14 15:26:38 -07:00
Martin Atkins 2ca10ad962 command: Show data source reads differently in plans
Internally a data source read is represented as a creation diff for the
resource, but in the UI we'll show it as a distinct icon and color so that
the user can more easily understand that these operations won't affect
any real infrastructure.

Unfortunately by the time we get to formatting the plan in the UI we
only have the resource names to work with, and can't get at the original
resource mode. Thus we're forced to infer the resource mode by exploiting
knowledge of the naming scheme.
2016-05-14 08:26:37 -07:00
Martin Atkins bfee4b0295 command: don't show old values for create diffs in plan
New resources logically don't have "old values" for their attributes, so
showing them as updates from the empty string is misleading and confusing.

Instead, we'll skip showing the old value in a creation diff.
2016-05-14 08:26:37 -07:00
Martin Atkins 5d27a5b3e2 command: Show id only when refreshing managed resources
Data resources don't have ids when they refresh, so we'll skip showing the
"(ID: ...)"  indicator for these. Showing it with no id makes it look
like something is broken.
2016-05-14 08:26:37 -07:00
Martin Atkins 60c24e3319 command: Prevent data resources from being tainted
Since the data resource lifecycle contains no steps to deal with tainted
instances, we must make sure that they never get created.

Doing this out in the command layer is not the best, but this is currently
the only layer that has enough information to make this decision and so
this simple solution was preferred over a more disruptive refactoring,
under the assumption that this taint functionality eventually gets
reworked in terms of StateFilter anyway.
2016-05-14 08:26:37 -07:00
Mitchell Hashimoto b728f8c018
terraform: import state ID should be sent to hook 2016-05-11 13:02:35 -07:00
Mitchell Hashimoto f6a59734ef
command: UI for import 2016-05-11 13:02:35 -07:00
Mitchell Hashimoto d6c059c43e
command/import: tests passing 2016-05-11 13:02:34 -07:00
Mitchell Hashimoto 3c9a92e04a
command: Context buliding allows empty module trees 2016-05-11 13:02:34 -07:00
Mitchell Hashimoto 182a8a28c0
command/import more wip 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto ff94381e7e
command/import wip 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto d94f503501
command/state meta: State func 2016-05-11 09:16:48 -07:00
Mitchell Hashimoto f34ef1f92a
command: compilation works
This still isn't ready. But this gets tests passing and compilation
working
2016-05-10 17:03:58 -07:00
Mitchell Hashimoto 04598baa25
website: document state mv 2016-05-10 13:25:42 -07:00
Mitchell Hashimoto c966a70ff9
command: update docs for state mv 2016-05-10 13:25:04 -07:00
Mitchell Hashimoto 32d0d29b56
command: test for moving into another state file 2016-05-10 13:25:04 -07:00
Mitchell Hashimoto 235e860118
command/state mv: handle -state-out to a different path 2016-05-10 13:25:04 -07:00
Mitchell Hashimoto c4e5355a02
command/state mv 2016-05-10 13:25:03 -07:00
James Nugent 6a20e8927d core: Fix issues from rebasing dev-0.7 onto master
- Fix sensitive outputs for lists and maps
- Fix test prelude which was missed during conflict resolution
- Fix `terraform output` to match old behaviour and not have outputs
  header and colouring
- Bump timeout on TestAtlasClient_UnresolvableConflict
2016-05-10 15:43:50 -04:00
James Nugent 9d77e0af6c core: Add new providers to internal list 2016-05-10 14:49:14 -04:00
Mitchell Hashimoto 473a58a672 Add `terraform state list` command
This introduces the terraform state list command to list the resources
within a state. This is the first of many state management commands to
come into 0.7.

This is the first command of many to come that is considered a
"plumbing" command within Terraform (see "plumbing vs porcelain":
http://git.661346.n2.nabble.com/what-are-plumbing-and-porcelain-td2190639.html).
As such, this PR also introduces a bunch of groundwork to support
plumbing commands.

The main changes:

- Main command output is changed to split "common" and "uncommon"
  commands.

- mitchellh/cli is updated to support nested subcommands, since
  terraform state list is a nested subcommand.

- terraform.StateFilter is introduced as a way in core to filter/search
  the state files. This is very basic currently but I expect to make it
  more advanced as time goes on.

- terraform state list command is introduced to list resources in a
  state. This can take a series of arguments to filter this down.

Known issues, or things that aren't done in this PR on purpose:

- Unit tests for terraform state list are on the way. Unit tests for the
  core changes are all there.
2016-05-10 14:49:14 -04:00
Chris Bednarski e942a74def Set a log prefix for each plugin and remove go-dynect global log prefix (#6336) 2016-05-10 14:49:13 -04:00
James Nugent 991dc3f86f core: Add Cobbler provider to internal plugin list 2016-05-10 14:49:13 -04:00
James Nugent e57a399d71 core: Use native HIL maps instead of flatmaps
This changes the representation of maps in the interpolator from the
dotted flatmap form of a string variable named "var.variablename.key"
per map element to use native HIL maps instead.

This involves porting some of the interpolation functions in order to
keep the tests green, and adding support for map outputs.

There is one backwards incompatibility: as a result of an implementation
detail of maps, one could access an indexed map variable using the
syntax "${var.variablename.key}".

This is no longer possible - instead HIL native syntax -
"${var.variablename["key"]}" must be used. This was previously
documented, (though not heavily used) so it must be noted as a backward
compatibility issue for Terraform 0.7.
2016-05-10 14:49:13 -04:00
James Nugent 6aac79e194 state: Add support for outputs of multiple types
This commit adds the groundwork for supporting module outputs of types
other than string. In order to do so, the state version is increased
from 1 to 2 (though the "public-facing" state version is actually as the
first state file was binary).

Tests are added to ensure that V2 (1) state is upgraded to V3 (2) state,
though no separate read path is required since the V2 JSON will
unmarshal correctly into the V3 structure.

Outputs in a ModuleState are now of type map[string]interface{}, and a
test covers round-tripping string, []string and map[string]string, which
should cover all of the types in question.

Type switches have been added where necessary to deal with the
interface{} value, but they currently default to panicking when the input
is not a string.
2016-05-10 14:40:12 -04:00
Chris Bednarski 6360e6c8b6 Implemented internal plugin calls; which allows us to compile plugins into the main terraform binary 2016-05-10 14:40:11 -04:00
Mitchell Hashimoto 35c87836b4 core: Add terraform_version to state
This adds a field terraform_version to the state that represents the
Terraform version that wrote that state. If Terraform encounters a state
written by a future version, it will error. You must use at least the
version that wrote that state.

Internally we have fields to override this behavior (StateFutureAllowed),
but I chose not to expose them as CLI flags, since the user can just
modify the state directly. This is tricky, but should be tricky to
represent the horrible disaster that can happen by enabling it.

We didn't have to bump the state format version since the absense of the
field means it was written by version "0.0.0" which will always be
older. In effect though this change will always apply to version 2 of
the state since it appears in 0.7 which bumped the version for other
purposes.
2016-05-10 14:40:11 -04:00
Mitchell Hashimoto e133452663 command/state: pattern => address 2016-05-10 14:14:48 -04:00
Mitchell Hashimoto 5737c0a13b website: update docs for state show 2016-05-10 14:14:48 -04:00
Mitchell Hashimoto f6692e66ac add command/state show 2016-05-10 14:14:47 -04:00
Mitchell Hashimoto d1b46e99bd Add `terraform state list` command
This introduces the terraform state list command to list the resources
within a state. This is the first of many state management commands to
come into 0.7.

This is the first command of many to come that is considered a
"plumbing" command within Terraform (see "plumbing vs porcelain":
http://git.661346.n2.nabble.com/what-are-plumbing-and-porcelain-td2190639.html).
As such, this PR also introduces a bunch of groundwork to support
plumbing commands.

The main changes:

- Main command output is changed to split "common" and "uncommon"
  commands.

- mitchellh/cli is updated to support nested subcommands, since
  terraform state list is a nested subcommand.

- terraform.StateFilter is introduced as a way in core to filter/search
  the state files. This is very basic currently but I expect to make it
  more advanced as time goes on.

- terraform state list command is introduced to list resources in a
  state. This can take a series of arguments to filter this down.

Known issues, or things that aren't done in this PR on purpose:

- Unit tests for terraform state list are on the way. Unit tests for the
  core changes are all there.
2016-05-10 14:14:47 -04:00
James Nugent b62f6af158 core: Add support for marking outputs as sensitive (#6559)
* core: Add support for marking outputs as sensitive

This commit allows an output to be marked "sensitive", in which case the
value is redacted in the post-refresh and post-apply list of outputs.

For example, the configuration:

```
variable "input" {
    default = "Hello world"
}

output "notsensitive" {
    value = "${var.input}"
}

output "sensitive" {
    sensitive = true
    value = "${var.input}"
}
```

Would result in the output:

```
terraform apply

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

  notsensitive = Hello world
  sensitive    = <sensitive>
```

The `terraform output` command continues to display the value as before.

Limitations: Note that sensitivity is not tracked internally, so if the
output is interpolated in another module into a resource, the value will
be displayed. The value is still present in the state.
2016-05-09 15:46:07 -04:00
Dan Carley 64c1280951 command/fmt: Improve documentation for -diff and defaults (#6398)
* command/fmt: Document -diff doesn't disable -write

As noted in hashicorp/terraform#6343, this description misleadingly
suggested that the `-diff` option disables the `-write` option.

This isn't the case and because of the default options (described in
c753390) the behaviour of `terraform fmt -diff` is actually the same as
`terraform fmt -write -list -diff`.

Replace the "instead of rewriting" description to clarify that.

Documentation in hcl/fmtcmd is corrected in hashicorp/hcl#117 but it's not
really necessary to bump the dependency version.

* command/fmt: Show flag defaults in help text

These were documented on the website but not in the `-help` text. This
should help to clarify that you need to pass `-list=false -write=false
-diff` if you only want to see diffs.

Accordingly I've replaced the word "disabled" with "always false" in the
STDIN special cases so that it matches the terminology used in the defaults
and better indicates that it is overridden.

NB: The 3x duplicated defaults and documentation makes me feel uneasy once
again. I'm not sure how to solve that, though.
2016-04-29 00:39:53 +01:00
Paul Hinze c74c5fe7f0
Update HCL to latest, unskip fmt tests
See https://github.com/hashicorp/hcl/pull/115
2016-04-27 07:37:47 -05:00
Paul Hinze ac10a7979d
command/fmt tests: temporarily skip newline failures
Skipping tests to get the master build green while I sort out these
failing tests.

They should be fixed for real in just a few here.
2016-04-26 15:26:16 -05:00
Mitchell Hashimoto 08ad84d8b2 command: defer the lock unlock 2016-04-13 12:02:24 -07:00
Mitchell Hashimoto 284bc92c04 command: show periodic messages about continued ops 2016-04-13 11:12:05 -07:00
David Glasser b44f7f28e0 Document saved plan use in `terraform apply -help` (#6126)
Wording borrowed from the website docs.
2016-04-11 12:24:08 -05:00
David Glasser 320773d6c1 command: delete unused class 2016-04-05 18:42:09 -07:00
Martin Atkins fa703db8a6 Merge #4955: "terraform fmt" command 2016-04-04 01:07:32 -07:00
Paul Hinze c7f5450a96 command: Add `terraform untaint`
- [x] Docs
 - [x] Command Unit Tests
 - [x] State Unit Tests

Closes #4820
2016-03-11 12:38:57 -06:00
Dan Carley d883b76070 command/fmt: Test non-default options
To ensure that these are passed over to `fmtcmd` correctly.
2016-03-07 15:07:15 +00:00
Dan Carley 79e2753e41 command/fmt: Disable list/write when using STDIN
These options don't make sense when passing STDIN. `-write` will raise an
error because there is no file to write to. `-list` will always say
`<standard input>`. So disable whenever using STDIN, making the command
much simpler:

    cat main.tf | terraform fmt -
2016-03-07 15:07:15 +00:00
Dan Carley e9128769b5 command/fmt: Accept input from STDIN
So that you can do automatic formatting from an editor. You probably want to
disable the `-write` and `-list` options so that you just get the
re-formatted content, e.g.

    cat main.tf | terraform fmt -write=false -list=false -

I've added a non-exported field called `input` so that we can override this
for the tests. If not specified, like in `commands.go`, then it will default
to `os.Stdin` which works on the command line.
2016-03-07 15:07:15 +00:00
Dan Carley 1b967e612f command/fmt: Accept optional directory argument
So that you can operate on files in a directory other than your current
working directory.
2016-03-07 15:07:14 +00:00
Dan Carley c753390399 command/fmt: Default write and list to true
The most common usage usage will be enabling the `-write` and `-list`
options so that files are updated in place and a list of any modified files
is printed. This matches the default behaviour of `go fmt` (not `gofmt`). So
enable these options by default.

This does mean that you will have to explicitly disable these if you want to
generate valid patches, e.g. `terraform fmt -diff -write=false -list=false`
2016-03-07 15:07:14 +00:00
Dan Carley cc41c7cfa0 command/fmt: Add new fmt command
This uses the `fmtcmd` package which has recently been merged into HCL. Per
the usage text, this rewrites Terraform config files to their canonical
formatting and style.

Some notes about the implementation for this initial commit:

- all of the fmtcmd options are exposed as CLI flags
- it operates on all files that have a `.tf` suffix
- it currently only operates on the working directory and doesn't accept a
  directory argument, but I'll extend this in subsequent commits
- output is proxied through `cli.UiWriter` so that we write in the same way
  as other commands and we can capture the output during tests
- the test uses a very simple fixture just to ensure that it is working
  correctly end-to-end; the fmtcmd package has more exhaustive tests
- we have to write the fixture to a file in a temporary directory because it
  will be modified and for this reason it was easier to define the fixture
  contents as a raw string
2016-03-07 15:07:04 +00:00
James Nugent b787fe2798 Merge pull request #5012 from jrnt30/TF-5011-Backend-flag-normalization
Fixes #5011 - Backend downcased for init
2016-02-08 17:59:20 -05:00
stack72 1628f19bc1 Fixing some golint issues on the new validate command 2016-02-08 22:04:24 +00:00
Soren Mathiasen db69a2959b Added verify command 2016-02-08 12:48:14 +01:00
Justin Nauman 61240b4250 Fixes #5011 - Backend downcased for init 2016-02-05 06:26:12 -06:00
Paul Hinze 4a51e4fe91 core: write planfile even on empty plans
This makes the planfile workflow more consistent. If a plan yields a
noop, the apply of that planfile will noop.

Fixes #1783
2016-01-20 16:00:20 -06:00
Paul Hinze e67fc0fe9b command: Change module-depth default to -1
This means that terraform commands like `plan`, `apply`, `show`, and
`graph` will expand all modules by default.

While modules-as-black-boxes is still very true in the conceptual design
of modules, feedback on this behavior has consistently suggested that
users would prefer to see more verbose output by default.

The `-module-depth` flag and env var are retained to allow output to be
optionally limited / summarized by these commands.
2016-01-20 13:58:02 -06:00
Mitchell Hashimoto 6a972a7713 command/init: put remote state config at proper path [GH-2927] 2016-01-19 17:13:19 -08:00
James Nugent a5e51f6dad command/refresh: Fix import formats to prevent flapping 2015-11-27 15:10:42 +00:00
Paul Hinze 0e277a6714 core: test coverage around map key regression
tests to cover the HCL-level issue fixed in
https://github.com/hashicorp/hcl/pull/65
2015-11-24 16:00:02 -06:00
James Nugent 50b5e7c1a5 Validate context after input of vars on refresh
Fixes #4013.
2015-11-23 10:33:40 +02:00
James Nugent 890e214c00 Add failing test replicating #4013 2015-11-23 10:32:46 +02:00
Jake Champlin 39e7f42490 Clear up `destroy --target` message
When destroying infrastructure with `--target`, print out which
infrastructure will be destroyed instead of saying `Terraform will
delete all your managed infrastructure`.

```
 terraform destroy --target aws_instance.test2 --target aws_instance.test1
Do you really want to destroy?
  Terraform will delete the following infrastructure:
        aws_instance.test2
        aws_instance.test1
  There is no undo. Only 'yes' will be accepted to confirm
```

Omitting `--target` arguments will use the default input description.

```
$ terraform destroy
Do you really want to destroy?
  Terraform will delete all your managed infrastructure.
  There is no undo. Only 'yes' will be accepted to confirm.
```
2015-11-11 12:04:58 -05:00
James Nugent a49b162dd1 Prompt for input variables before context validate
Also adds a regression test using Mock UI. Fixes #3767.
2015-11-10 14:03:56 -05:00
James Nugent f4c03ec2a6 Reflect new comment format in stringer.go
As of November 8th 2015, (4b07c5ce8a), the word "Code" is prepended to
the comments in Go source files generated by the stringer utility.
2015-11-09 11:38:51 -05:00
Paul Hinze 9428e9f1d1 command: fix failing TestPlan_noState test
Turns out that isolating statefiles in the Apply tests is an important
step to prevent leaking .tfstate in a common dir, which can affect other
tests.
2015-10-29 18:07:44 -05:00
Paul Hinze 715437537d command: fix flaky parallelism tests
Thanks to @mitchellh for helping sort out concurrency stuff here.
2015-10-29 15:16:34 -05:00
John Gosset 61e890ecc9 Update list of backends in RemoteConfigCommand's Help() method 2015-10-25 16:46:02 -04:00
Martin Atkins e4e9c13c20 Merge #3136: Colorize the 'forces new resource' message 2015-10-22 08:44:37 -07:00
Mitchell Hashimoto 344e7c26b5 fix a bunch of tests from go-getter import 2015-10-15 13:48:58 -07:00
Panagiotis Moustafellos e4845f75cc removed extra parentheses 2015-10-08 15:48:04 +03:00
Paul Hinze 374070d066 website: docs for parallelism setting
/cc @stack72 @knuckolls @mitchellh
2015-10-05 17:21:29 -05:00
Paul Hinze e1a46904d6 command: pull parallelism default up to CLI layer
/cc @knuckolls @josephholsten
2015-10-05 15:06:08 -05:00
Kevin Nuckolls bf9c5c46d0 Tests for apply parallelism=1 and parallelism=2 2015-09-29 22:41:26 -07:00
Kevin Nuckolls fc60b2858c Added -parallelism to refresh and plan cli UI 2015-09-29 22:41:26 -07:00
Kevin Nuckolls f59c71b35a works for apply, no tests yet 2015-09-29 22:41:26 -07:00
Radek Simko 57bea9f26c Merge pull request #3223 from scalp42/typos
remove various typos
2015-09-14 07:48:59 +01:00
Mitchell Hashimoto 4d37704d53 command/get: fix typo 2015-09-13 14:40:36 -07:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Martin Atkins 7c56550633 In plan summary, be more honest about force-new changes.
Previously the plan summary output would consider -/+ diffs as changes
even though they actually destroy and create instances. This was
misleadning and inconsistent with the accounting that gets done for the
similar summary written out after "apply".

Instead we now count the -/+ diffs as both adds and removes, which should
mean that the counts output in the plan summary should match those in
the apply summary, as long as no errors occur during apply.

This fixes #3163.
2015-09-04 08:07:16 -07:00
Sharif Nassar 2e51915431 Colorize the 'forces new resource' message.
Sometimes in all the output from ```terraform plan```, it is difficult
to see the ```(forces new resource)``` message.
This patch adds a little bit of color.
2015-08-31 15:37:09 -07:00
Paul Hinze 5a12608dc3 tests: remove unnecessary symlink 2015-08-31 15:45:43 -05:00
Radek Simko 9596271b36 Code formatted via gofmt 2015-08-14 12:02:32 +01:00
Radek Simko 10f04c90a5 'terraform output' helptext spacing fixed 2015-08-14 12:01:58 +01:00
Radek Simko 382c0ba23d command/output: Update test since we now allow printing everything 2015-08-03 12:44:41 +01:00
Eric Connell 85d1d15d81 output command supports printing all outputs
if no output name is specified all outputs are displayed
fixed formating and added missing help for -module parameter
2015-08-03 12:22:40 +01:00
Radek Simko 7a60174dd1 Do not print errors via UiHook 2015-07-22 14:09:23 +02:00
Sander van Harmelen 4a8ef78d33 Fixes #2676 by prefixing all Windows commands
By prefixing them with `cmd /c` it will work with both `winner` and
`ssh` connection types.

This PR also reverts some bad stringer changes made in PR #2673
2015-07-10 12:56:27 +02:00
Sander van Harmelen 97fd4f5b7d Tweaking the tests 2015-07-09 21:29:27 +02:00