Commit Graph

689 Commits

Author SHA1 Message Date
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
Radek Simko e376f61d1d core: Return correct number of planned updates 2015-07-03 13:22:10 +02:00
Mitchell Hashimoto 1f92dd5b40 command/push: update output 2015-06-29 13:58:54 -07:00
Mitchell Hashimoto c5d3c585c6 command/push: update var name 2015-06-29 13:57:58 -07:00
Mitchell Hashimoto 9d9bcc2f6e command/push: update flag to -overwrite, update docs 2015-06-29 13:53:05 -07:00
Mitchell Hashimoto 8ee3281858 command/push: UX 2015-06-29 13:41:07 -07:00
Mitchell Hashimoto dc40f044f0 command/push: prefer Atlas over local, add -set flag 2015-06-29 12:24:13 -07:00
Mitchell Hashimoto 8ebdc1e786 terraform: orphans should call post-apply hook [GH-1938] 2015-06-25 20:11:29 -07:00
Mitchell Hashimoto a76105b0f1 command: make error message clearer for invalid tfvars format [GH-1889] 2015-06-25 17:56:37 -07:00
Mitchell Hashimoto 96b53cc06c command: ask for input even if tfvars is set [GH-2161] 2015-06-25 15:29:46 -07:00
Radek Simko b505d15e1e Add resource sums to terraform plan
- closes #2355
2015-06-25 10:25:16 +01:00
Paul Hinze 3f2119c6e7 Merge pull request #2414 from TimeIncOSS/no-color-for-subcommands
Add -no-color option for subcommands
2015-06-23 15:43:37 -05:00
Paul Hinze 74fb179127 Merge pull request #2371 from hashicorp/b-fix-tf-show-with-remote-state
core: fix `terraform show` with remote state
2015-06-23 15:01:10 -05:00
Radek Simko b7d41d2eed Add -no-color to help text 2015-06-22 13:14:01 +01:00
Radek Simko cdcd11419e Add -no-color option for subcommands 2015-06-21 21:52:11 +01:00
Paul Hinze cb5c2567b3 core: fix `terraform show` with remote state
fixes #1810
2015-06-16 12:26:04 -05: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 aa39dc71de command/output: fix error msg typo 2015-06-03 09:24:20 -05:00
Kirill Shirinkin b05e36a6e3 Add module outputs 2015-05-27 16:46:12 +02:00
Mitchell Hashimoto 77a61157fb command/push: var/var-file supported, note in help [GH-1950] 2015-05-13 20:18:40 -07:00
Paul Hinze 8ce3e1d5b4 command/push: local vars override remote ones
Otherwise once you push a variable it becomes very difficult to change.
2015-05-08 18:54:38 -05:00
Andrew Langhorn bb4f7415ca Rename "The The" so that they can play songs again
Other than the fact that "The the" doesn't really make any sense anywhere
that it's used in Terraform, they're a post-punk band from the UK.

Fixes "The The" so that they can get back to playing songs.
2015-05-06 22:53:11 +01:00
Paul Hinze 29d34cd5a4 command: allow module depth to be set via env var
Another convienence env var here with TF_MODULE_DEPTH.

Works like you'd expect it to!
2015-04-30 16:19:43 -05:00
Paul Hinze d30d88e327 Merge pull request #1655 from hashicorp/f-build-graph-during-plan
core: validate on verbose graph to detect some cycles earlier
2015-04-30 16:08:33 -05:00
Paul Hinze 5f1ea7fccc command: add env var equivalent to -input arg
Setting TF_INPUT has the equivalent effect of setting the flag.
I got sick of specifying this when iterating on TF config locally.
2015-04-30 09:59:14 -05:00
Luke Amdor b08ba78341 adding new AskSecret to ColorizeUi 2015-04-29 13:07:13 -05:00
Paul Hinze ce49dd6080 core: graph command gets -verbose and -draw-cycles
When you specify `-verbose` you'll get the whole graph of operations,
which gives a better idea of the operations terraform performs and in
what order.

