Commit Graph

684 Commits

Author SHA1 Message Date
James Bardin d059939f88 Merge pull request #13262 from hashicorp/jbardin/lock-timeouts
lock timeouts
2017-04-04 14:30:20 -04:00
Radek Simko fc72a20c66 command/hook_ui: Increase max length of state IDs (#13317) 2017-04-04 15:41:54 +01:00
James Bardin 3d604851c2 test -lock-timeout from cli 2017-04-03 11:50:19 -04:00
James Bardin 5eca913b14 add cli flags for -lock-timeout
Add the -lock-timeout flag to the appropriate commands.
Add the -lock flag to `init` and `import` which were missing it.
Set both stateLock and stateLockTimeout in Meta.flagsSet, and remove the
extra references for clarity.
2017-04-01 17:09:21 -04:00
James Bardin 305ef43aa6 provide contexts to clistate.Lock calls
Add fields required to create an appropriate context for all calls to
clistate.Lock.

Add missing checks for Meta.stateLock, where we would attempt to lock,
even if locking should be skipped.
2017-04-01 17:09:20 -04:00
James Bardin 3f0dcd1308 Have the clistate Lock use LockWithContext
- Have the ui Lock helper use state.LockWithContext.
- Rename the message package to clistate, since that's how it's imported
  everywhere.
- Use a more idiomatic placement of the Context in the LockWithContext
  args.
2017-04-01 17:09:20 -04:00
James Bardin 75458a182d remove extra state.Locker assertions
All states are lockers, so get rid of extra asertions.
2017-04-01 17:01:45 -04:00
James Bardin 8050eda52d don't delete local state on a local backend
Don't erase local state during backend migration if the new and old
paths are the same. Skipping the confirmation and copy are handled in
another patch, but the local state was always erased by default, even
when it was our new state.
2017-03-31 15:26:23 -04:00
James Bardin 50023e9a60 honor `input=false` in state migration
return an error when confirming a copy if -input=false
2017-03-29 18:11:45 -04:00
James Bardin 7d23e1ef20 add equivalent tests to meta_backend_test 2017-03-29 17:50:55 -04:00
James Bardin c891ab50b7 detect when backend.Hash needs update
It's possible to not change the backend config, but require updating the
stored backend state by moving init options from the config file to the
`-backend-config` flag. If the config is the same, but the hash doesn't
match, update the stored state.
2017-03-29 16:03:51 -04:00
James Bardin ff2d753062 add Rehash to terraform.BackendState
This method mirrors that of config.Backend, so we can compare the
configration of a backend read from a config vs that of a backend read
from a state. This will prevent init from reinitializing when using
`-backend-config` options that match the existing state.
2017-03-29 15:53:42 -04:00
Martin Atkins 76dca009e0 Allow escaped interpolation-like sequences in variable defaults
The variable validator assumes that any AST node it gets from an
interpolation walk is an indicator of an interpolation. Unfortunately,
back in f223be15 we changed the interpolation walker to emit a LiteralNode
as a way to signal that the result is a literal but not identical to the
input due to escapes.

The existence of this issue suggests a bit of a design smell in that the
interpolation walker interface at first glance appears to skip over all
literals, but it actually emits them in this one situation. In the long
run we should perhaps think about whether the abstraction is right here,
but this is a shallow, tactical change that fixes #13001.
2017-03-29 09:25:57 -07:00
Martin Atkins 21cd5595e2 Update stringer-generated files to new boilerplate
golang/tools commit 23ca8a263 changed the format of the leading comment
to comply with some new standards discussed here:
https://golang.org/issue/13560

This is the result of running generate with the latest version of
stringer. Everyone working on Terraform will need to update stringer
after this is merged, to avoid reverting this:
    go get -u golang.org/x/tools/cmd/stringer
2017-03-29 08:07:06 -07:00
James Bardin f172b4a023 Merge pull request #13105 from hashicorp/jbardin/command-env
disallow env names that aren't url-safe
2017-03-27 18:53:44 -04:00
James Bardin 2cffa25235 Add test to verify that Validation isn't called
The apply won't succeed because we don't have a valid plan, but this
verifies that providing a plan file prevents Validation.
2017-03-27 18:39:18 -04:00
James Bardin 9d118325b3 Reject names that aren't url-safe
Environment names can be used in a number of contexts, and should be
properly escaped for safety. Since most state names are store in path
structures, and often in a URL, use `url.PathEscape` to check for
disallowed characters
2017-03-27 18:00:56 -04:00
James Bardin 8027fe9e08 Don't Validate if we have an execution plan
The plan file should contain all data required to execute the apply
operation. Validation requires interpolation, and the `file()`
interpolation function may fail if the module files are not present.
This is the case currently with how TFE executes plans.
2017-03-27 17:11:50 -04:00
James Bardin 54e536cfe0 add `-force-copy` option to init command
The `-force-copy` option will suppress confirmation for copying state
data.

Modify some tests to use the option, making sure to leave coverage of
the Input code path.
2017-03-22 08:47:26 -04:00
Mitchell Hashimoto d01886a644
command: remove legacy remote state on migration
Fixes #12871

We were forgetting to remove the legacy remote state from the actual
state value when migrating. This only causes an issue when saving a plan
since the plan contains the state itself and causes an error where both
a backend + legacy state exist.

If saved plans aren't used this causes no noticable issue.

Due to buggy upgrades already existing in the wild, I also added code to
clear the remote section if it exists in a standard unchanged backend
2017-03-20 10:14:59 -07:00
Mitchell Hashimoto 23505cc2a8 Merge pull request #12818 from hashicorp/b-legacy
command: use backendinit instead of initializing legacy directly
2017-03-17 11:06:01 -07:00
James Bardin 434e78158a Merge pull request #12812 from hashicorp/jbardin/hook-ui-race
fix race in hook ui PreApply test
2017-03-17 14:05:39 -04:00
Mitchell Hashimoto 4f59576231
command: fix awkward wording in message 2017-03-17 10:52:22 -07:00
James Bardin b9931c437d fix race in hook ui PreApply test
Fix a race in the PreApply test, and make the PreApply background task
actually concealable.
2017-03-17 13:49:05 -04:00
Mitchell Hashimoto 96e38041ab
command: use backendinit instead of initializing legacy directly
Fixes #12806

This should've been part of 2c19aa69d9

This is the same issue, just missed a spot. Tests are hard to cover for
this since we're removing the legacy backends one by one, eventually
it'll be gone. A good sign is that we don't import backendlegacy at all
anymore in command/
2017-03-17 10:41:13 -07:00
Mitchell Hashimoto c87f3dfdd5
command/init: add test for -backend-config k/v 2017-03-17 10:22:48 -07:00
Mitchell Hashimoto df8529719c
command/init: backend-config accepts key=value pairs
This augments backend-config to also accept key=value pairs.
This should make Terraform easier to script rather than having to
generate a JSON file.

You must still specify the backend type as a minimal amount in
configurations, example:

```
terraform { backend "consul" {} }
```

This is required because Terraform needs to be able to detect the
_absense_ of that value for unsetting, if that is necessary at some
point.
2017-03-16 23:27:05 -07:00
Mitchell Hashimoto e1f4eca93c
command: apply needs to look at the right field for backend state
Plans were properly encoding backend configuration but the apply was
reading it from the wrong field. :( This meant that every apply from a
plan was applying it locally with backends.

This needs to get released ASAP.
2017-03-16 15:44:15 -07:00
Mitchell Hashimoto 25312c8985
command/push: update copy for remote state error 2017-03-16 14:41:37 -07:00
James Bardin 9bfa361e21 Merge pull request #12778 from hashicorp/jbardin/GH-12741
change to default state after backend migration
2017-03-16 16:07:25 -04:00
Mitchell Hashimoto 6921457601 Merge pull request #12777 from hashicorp/b-refresh-empty
backend/local: allow refresh on empty/non-existent state
2017-03-16 13:04:27 -07:00
James Bardin ea095eda87 change to default state after backend migration
When migrating from a multi-state backend to a single-state backend, we
have to ensure that our locally configured environment is changed back
to "default", or we won't be able to access the new backend.
2017-03-16 15:55:32 -04:00
Mitchell Hashimoto 2be1f55cbb
backend/local: allow refresh on empty/non-existent state
This allows a refresh on a non-existent or empty state file. We changed
this in 0.9.0 to error which seemed reasonable but it turns out this
complicates automation that runs refresh since it now needed to
determine if the state file was empty before running.

Its easier to just revert this into a warning with exit code zero.

The reason this changed is because in 0.8.x and earlier, the output
would be simply empty with exit code zero which seemed odd.
2017-03-16 12:11:31 -07:00
Mitchell Hashimoto 81639480fb
command: recompute config hash with ConfigFile set
Fixes #12749

If we merge in an extra partial config we need to recompute the hash to
compare with the old value to detect that change.

This hash needs to NOT be stored and just used as a temporary. We want
to keep the original hash in the state so that we don't detect a change
from the config (since the config will always be partial).
2017-03-16 11:47:59 -07:00
Mitchell Hashimoto 87201ec854
command/push: test for push with new backends 2017-03-16 10:52:58 -07:00
Mitchell Hashimoto 8b208a597d
command/push: don't allow pushing with local backend 2017-03-16 10:47:48 -07:00
Radek Simko 4448e45678 Merge pull request #12372 from hashicorp/f-kubernetes
kubernetes: Add provider + namespace resource
2017-03-16 07:18:39 +00:00
Mitchell Hashimoto f7964194eb
command: fix odd formatting that snuck in 2017-03-13 16:41:33 -07:00
Mitchell Hashimoto d475fc29a8
command: test that terraform meta information is passed through 2017-03-13 16:31:35 -07:00
Radek Simko f1db0fcf9b
kubernetes: Add provider + namespace resource 2017-03-13 21:19:17 +00:00
Radek Simko 4d6242dfe0 command: Add tests for UiHook (#12447) 2017-03-13 20:09:25 +00:00
Sean Chittenden 17fb98afa2 Circonus Provider (#12338)
* Begin stubbing out the Circonus provider.

* Remove all references to `reverse:secret_key`.

This value is dynamically set by the service and unused by Terraform.

* Update the `circonus_check` resource.

Still a WIP.

* Add docs for the `circonus_check` resource.

Commit miss, this should have been included in the last commit.

* "Fix" serializing check tags

I still need to figure out how I can make them order agnostic w/o using
a TypeSet.  I'm worried that's what I'm going to have to do.

* Spike a quick circonus_broker data source.

* Convert tags to a Set so the order does not matter.

* Add a `circonus_account` data source.

* Correctly spell account.

Pointed out by: @postwait

* Add the `circonus_contact_group` resource.

* Push descriptions into their own file in order to reduce the busyness of the schema when reviewing code.

* Rename `circonus_broker` and `broker` to `circonus_collector` and `collector`, respectively.

Change made with concent by Circonus to reduce confusion (@postwait, @maier, and several others).

* Use upstream contsants where available.

* Import the latest circonus-gometrics.

* Move to using a Set of collectors vs a list attached to a single attribute.

* Rename "cid" to "id" in the circonus_account data source and elsewhere
where possible.

* Inject a tag automatically.  Update gometrics.

* Checkpoint `circonus_metric` resource.

* Enable provider-level auto-tagging.  This is disabled by default.

* Rearrange metric.  This is an experimental "style" of a provider.  We'll see.

That moment. When you think you've gone off the rails on a mad scientist
experiment but like the outcome and think you may be onto something but
haven't proven it to yourself or anyone else yet?  That.  That exact
feeling of semi-confidence while being alone in the wilderness.  Please
let this not be the Terraform provider equivalent of DJB's C style of
coding.

We'll know in another resource or two if this was a horrible mistake or
not.

* Begin moving `resource_circonus_check` over to the new world order/structure:

Much of this is WIP and incomplete, but here is the new supported
structure:

```
variable "used_metric_name" {
  default = "_usage`0`_used"
}

resource "circonus_check" "usage" {
  # collectors = ["${var.collectors}"]
  collector {
    id = "${var.collectors[0]}"
  }

  name       = "${var.check_name}"
  notes      = "${var.notes}"

  json {
    url = "https://${var.target}/account/current"

    http_headers = {
      "Accept"                = "application/json"
      "X-Circonus-App-Name"   = "TerraformCheck"
      "X-Circonus-Auth-Token" = "${var.api_token}"
    }
  }

  stream {
    name = "${circonus_metric.used.name}"
    tags = "${circonus_metric.used.tags}"
    type = "${circonus_metric.used.type}"
  }

  tags = {
    source = "circonus"
  }
}

resource "circonus_metric" "used" {
  name = "${var.used_metric_name}"

  tags = {
    source = "circonus"
  }

  type = "numeric"
}
```

* Document the `circonus_metric` resource.

* Updated `circonus_check` docs.

* If a port was present, automatically set it in the Config.

* Alpha sort the check parameters now that they've been renamed.

* Fix a handful of panics as a result of the schema changing.

* Move back to a `TypeSet` for tags.  After a stint with `TypeMap`, move
back to `TypeSet`.

A set of strings seems to match the API the best.  The `map` type was
convenient because it reduced the amount of boilerplate, but you loose
out on other things.  For instance, tags come in the form of
`category:value`, so naturally it seems like you could use a map, but
you can't without severe loss of functionality because assigning two
values to the same category is common.  And you can't normalize map
input or suppress the output correctly (this was eventually what broke
the camel's back).  I tried an experiment of normalizing the input to be
`category:value` as the key in the map and a value of `""`, but... seee
diff suppress.  In this case, simple is good.

While here bring some cleanups to _Metric since that was my initial
testing target.

* Rename `providerConfig` to `_ProviderConfig`

* Checkpoint the `json` check type.

* Fix a few residual issues re: missing descriptions.

* Rename `validateRegexp` to `_ValidateRegexp`

* Use tags as real sets, not just a slice of strings.

* Move the DiffSuppressFunc for tags down to the Elem.

* Fix up unit tests to chase the updated, default hasher function being used.

* Remove `Computed` attribute from `TypeSet` objects.

This fixes a pile of issues re: update that I was having.

* Rename functions.

`GetStringOk` -> `GetStringOK`
`GetSetAsListOk` -> `GetSetAsListOK`
`GetIntOk` -> `GetIntOK`

* Various small cleanups and comments rolled into a single commit.

* Add a `postgresql` check type for the `circonus_check` resource.

* Rename various validator functions to be _CapitalCase vs capitalCase.

* Err... finish the validator renames.

* Add `GetFloat64()` support.

* Add `icmp_ping` check type support.

* Catch up to the _API*Attr renames.

Deliberately left out of the previous commit in order to create a clean
example of what is required to add a new check type to the
`circonus_check` resource.

* Clarify when the `target` attribute is required for the `postgresql`
check type.

* Correctly pull the metric ID attribute from the right location.

* Add a circonus_stream_group resource (a.k.a. a Circonus "metric cluster")

* Add support for the [`caql`](https://login.circonus.com/user/docs/caql_reference) check type.

* Add support for the `http` check type.

* `s/SSL/TLS/g`

* Add support for `tcp` check types.

* Enumerate the available metrics that are supported for each check type.

* Add [`cloudwatch`](https://login.circonus.com/user/docs/Data/CheckTypes/CloudWatch) check type support.

* Add a `circonus_trigger` resource (a.k.a Circonus Ruleset).

* Rename a handful of functions to make it clear in the function name the
direction of flow for information moving through the provider.

TL;DR: Replace `parse` and `read` with "foo to bar"-like names.

* Fix the attribute name used in a validator.  Absent != After.

* Set the minimum `absent` predicate to 70s per testing.

* Fix the regression tests for circonus_trigger now that absent has a 70s min

* Fix up the `tcp` check to require a `host` attribute.

Fix tests.  It's clear I didn't run these before committing/pushing the
`tcp` check last time.

* Fix `circonus_check` for `cloudwatch` checks.

* Rename `parsePerCheckTypeConfig()` to `_CheckConfigToAPI` to be
consistent with other function names.

grep(1)ability of code++

* Slack buttons as an integer are string encoded.

* Fix updates for `circonus_contact`.

* Fix the out parameters for contact groups.

* Move to using `_CastSchemaToTF()` where appropriate.

* Fix circonus_contact_group.  Updates work as expected now.

* Use `_StateSet()` in place of `d.Set()` everywhere.

* Make a quick pass over the collector datasource to modernize its style

* Quick pass for items identified by `golint`.

* Fix up collectors

* Fix the `json` check type.

Reconcile possible sources of drift.  Update now works as expected.

* Normalize trigger durations to seconds.

* Improve the robustness of the state handling for the `circonus_contact_group` resource.

* I'm torn on this, but sort the contact groups in the notify list.

This does mean that if the first contact group in the list has a higher
lexical sort order the plan won't converge until the offending resource
is tainted and recreated.  But there's also some sorting happening
elsewhere, so.... sort and taint for now and this will need to be
revisited in the future.

* Add support for the `httptrap` check type.

* Remove empty units from the state file.

* Metric clusters can return a 404.  Detect this accordingly in its
respective Exists handler.

* Add a `circonus_graph` resource.

* Fix a handful of bugs in the graph provider.

* Re-enable the necessary `ConflictsWith` definitions and normalize attribute names.

* Objects that have been deleted via the UI return a 404. Handle in Exists().

* Teach `circonus_graph`'s Stack set to accept nil values.

* Set `ForceNew: true` for a graph's name.

* Chase various API fixes required to make `circonus_graph` work as expected.

* Fix up the handling of sub-1 zoom resolutions for graphs.

* Add the `check_by_collector` out parameter to the `circonus_check` resource.

* Improve validation of line vs area graphs.  Fix graph_style.

* Fix up the `logarithmic` graph axis option.

* Resolve various trivial `go vet` issues.

* Add a stream_group out parameter.

* Remove incorrectly applied `Optional` attributes to the `circonus_account` resource.

* Remove various `Optional` attributes from the `circonus_collector` data source.

* Centralize the common need to suppress leading and trailing whitespace into `suppressWhitespace`.

* Sync up with upstream vendor fixes for circonus_graph.

* Update the checksum value for the http check.

* Chase `circonus_graph`'s underlying `line_style` API object change from `string` to `*string`.

* Clean up tests to use a generic terraform regression testing account.

* Add support for the MySQL to the `circonus_check` resource.

* Begin stubbing out the Circonus provider.

* Remove all references to `reverse:secret_key`.

This value is dynamically set by the service and unused by Terraform.

* Update the `circonus_check` resource.

Still a WIP.

* Add docs for the `circonus_check` resource.

Commit miss, this should have been included in the last commit.

* "Fix" serializing check tags

I still need to figure out how I can make them order agnostic w/o using
a TypeSet.  I'm worried that's what I'm going to have to do.

* Spike a quick circonus_broker data source.

* Convert tags to a Set so the order does not matter.

* Add a `circonus_account` data source.

* Correctly spell account.

Pointed out by: @postwait

* Add the `circonus_contact_group` resource.

* Push descriptions into their own file in order to reduce the busyness of the schema when reviewing code.

* Rename `circonus_broker` and `broker` to `circonus_collector` and `collector`, respectively.

Change made with concent by Circonus to reduce confusion (@postwait, @maier, and several others).

* Use upstream contsants where available.

* Import the latest circonus-gometrics.

* Move to using a Set of collectors vs a list attached to a single attribute.

* Rename "cid" to "id" in the circonus_account data source and elsewhere
where possible.

* Inject a tag automatically.  Update gometrics.

* Checkpoint `circonus_metric` resource.

* Enable provider-level auto-tagging.  This is disabled by default.

* Rearrange metric.  This is an experimental "style" of a provider.  We'll see.

That moment. When you think you've gone off the rails on a mad scientist
experiment but like the outcome and think you may be onto something but
haven't proven it to yourself or anyone else yet?  That.  That exact
feeling of semi-confidence while being alone in the wilderness.  Please
let this not be the Terraform provider equivalent of DJB's C style of
coding.

We'll know in another resource or two if this was a horrible mistake or
not.

* Begin moving `resource_circonus_check` over to the new world order/structure:

Much of this is WIP and incomplete, but here is the new supported
structure:

```
variable "used_metric_name" {
  default = "_usage`0`_used"
}

resource "circonus_check" "usage" {
  # collectors = ["${var.collectors}"]
  collector {
    id = "${var.collectors[0]}"
  }

  name       = "${var.check_name}"
  notes      = "${var.notes}"

  json {
    url = "https://${var.target}/account/current"

    http_headers = {
      "Accept"                = "application/json"
      "X-Circonus-App-Name"   = "TerraformCheck"
      "X-Circonus-Auth-Token" = "${var.api_token}"
    }
  }

  stream {
    name = "${circonus_metric.used.name}"
    tags = "${circonus_metric.used.tags}"
    type = "${circonus_metric.used.type}"
  }

  tags = {
    source = "circonus"
  }
}

resource "circonus_metric" "used" {
  name = "${var.used_metric_name}"

  tags = {
    source = "circonus"
  }

  type = "numeric"
}
```

* Document the `circonus_metric` resource.

* Updated `circonus_check` docs.

* If a port was present, automatically set it in the Config.

* Alpha sort the check parameters now that they've been renamed.

* Fix a handful of panics as a result of the schema changing.

* Move back to a `TypeSet` for tags.  After a stint with `TypeMap`, move
back to `TypeSet`.

A set of strings seems to match the API the best.  The `map` type was
convenient because it reduced the amount of boilerplate, but you loose
out on other things.  For instance, tags come in the form of
`category:value`, so naturally it seems like you could use a map, but
you can't without severe loss of functionality because assigning two
values to the same category is common.  And you can't normalize map
input or suppress the output correctly (this was eventually what broke
the camel's back).  I tried an experiment of normalizing the input to be
`category:value` as the key in the map and a value of `""`, but... seee
diff suppress.  In this case, simple is good.

While here bring some cleanups to _Metric since that was my initial
testing target.

* Rename `providerConfig` to `_ProviderConfig`

* Checkpoint the `json` check type.

* Fix a few residual issues re: missing descriptions.

* Rename `validateRegexp` to `_ValidateRegexp`

* Use tags as real sets, not just a slice of strings.

* Move the DiffSuppressFunc for tags down to the Elem.

* Fix up unit tests to chase the updated, default hasher function being used.

* Remove `Computed` attribute from `TypeSet` objects.

This fixes a pile of issues re: update that I was having.

* Rename functions.

`GetStringOk` -> `GetStringOK`
`GetSetAsListOk` -> `GetSetAsListOK`
`GetIntOk` -> `GetIntOK`

* Various small cleanups and comments rolled into a single commit.

* Add a `postgresql` check type for the `circonus_check` resource.

* Rename various validator functions to be _CapitalCase vs capitalCase.

* Err... finish the validator renames.

* Add `GetFloat64()` support.

* Add `icmp_ping` check type support.

* Catch up to the _API*Attr renames.

Deliberately left out of the previous commit in order to create a clean
example of what is required to add a new check type to the
`circonus_check` resource.

* Clarify when the `target` attribute is required for the `postgresql`
check type.

* Correctly pull the metric ID attribute from the right location.

* Add a circonus_stream_group resource (a.k.a. a Circonus "metric cluster")

* Add support for the [`caql`](https://login.circonus.com/user/docs/caql_reference) check type.

* Add support for the `http` check type.

* `s/SSL/TLS/g`

* Add support for `tcp` check types.

* Enumerate the available metrics that are supported for each check type.

* Add [`cloudwatch`](https://login.circonus.com/user/docs/Data/CheckTypes/CloudWatch) check type support.

* Add a `circonus_trigger` resource (a.k.a Circonus Ruleset).

* Rename a handful of functions to make it clear in the function name the
direction of flow for information moving through the provider.

TL;DR: Replace `parse` and `read` with "foo to bar"-like names.

* Fix the attribute name used in a validator.  Absent != After.

* Set the minimum `absent` predicate to 70s per testing.

* Fix the regression tests for circonus_trigger now that absent has a 70s min

* Fix up the `tcp` check to require a `host` attribute.

Fix tests.  It's clear I didn't run these before committing/pushing the
`tcp` check last time.

* Fix `circonus_check` for `cloudwatch` checks.

* Rename `parsePerCheckTypeConfig()` to `_CheckConfigToAPI` to be
consistent with other function names.

grep(1)ability of code++

* Slack buttons as an integer are string encoded.

* Fix updates for `circonus_contact`.

* Fix the out parameters for contact groups.

* Move to using `_CastSchemaToTF()` where appropriate.

* Fix circonus_contact_group.  Updates work as expected now.

* Use `_StateSet()` in place of `d.Set()` everywhere.

* Make a quick pass over the collector datasource to modernize its style

* Quick pass for items identified by `golint`.

* Fix up collectors

* Fix the `json` check type.

Reconcile possible sources of drift.  Update now works as expected.

* Normalize trigger durations to seconds.

* Improve the robustness of the state handling for the `circonus_contact_group` resource.

* I'm torn on this, but sort the contact groups in the notify list.

This does mean that if the first contact group in the list has a higher
lexical sort order the plan won't converge until the offending resource
is tainted and recreated.  But there's also some sorting happening
elsewhere, so.... sort and taint for now and this will need to be
revisited in the future.

* Add support for the `httptrap` check type.

* Remove empty units from the state file.

* Metric clusters can return a 404.  Detect this accordingly in its
respective Exists handler.

* Add a `circonus_graph` resource.

* Fix a handful of bugs in the graph provider.

* Re-enable the necessary `ConflictsWith` definitions and normalize attribute names.

* Objects that have been deleted via the UI return a 404. Handle in Exists().

* Teach `circonus_graph`'s Stack set to accept nil values.

* Set `ForceNew: true` for a graph's name.

* Chase various API fixes required to make `circonus_graph` work as expected.

* Fix up the handling of sub-1 zoom resolutions for graphs.

* Add the `check_by_collector` out parameter to the `circonus_check` resource.

* Improve validation of line vs area graphs.  Fix graph_style.

* Fix up the `logarithmic` graph axis option.

* Resolve various trivial `go vet` issues.

* Add a stream_group out parameter.

* Remove incorrectly applied `Optional` attributes to the `circonus_account` resource.

* Remove various `Optional` attributes from the `circonus_collector` data source.

* Centralize the common need to suppress leading and trailing whitespace into `suppressWhitespace`.

* Sync up with upstream vendor fixes for circonus_graph.

* Update the checksum value for the http check.

* Chase `circonus_graph`'s underlying `line_style` API object change from `string` to `*string`.

* Clean up tests to use a generic terraform regression testing account.

* Rename all identifiers that began with a `_` and replace with a corresponding lowercase glyph.

* Remove stale comment in types.

* Move the calls to `ResourceData`'s `SetId()` calls to be first in the
list so that no resources are lost in the event of a `panic()`.

* Remove `stateSet` from the `circonus_trigger` resource.

* Remove `stateSet` from the `circonus_stream_group` resource.

* Remove `schemaSet` from the `circonus_graph` resource.

* Remove `stateSet` from the `circonus_contact` resource.

* Remove `stateSet` from the `circonus_metric` resource.

* Remove `stateSet` from the `circonus_account` data source.

* Remove `stateSet` from the `circonus_collector` data source.

* Remove stray `stateSet` call from the `circonus_contact` resource.

This is an odd artifact to find... I'm completely unsure as to why it
was there to begin with but am mostly certain it's a bug and needs to be
removed.

* Remove `stateSet` from the `circonus_check` resource.

* Remove the `stateSet` helper function.

All call sites have been converted to return errors vs `panic()`'ing at
runtime.

* Remove a pile of unused functions and type definitions.

* Remove the last of the `attrReader` interface.

* Remove an unused `Sprintf` call.

* Update `circonus-gometrics` and remove unused files.

* Document what `convertToHelperSchema()` does.

Rename `castSchemaToTF` to `convertToHelperSchema`.

Change the function parameter ordering so the `map` of attribute
descriptions: this is much easier to maintain when the description map
is first when creating schema inline.

* Move descriptions into their respective source files.

* Remove all instances of `panic()`.

In the case of software bugs, log an error.  Never `panic()` and always
return a value.

* Rename `stream_group` to `metric_cluster`.

* Rename triggers to rule sets

* Rename `stream` to `metric`.

* Chase the `stream` -> `metric` change into the docs.

* Remove some unused test functions.

* Add the now required `color` attribute for graphing a `metric_cluster`.

* Add a missing description to silence a warning.

* Add `id` as a selector for the account data source.

* Futureproof testing: Randomize all asset names to prevent any possible resource conflicts.

This isn't a necessary change for our current build and regression
testing, but *just in case* we have a radical change to our testing
framework in the future, make all resource names fully random.

* Rename various values to match the Circonus docs.

* s/alarm/alert/g

* Ensure ruleset criteria can not be empty.
2017-03-10 14:19:17 -06:00
James Bardin 200d5787ca Merge pull request #12433 from hashicorp/jbardin/extra-args
missing args assignment after parsing flags
2017-03-09 11:03:56 -05:00
Clint 5d894e4ffd Fix up command and some go fmt issues (#12509) 2017-03-07 16:03:45 -06:00
Paul Stack b57e0bee2a provider/datadog: Update to datadog_monitor still used d.GetOk (#12497)
Fixes: #12494

The Create was changed to use the default and not d.GetOk - the update
wasn't - this was causing issues when trying to update to a false value

```
% make testacc TEST=./builtin/providers/datadog
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/07 16:20:54 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/datadog -v  -timeout 120m
=== RUN   TestDatadogMonitor_import
--- PASS: TestDatadogMonitor_import (4.77s)
=== RUN   TestDatadogUser_import
--- PASS: TestDatadogUser_import (6.23s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccDatadogMonitor_Basic
--- PASS: TestAccDatadogMonitor_Basic (3.83s)
=== RUN   TestAccDatadogMonitor_BasicNoTreshold
--- PASS: TestAccDatadogMonitor_BasicNoTreshold (4.92s)
=== RUN   TestAccDatadogMonitor_Updated
--- PASS: TestAccDatadogMonitor_Updated (5.88s)
=== RUN   TestAccDatadogMonitor_TrimWhitespace
--- PASS: TestAccDatadogMonitor_TrimWhitespace (3.23s)
=== RUN   TestAccDatadogMonitor_Basic_float_int
--- PASS: TestAccDatadogMonitor_Basic_float_int (5.73s)
=== RUN   TestAccDatadogTimeboard_update
--- PASS: TestAccDatadogTimeboard_update (8.86s)
=== RUN   TestValidateAggregatorMethod
--- PASS: TestValidateAggregatorMethod (0.00s)
=== RUN   TestAccDatadogUser_Updated
--- PASS: TestAccDatadogUser_Updated (6.05s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/datadog	49.506s
```
2017-03-07 16:36:37 +02:00
James Bardin e58a02405e missing args assignment after parsing flags
`env list` was missing the args re-assignment after parsing the flags.
This is only a problem if the variables are automatically be populated
as arguments from a tfvars file.
2017-03-03 18:19:56 -05:00
Mitchell Hashimoto 03493f7d46
command: validate backend config
The validation itself was added a couple weeks ago but I forgot to
actually call it. :sad:
2017-03-02 14:07:49 -08:00
Mitchell Hashimoto d1b930d5b5
command: remove unused test 2017-03-02 11:21:48 -08:00
Mitchell Hashimoto 0224a12a00
command: fix go vet 2017-03-02 11:19:54 -08:00
Mitchell Hashimoto 5086f9f568
command: remove log 2017-03-02 11:15:38 -08:00