Commit Graph

129 Commits

Author SHA1 Message Date
Radek Simko 8494cad8c4 Output 'destroy complete' when it's destroy (was: apply) (#8453) 2016-08-25 22:26:40 +01: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 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
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 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 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
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
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
Mitchell Hashimoto 344e7c26b5 fix a bunch of tests from go-getter import 2015-10-15 13:48:58 -07: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 f59c71b35a works for apply, no tests yet 2015-09-29 22:41:26 -07:00
Anthony Scalisi 198e1a5186 remove various typos 2015-09-11 11:56:20 -07:00
Paul Hinze ad680b1832 core: show outputs after `terraform refresh`
closes #25
2015-06-15 10:41:42 -05:00
Paul Hinze 18924d24fe command/apply: flatten multierrors
Before:

```
Error applying plan:

1 error(s) occurred:

* 1 error(s) occurred:

* 1 error(s) occurred:

* 1 error(s) occurred:

* Error creating ...
```

After:

```
Error applying plan:

1 error(s) occurred:

* Error creating ...
```

Muuuch better! :D
2015-06-07 21:32:00 -05:00
Paul Hinze 97acccd3ed core: targeted operations
Add `-target=resource` flag to core operations, allowing users to
target specific resources in their infrastructure. When `-target` is
used, the operation will only apply to that resource and its
dependencies.

The calculated dependencies are different depending on whether we're
running a normal operation or a `terraform destroy`.

Generally, "dependencies" refers to ancestors: resources falling
_before_ the target in the graph, because their changes are required to
accurately act on the target.