The DOT graph is now generated with a small internal library instead of
simple string building. This allows us to ensure the graph generation is
as consistent as possible, among other benefits.

We set `newrank = true` in the graph, which I've found does just as good
a job organizing things visually as manually attempting to rank the nodes
based on depth.

This also fixes `-module-depth`, which was broken post-AST refector.
Modules are now expanded into subgraphs with labels and borders. We
have yet to regain the plan graphing functionality, so I removed that
from the docs for now.

Finally, if `-draw-cycles` is added, extra colored edges will be drawn
to indicate the path of any cycles detected in the graph.

A notable implementation change included here is that
{Reverse,}DepthFirstWalk has been made deterministic. (Before it was
dependent on `map` ordering.) This turned out to be unnecessary to gain
determinism in the final DOT-level implementation, but it seemed
a desirable enough of a property that I left it in.
2015-04-27 09:23:47 -05:00
Paul Hinze d4b9362518 core: validate on verbose graph to detect some cycles earlier
Most CBD-related cycles include destroy nodes, and destroy nodes were
all being pruned from the graph before staring the Validate walk.

In practice this meant that we had scenarios that would error out with
graph cycles on Apply that _seemed_ fine during Plan.

This introduces a Verbose option to the GraphBuilder that tells it to
generate a "worst-case" graph. Validate sets this to true so that cycle
errors will always trigger at this step if they're going to happen.

(This Verbose option will be exposed as a CLI flag to `terraform graph`
in a second incoming PR.)

refs #1651
2015-04-23 11:07:13 -05:00
Mitchell Hashimoto e91b5136bf Merge pull request #1356 from koendc/b-remote-plugin-case
command/state: fix for state files containing an upper case remote type
2015-04-14 08:34:28 -07:00
Paul Hinze a2cb77058c command: fix push tests when running outside repo
VCS detection was on by default, and blows up when the tests are run in
a copy of the Terraform source that is not a git repository, like - say
- during a Homebrew formula install, just to pick a random example. :)
2015-04-09 18:46:25 -05:00
Mitchell Hashimoto 650a9f372b command: implement proper module.Storage interface 2015-04-07 16:46:56 -07:00
Mitchell Hashimoto 000d28c489 command/push: read terraform.tfvars 2015-04-07 15:34:06 -07:00
Mitchell Hashimoto 1fac7b6488 state: cache should use State.Equal to check equality
reflect.DeepEqual was returning false, sometimes.
2015-04-07 15:03:04 -07:00
Koen De Causmaecker 428fd98ba0 Handles upper case characters in the cached state file's remote type
If the cached state file contains a remote type field with upper case
characters, eg 'Consul', it was no longer possible to find the 'consul'
remote plugin.
2015-04-01 21:42:39 +02:00
Ryan Uber 9a091ffa78 command: plan supports detailed exit code 2015-04-01 09:38:19 -07: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 da7f307e56 command/remote-config: failing tests 2015-03-26 18:14:24 -07:00
Mitchell Hashimoto 4a7b554cf7 command/remote-config: do a pull with `terraform remote config` 2015-03-26 17:57:45 -07:00
Mitchell Hashimoto 6379a888fb command/remote-{pull,push}: colorize and show success output 2015-03-26 17:40:39 -07:00
Mitchell Hashimoto 38b1a727bf command/remote-config: lowercase the type so that Atlas works, for
example
2015-03-26 17:37:05 -07:00
Mitchell Hashimoto 7bfa5afd00 command/remote-config: show flag parse errors
/cc @sethvargo
2015-03-26 17:33:58 -07:00
Mitchell Hashimoto 35da19cc1f command/remote-config: remove weird error case that shows no error
message

/cc @sethvargo
2015-03-26 17:31:50 -07:00
Seth Vargo 1adb3fbfa0 command: when setting up state, only write back if local is newer 2015-03-26 17:16:54 -07:00
Mitchell Hashimoto 83cb277583 command/output: don't panic if no root module in state [GH-1263] 2015-03-25 16:35:27 -07:00
Mitchell Hashimoto 431f5e6706 command/remote-config: syntax 2015-03-25 15:26:38 -07:00
Mitchell Hashimoto 2796f83950 command/remote-config: make the error message nicer for remote init
/cc @sethvargo - based on UX issues you ran into yesterday
2015-03-25 15:23:04 -07:00
Mitchell Hashimoto 280635d2b0 command/push: add -atlas-address 2015-03-24 17:45:19 -07:00
Mitchell Hashimoto 51614b6365 command/push: upload-modules 2015-03-24 17:42:40 -07:00
Mitchell Hashimoto 8d47f26bb7 command/push: address PR comments 2015-03-24 17:41:26 -07:00
Mitchell Hashimoto 0229852e48 command/push: change wording on error message 2015-03-24 17:39:37 -07:00
Mitchell Hashimoto 395dd04861 command/push: accept -vcs 2015-03-24 17:03:59 -07:00
Mitchell Hashimoto 86f92119e2 command/push: no version on GET should be okay 2015-03-24 13:59:13 -07:00
Mitchell Hashimoto 19c1771438 command/push: integrate atlas push client 2015-03-24 13:42:48 -07:00
Mitchell Hashimoto 1c0ffbd7bf command/push: output the name/version of the pushed configuration 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto ee1ad49829 command/push: rename -module-lock to -module-upload 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto da46e16f4f command/push: can set the name on the CLI 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto 5e27bfc040 command/push: read name from the config 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto 9062bfda89 command/meta: fix test 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto eebd7b8aa3 command/push: ask for only variables that are unset 2015-03-24 13:30:23 -07:00
Mitchell Hashimoto bf14143369 command/push: test that input is asked 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto d37d9ea6ef command/push: send the context variables up 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto a1b424d53f command/push: properly copy the data directory no matter what 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto 22087181af command/push: archive, upload 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto ca8e2085f3 command/push: archiving 2015-03-24 13:30:22 -07:00
Mitchell Hashimoto c4dc9af120 command: add DataDir 2015-03-24 13:30:21 -07:00
Mitchell Hashimoto cdde9149ff command/push: start it 2015-03-24 13:30:21 -07:00
Paul Hinze 4fc5ebf47e command: warnings should not exit
also properly colorize error/warnings