For destroys, "dependencies" are descendents: those resources which fall
_after_ the target. These resources depend on our target, which is going
to be destroyed, so they should also be destroyed.
2015-03-31 14:49:38 -05:00
Mitchell Hashimoto 95cf69aa32 command: StateHook for continous state updates 2015-02-23 21:57:17 -08:00
Mitchell Hashimoto fb3f10efb0 command/apply: ask for user variables before validation [GH-736] 2015-01-16 10:46:38 -08:00
Mitchell Hashimoto 90138825a2 command/apply: don't init if no args given [GH-780]
I really don't know how to unit test this since I don't know what input
triggers this except that it has been reporting a few times in the wild.
2015-01-16 10:22:20 -08:00
Armon Dadgar 0fb87e499d command: Meta provides the state output path 2014-12-10 13:27:09 -08:00
Armon Dadgar bf10111745 command/apply: Move state persistence to Meta 2014-12-10 13:27:09 -08:00
Armon Dadgar 5b745e5d46 command: Run validation before asking for input. Fixes #602 2014-12-08 18:32:03 -08:00
Panagiotis Moustafellos 3d51bae4b2 switch phrasing 2014-10-15 18:57:24 +03:00
Panagiotis Moustafellos 08515edc43 fixed typo on terraform destroy 2014-10-15 11:17:56 +03:00
Mitchell Hashimoto 8fc134caa1 command/destroy: don't show outputs 2014-10-11 17:37:28 -07:00
Mitchell Hashimoto 0914e17a2a command/apply: more than one ctrl-c properly exits immediately 2014-10-11 13:23:15 -07:00
Mitchell Hashimoto 16b023bd2b command: ask for the proper level of input 2014-10-08 10:29:54 -07:00
Mitchell Hashimoto a5f70ead2d command: destroy should ask for confirmation always 2014-10-03 16:08:50 -07:00
Mitchell Hashimoto 95f43d8230 command/apply: if with plan, don't ask for input [GH-346] 2014-10-01 08:43:00 -07:00
Mitchell Hashimoto 817f0d9f30 command: don't ask for input if terraform.tfvars file given [GH-346] 2014-10-01 08:37:57 -07:00
Mitchell Hashimoto 2131e4ffd2 command: fix failing tests 2014-09-30 22:11:55 -07:00
Mitchell Hashimoto 245c1ce05a command: enable destroy 2014-09-30 22:01:11 -07:00
Mitchell Hashimoto ab9dd71bcb command/destroy: first steps 2014-09-30 21:49:24 -07:00
Mitchell Hashimoto 260c5301e6 command/apply: update usage 2014-09-29 15:57:35 -07:00
Mitchell Hashimoto 3572b8ff2f command/apply: allow `terraform apply SOURCE` as shortcut for init 2014-09-29 15:55:28 -07:00
Mitchell Hashimoto 63453f3f1a command: apply and refresh ask for input 2014-09-29 12:46:58 -07:00
Mitchell Hashimoto ed538a9594 command: Get command, not functional yet. Converted to use modules. 2014-09-22 10:56:50 -07:00
Mitchell Hashimoto cdad3036ae command: closer to compiling 2014-09-17 11:15:07 -07:00
AJ Bourg aefa4b2399 expacts -> expects. (minor) 2014-09-04 16:33:05 -06:00
Alex Gaynor 46154ca1d3 Fixed a ton of typos in docs and comments 2014-08-07 00:19:56 -07:00
Mitchell Hashimoto 642fed0356 command: terraform.tfvars loaded by default if it exists 2014-08-05 09:32:01 -07:00
Mitchell Hashimoto b172f45b94 command: make state unexported on Meta 2014-07-27 22:58:35 -07:00
Mitchell Hashimoto 80ce9ad513 command: f.Close instead of defer 2014-07-27 22:56:55 -07:00
Armon Dadgar 16ef3f5733 command: Testing the -backup feature 2014-07-27 23:38:41 -04:00
Armon Dadgar 54cc66367d command: Adding backup of state file 2014-07-27 18:09:04 -04:00
Mitchell Hashimoto 9759606989 command/apply: check if state non-nil for interrupt 2014-07-26 21:28:42 -07:00
Mitchell Hashimoto 0f45ebbdc3 command: better UI for showing completion of steps 2014-07-26 21:20:31 -07:00
Mitchell Hashimoto 795142c43c command/apply: -refresh flag 2014-07-26 17:51:16 -07:00
Mitchell Hashimoto ef6fba754d command: refactor so Context never plans 2014-07-26 17:51:15 -07:00
Mitchell Hashimoto 82e7d58250 command/apply: -init is gone
/cc @pearkes - hurray!
2014-07-26 14:44:05 -07:00
Mitchell Hashimoto 3534470ca3 command: -var flag works 2014-07-18 11:37:27 -07:00
Mitchell Hashimoto f78f97647a command/apply: clearer that in error state is updated 2014-07-17 15:18:00 -07:00
Mitchell Hashimoto ba4435f99c command/apply: show add/remove/change count for apply 2014-07-17 15:14:45 -07:00
Mitchell Hashimoto 6c8c09c784 command/*: only Plan on the Apply 2014-07-14 11:48:03 -07:00
Mitchell Hashimoto 52d29a6ecf command/apply: outputs 2014-07-13 09:34:35 -07:00
Mitchell Hashimoto 4bc00fa047 command/apply: cleaner output 2014-07-13 09:20:27 -07:00
Mitchell Hashimoto 9b090a5505 command/apply: use new state formatting 2014-07-12 21:02:53 -07:00
Mitchell Hashimoto 3a851bece0 command: convert all to use the new Meta thing 2014-07-12 20:37:30 -07:00
Mitchell Hashimoto 6c736bd3c4 command: introduce Meta and "-no-color" option 2014-07-12 20:21:46 -07:00
Mitchell Hashimoto c615afc097 command/apply: improved output, still not done 2014-07-12 17:03:55 -07:00
Mitchell Hashimoto 2c77837a64 command/apply: optional arg, default to pwd for config dir 2014-07-11 21:32:34 -07:00
Mitchell Hashimoto abc6df2a7d command/apply: default state path, only one optional arg 2014-07-11 21:30:40 -07:00
Mitchell Hashimoto 6a7e3668a2 command: apply saves state even if error occurs 2014-07-07 21:20:48 -07:00
Mitchell Hashimoto 43889a8c59 command: validate context 2014-07-03 13:12:45 -07:00
Mitchell Hashimoto a6ae7230d1 command: use new API 2014-07-03 11:46:40 -07:00
Mitchell Hashimoto 5608175c13 command: fix build 2014-07-02 19:45:00 -07:00
Mitchell Hashimoto 5aa6ada589 command/apply: Ctrl-C works 2014-07-02 17:01:02 -07:00
Mitchell Hashimoto 93fbb9ea8f command/graph 2014-07-01 10:02:13 -07:00
Mitchell Hashimoto 5c836ab861 terraform: PlanOpts for expanding plan configuration 2014-06-28 13:10:11 -07:00
Mitchell Hashimoto fe79e5df03 command/apply: can take a plan as an argument 2014-06-27 14:43:33 -07:00
Mitchell Hashimoto 6b765328c2 command: UI in Apply 2014-06-26 22:13:54 -07:00
Mitchell Hashimoto d64ba66edb command: adhere to new API 2014-06-25 18:22:42 -07:00
Mitchell Hashimoto 84cf644a30 command: apply uses the new plan structure 2014-06-20 12:51:42 -07:00
Mitchell Hashimoto bff4b8a58c command: plan 2014-06-20 11:47:02 -07:00
Mitchell Hashimoto 344fd805f4 command/apply: fail if state doesn't exist and no -init 2014-06-19 12:17:56 -07:00
Mitchell Hashimoto d4994b5d44 command/apply: read existing state 2014-06-19 12:12:24 -07:00
Mitchell Hashimoto 82af81b606 command: tests for apply 2014-06-18 21:36:44 -07:00
Mitchell Hashimoto 8aa99687c3 command/apply: basic implementation 2014-06-18 16:42:13 -07:00
Mitchell Hashimoto 046e80361b commands: start apply 2014-05-24 12:27:58 -07:00