depends on https://github.com/mitchellh/cli/pull/15
2015-03-05 14:22:34 -06:00
Mitchell Hashimoto 89e7438f0f command/remote 2015-03-04 16:25:11 -08:00
Mitchell Hashimoto 01cd761023 command: move remote configuration stuff 2015-03-04 16:17:30 -08:00
Mitchell Hashimoto 71315076c3 command: autoload terraform.tfvars.json as well [GH-1030] 2015-03-02 09:22:28 -08:00
Mitchell Hashimoto 8e76a02a56 command: disable backup with "-" [GH-1072]
/cc @phinze
2015-03-02 09:11:49 -08:00
Mitchell Hashimoto 6f9a358cc4 command/taint: fix comment 2015-02-26 14:30:02 -08:00
Mitchell Hashimoto d411e2939f command/taint: -allow-missing 2015-02-26 10:56:45 -08:00
Mitchell Hashimoto 01aa4236c0 command/taint: support tainting resources in modules 2015-02-26 10:44:25 -08:00
Mitchell Hashimoto fa9b655fd1 website: docs for tainted command 2015-02-26 10:37:08 -08:00
Mitchell Hashimoto 4ec31ecb95 command/taint: new command 2015-02-26 10:29:23 -08:00
Mitchell Hashimoto 95cf69aa32 command: StateHook for continous state updates 2015-02-23 21:57:17 -08:00
Mitchell Hashimoto a655c1619a command: update help text 2015-02-23 15:13:56 -08:00
Mitchell Hashimoto 0299e60e83 command/init: -backend-config 2015-02-23 15:13:56 -08:00
Mitchell Hashimoto 84a0e512d3 command/remote: general `-config` flag 2015-02-23 15:13:56 -08:00
Mitchell Hashimoto 189e7e700a command: remove remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 2c2b560d7f command/remote: no more remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 0fcc417ddd command/apply: remove remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 0c6d133d61 command/refresh: get rid of remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 0d39a5d9a7 command/push: no more remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto f2c6c12535 command/pull: remove remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto b8a66cb6ca command: remove more remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 622690583c command/init: remove dependency on remote package 2015-02-23 15:13:55 -08:00
Mitchell Hashimoto 3550f7ac3a command: FlagVar => FlagKV 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 4f91b98a3e command: default path should be the local path 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto f81110c2fe command: backup stuff works better 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 4ec63bc2ef command: deal with plan states 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto 579f102f37 command: start migrating to new state package 2015-02-23 15:13:54 -08:00
Mitchell Hashimoto c2593f6ada terraform: re-enable dot-graphs 2015-02-19 23:00:29 -08:00
Mitchell Hashimoto b1e5b32322 terraform: Graph returns *Graph for now 2015-02-19 12:08:32 -08:00
Radek Simko 6c8dd9e8fa Unreachable code removed 2015-02-18 18:28:09 +00:00
lalyos 92540d3d88 fixing version numbers RCs should be labeled x.x.x-rcx
see conversation with ryanuber: https://github.com/hashicorp/go-checkpoint/issues/2#issuecomment-73199209
2015-02-07 16:56:56 +01:00
Emil Hessman b40c2fe997 command: fix test failure on Windows
URLs are `/`-based. Windows path Separator is `\`.
Convert `\` in test fixture path to `/` with filepath.ToSlash
such that proper URLs are constructed even on Windows.

Fixes a test failure on Windows.
2015-01-28 08:13:44 +01:00
Emil Hessman 92e68c1ee6 command: fix test failure on Windows
Adjust the laddr argument to net.Listen to the form host:port,
as documented for net.Dial.

Fixes a test failure on Windows.
2015-01-28 08:10:52 +01:00
Phil Kates b211d69dde Fix typo in refresh command error
Noticed this while I was digging around to see how the commands work.
2015-01-17 15:43:04 -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 b69239e7f8 command/meta: Adding additional nil guards 2015-01-07 13:28:15 -08:00
Armon Dadgar 408ae62306 command/apply: Handle remote state in a plan file 2015-01-07 13:08:32 -08:00
Kevin van Zonneveld 07505ed159 Fix typo: expacts -> expects 2015-01-03 17:59:55 +01:00
Emil Hessman fc36b1cd94 command: vet fix
Fixes the following vet report:

command/remote.go:165: wrong number of args for format in Sprintf call: 1 needed but 2 args
2014-12-17 13:02:19 +01:00
Armon Dadgar cce881aadd command/show: enable printing of remote state 2014-12-10 13:27:11 -08:00
Armon Dadgar 07e5f3ff41 command/remote: Improve UI output for remote 2014-12-10 13:27:11 -08:00
Armon Dadgar bcd348aebd command: updating tests 2014-12-10 13:27:10 -08:00
Armon Dadgar 6a84be0686 command: updating for pluggable backends 2014-12-10 13:27:10 -08:00
Armon Dadgar ba01e27026 command: Refresh remote state when loading 2014-12-10 13:27:09 -08:00
Armon Dadgar dab47b0d48 command/plan: remote enable 2014-12-10 13:27:09 -08:00
Armon Dadgar b6265cf1a2 command/refresh: Remote enable 2014-12-10 13:27:09 -08:00
Armon Dadgar 0fb87e499d command: Meta provides the state output path 2014-12-10 13:27:09 -08:00
Armon Dadgar 0c9436f37b command/output: Remote enable 2014-12-10 13:27:09 -08:00
Armon Dadgar 53704db4ee command: Enable reading remote-enabled state 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 c24123ff8a command/remote: Adding tests 2014-12-10 13:27:08 -08:00
Armon Dadgar b4b44dd0a8 command/remote: Refresh state before the disable 2014-12-10 13:27:08 -08:00
Armon Dadgar 6e7cffd60b command/init: Only initialize a blank state with remote 2014-12-10 13:27:08 -08:00
Armon Dadgar 9168a0f1ce command: Simplify push/pull, depend on remote command for setup 2014-12-10 13:27:08 -08:00
Armon Dadgar 1945e2099a command/remote: Use PersistState 2014-12-10 13:27:08 -08:00
Armon Dadgar 4e44443aa3 command/remote: Working on the details 2014-12-10 13:27:08 -08:00
Armon Dadgar b3871c0c5a command/remote: Adding skeleton 2014-12-10 13:27:08 -08:00
Armon Dadgar 09d7fb7c27 command: cleanup test function names 2014-12-10 13:27:08 -08:00
Armon Dadgar 7ba0c003f2 command/push: Allow existing state file to enable remote 2014-12-10 13:27:08 -08:00
Armon Dadgar 38002904f4 command/push: Adding the push command 2014-12-10 13:27:08 -08:00
Armon Dadgar 722a885113 command/init: Testing remote flags 2014-12-10 13:27:07 -08:00
Armon Dadgar 34df217514 command/pull: Adding the pull command 2014-12-10 13:27:07 -08:00
Armon Dadgar d332b8ad58 remote: implement refresh state 2014-12-10 13:27:07 -08:00
Armon Dadgar 29b3310a49 command/init: integrate remote state storage 2014-12-10 13:27:06 -08:00
Armon Dadgar 5b745e5d46 command: Run validation before asking for input. Fixes #602 2014-12-08 18:32:03 -08:00
Emil Hessman 31dd7d8391 command/init: use a more semantic name to identiy the test routine for issue 518 2014-11-20 19:17:04 +01:00
Emil Hessman 82e4bab178 command/init: test for issue 518 2014-11-04 21:19:39 +01: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 70191d22a6 Add checkpoint 2014-10-13 14:05:43 -07:00
Mitchell Hashimoto 5f6fe1f931 command: put the modules in ".terraform/modules"
This also fixes a case where tests wre leaking files
2014-10-13 12:05:28 -07:00
Mitchell Hashimoto c6a165f8c6 command: prov UI should trim only right spaces 2014-10-12 09:59:08 -07:00
Mitchell Hashimoto fbeb99ee83 command: make sure the output has a line from a provisioner to output 2014-10-11 17:40:28 -07:00
Mitchell Hashimoto 8fc134caa1 command/destroy: don't show outputs 2014-10-11 17:37:28 -07:00
Mitchell Hashimoto bb698217f8 command: split on \r too 2014-10-11 17:35:32 -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 dac5f0e3df command/show: update help 2014-10-11 12:57:47 -07:00
Mitchell Hashimoto 069f758efb command/show: show default state with no args [GH-349] 2014-10-11 12:56:55 -07:00
Mitchell Hashimoto 16b023bd2b command: ask for the proper level of input 2014-10-08 10:29:54 -07:00
Mitchell Hashimoto 28cd738edc command: provisioner output should prefix every line 2014-10-05 23:29:13 -07:00
Mitchell Hashimoto c1fbf46a33 command: send the provisioner output to the prompt 2014-10-04 16:33:47 -07:00
Mitchell Hashimoto 063e727491 command: compilej:wq 2014-10-04 16:24:57 -07:00
Mitchell Hashimoto b2342866c9 command: UIOutput is functinal 2014-10-04 10:25:54 -07:00
Mitchell Hashimoto 6d9463bfa8 command: set UIOutput 2014-10-04 10:20:35 -07:00
Mitchell Hashimoto a5f70ead2d command: destroy should ask for confirmation always 2014-10-03 16:08:50 -07:00
Mitchell Hashimoto edbdad8fdb command: nil-check for instance state when showing state 2014-10-02 17:48:51 -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