Commit Graph

11218 Commits

Author SHA1 Message Date
James Bardin f65a898a51 Merge pull request #7188 from hashicorp/jbardin/GH-7017
provider/aws: Check for unassigned AWS Cookie Stickiness Policy
2016-06-16 11:35:05 -04:00
Clint 24bcac42be provider/aws: Retry EIP association (#7186) 2016-06-16 10:03:16 -05:00
James Bardin cfd8254db8 Check for existing but unassigned LB policies
If an AWS Cookie Stickiness Policy is removed from the listener in
the AWS console the policy isn't deleted. Cross reference the policy
name with those assigned to the listener to determine if the policy
is actually being used.
2016-06-16 10:10:52 -04:00
Steven Crossan ca2d230a2c provider/openstack: Change rules type to List
Allows for ordering of rules that are applied to the firewall policy,
including addition and removal of rules in certain positions.
2016-06-16 12:27:01 +01:00
Paul Stack 5fdcf5d16a Update CHANGELOG.md 2016-06-15 18:46:03 +02:00
Brian Edwards d79879dba4 provider/datadog: add timeboard resource. upgrade vendored go-datadog-api to support read-only option. (#6900) 2016-06-15 18:44:49 +02:00
James Nugent 14ff584cc6 Merge pull request #7150 from hashicorp/arm-maxitems
provider/azurerm: Change `azurerm_virtual_machine` to use MaxItems
2016-06-15 18:21:32 +02:00
Seth Vargo a1e0e171d9 Fix broken docs link (#7175) 2016-06-15 09:36:23 -05:00
Martin Atkins b0c0e3cb9d Fix CHANGELOG typo of "GH" as "Gh"
This might've caused the issue link insertion script to get confused when it comes time to cut 0.7.
2016-06-15 06:54:24 -07:00
Martin Atkins ce447e8e2a aws_availability_zones output as "names" rather than "instance" (#7162)
Since this resource produces a list it feels more intuitive to give its
attribute a plural name, and since the noun "instance" already means
something specific in the AWS provider that doesn't apply here we use
"names" to indicate that these are availability zone names.

Also includes updating the docs to not show a dynamic count example for
now, since we don't support that yet.
2016-06-15 15:17:12 +02:00
James Bardin e2d257372a Merge pull request #7166 from hashicorp/jbardin/GH-7065
provider/aws: Check for LoadBalancerNotFound when reading AppCookieStickinessPolicy
2016-06-15 08:59:58 -04:00
James Nugent ccd69eac53 Update CHANGELOG.md 2016-06-15 14:19:32 +02:00
James Nugent 1deff4eaca Merge pull request #7174 from hashicorp/finanzcheck-interpolate_uniq
core: Rebase #7111 and rename unique() to distinct()
2016-06-15 14:18:02 +02:00
James Nugent 4b6a632246 core: Rename uniq -> distinct and add docs 2016-06-15 13:25:17 +02:00
Jan Schumann df3e017f6c fix #7106 2016-06-15 13:25:16 +02:00
James Bardin d4d8a99ba4 Check for LoadBalancerNotFound
When reading an AppCookieStickinessPolicy check for LoadBalancerNotFound
as well as PolicyNotFound. This prevents errors when when destroying a
policy on an ELB that no longer exists.
2016-06-14 17:58:48 -04:00
Clint b7d0bd5db7 Update CHANGELOG.md 2016-06-14 15:40:20 -05:00
Clint 627efa21f4 provider/aws: Retry RouteTable Route/Assocation creation (#7156)
* provider/aws: Retry RouteTable Assocation creation

* provider/aws: retry route creation

* remove extra string check
2016-06-14 15:39:52 -05:00
clint shryock 4796e27d1a provider/aws: Randomize Cluser Param group name to avoid collision 2016-06-14 10:42:36 -05:00
clint shryock 8f216563aa provider/aws: Fix db instance snapshot tests 2016-06-13 10:05:01 -05:00
stack72 e57ee0a067 provider/azurerm: Change `azurerm_virtual_machine` to use MaxItems
There were lots of hacky checks in the ARM VM resource to check for a
length of 1 param block

MaxItems was introduced so this PR updates to use MaxItems
2016-06-13 13:25:32 +02:00
James Nugent 3e8d5eed06 Merge pull request #7148 from hashicorp/b-show-crash-with-tainted
core: Fix crash with tainted resource
2016-06-13 10:38:36 +01: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
Paul Hinze ff2a7b0262 Merge pull request #7144 from veselinkantsev/patch-1
corrected "here doc" syntax notes
2016-06-12 15:10:16 -05:00
Paul Hinze 0f92161f82 release: clean up after v0.7.0-rc2 2016-06-12 19:21:46 +00:00
Paul Hinze 46a0709bba
v0.7.0-rc2 2016-06-12 19:07:52 +00:00
Paul Hinze a4b06d6833 Merge pull request #7145 from hashicorp/b-concat-lists-of-maps-panic
core: Fix panic on concat() w/ list of nonprimitives
2016-06-12 13:40:46 -05:00
Paul Hinze 9bc980f569
core: Fix panic on concat() w/ list of nonprimitives
The `concat()` interpolation function does not yet support types other
than strings / lists of strings. Make it an error message instead of a
panic when a list of non-primitives is supplied.

Fixes the panic in #7030
2016-06-12 13:29:06 -05:00
Veselin Kantsev b0a99ce35e corrected "here doc" syntax notes 2016-06-12 18:57:13 +01:00
Paul Hinze 2127466280 Merge pull request #7138 from hashicorp/b-better-dot-index-error
core: Better error for dot indexing on user vars
2016-06-12 11:20:30 -05:00
Paul Hinze ffa29090ec
core: Better error for dot indexing on user vars
Dot indexing worked in the "regexps and strings" world of 0.6.x, but it
no longer works on the 0.7 series w/ proper List / Map types.

There is plenty of dot-indexed config out in the wild, so we need to do
what we can to point users to the new syntax.

Here is one place we can do it for user variables (`var.somemap`). We'll
also need to address Resource Variables and Module Variables in a
separate PR.

This fixes the panic in #7103 - a proper error message is now returned.
2016-06-12 10:45:48 -05:00
James Nugent 5289124b8a Merge pull request #7135 from hashicorp/b-empty-multi-variables
core: Fix empty multi-variable type
2016-06-12 14:37:03 +01:00
James Nugent 052345abfe core: Fix empty multi-variable type
Previously, interpolation of multi-variables was returning an empty
variable if the resource count was 0. The empty variable was defined as
TypeString, Value "". This means that empty resource counts fail type
checking for interpolation functions which operate on lists.

Instead, return an empty list if the count is 0. A context test tests
this against further regression. Also add a regression test covering the
case of a single count multi-variable.

In order to make the context testing framework deal with this change it
was necessary to special case empty lists in the test diff function.

Fixes #7002
2016-06-12 14:00:16 +02:00
James Nugent 2fd4a62cf5 Merge pull request #7134 from hashicorp/hil-update
deps: Update github.com/hashicorp/hil/...
2016-06-12 12:55:22 +01:00
James Nugent ce649ea216 deps: Update github.com/hashicorp/hil/... 2016-06-12 13:54:36 +02:00
James Nugent 8d11e4dd8f Merge pull request #7133 from hashicorp/b-output-empty-list-format
core: Format empty lists and maps in output
2016-06-12 10:59:45 +01: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
James Nugent 445cd84f62 Merge pull request #7131 from hashicorp/b-destroy-module-provider-config
core: Fix destroy when module vars used in provider config
2016-06-12 10:38:12 +01:00
James Nugent f35812c475 Merge pull request #7132 from hashicorp/b-empty-variable-types
core: Fix detection of empty list/map defaults
2016-06-12 10:36:19 +01:00
James Nugent 01cd596c60 core: Fix detection of empty list/map defaults
This commit changes config parsing from weak decoding lists and maps
into []string and map[string]string respectively to decode into
[]interface{} and map[string]interface{} respectively. This is in order
to take advantage of the work integrated in #7082 to defeat the backward
compatibility features of the mapstructure library.

Test coverage of loading empty variables and validating their default
types against expectation.
2016-06-12 11:19:03 +02:00
Paul Hinze bf0e7705b1
core: Fix destroy when module vars used in provider config
For `terraform destroy`, we currently build up the same graph we do for
`plan` and `apply` and we do a walk with a special Diff that says
"destroy everything".

We have fought the interpolation subsystem time and again through this
code path. Beginning in #2775 we gained a new feature to selectively
prune out problematic graph nodes. The past chain of destroy fixes I
have been involved with (#6557, #6599, #6753) have attempted to massage
the "noop" definitions to properly handle the edge cases reported.

"Variable is depended on by provider config" is another edge case we add
here and try to fix.

This dive only makes me more convinced that the whole `terraform
destroy` code path needs to be reworked.

For now, I went with a "surgical strike" approach to the problem
expressed in #7047. I found a couple of issues with the existing
Noop and DestroyEdgeInclude logic, especially with regards to
flattening, but I'm explicitly ignoring these for now so we can get this
particular bug fixed ahead of the 0.7 release. My hope is that we can
circle around with a fully specced initiative to refactor `terraform
destroy`'s graph to be more state-derived than config-derived.

Until then, this fixes #7407
2016-06-11 21:21:08 -05:00
James Nugent 3662bfa67a Update CHANGELOG.md 2016-06-11 18:13:54 +01:00
James Nugent 82c729b9ac Merge pull request #7128 from hashicorp/f-interpolation-func-sort
core: Add sort() interpolation function
2016-06-11 18:13:07 +01:00
James Nugent 578ff9569e core: Add sort() interpolation function 2016-06-11 18:03:52 +01:00
James Nugent 20ea1cb32c Update CHANGELOG.md 2016-06-11 18:00:23 +01:00
James Nugent 25dbdc5187 Merge pull request #7127 from hashicorp/b-remote-state-fix
core + provider/terraform: Fix outputs in remote state
2016-06-11 17:16:19 +01:00
James Nugent bdc6a49ae3 provider/terraform: Fix outputs from remote state
The work integrated in hashicorp/terraform#6322 silently broke the
ability to use remote state correctly. This commit adds a fix for that,
making use of the work integrated in hashicorp/terraform#7124.

In order to deal with outputs which are complex structures, we use a
forked version of the flatmap package - the difference in the version
this commit vs the github.com/hashicorp/terraform/flatmap package is
that we add in an additional key for map counts which state requires.
Because we bypass the normal helper/schema mechanism, this is not set
for us.

Because of the HIL type checking of maps, values must be of a homogenous
type. This is unfortunate, as it means we can no longer refer to outputs
as:

    ${terraform_remote_state.foo.output.outputname}

Instead we had to bring them to the top level namespace:

    ${terraform_remote_state.foo.outputname}

This actually does lead to better overall usability - and the BC
breakage is made better by the fact that indexing would have broken the
original syntax anyway.

We also add a real-world test and assert against specific values. Tests
which were previously acceptance tests are now run as unit tests, so
regression should be identified at a much earlier stage.
2016-06-11 16:53:45 +01:00
James Nugent f51c9d5efd core: Fix interpolation of complex structures
This commit makes two changes: map interpolation can now read flatmapped
structures, such as those present in remote state outputs, and lists are
sorted by the index instead of the value.
2016-06-11 16:53:45 +01:00
Joe Topjian 8d78f9c4e1 Merge pull request #7120 from jtopjian/openstack-lbaas-updates
provider/openstack: lbaas v2 updates
2016-06-11 09:05:51 -06:00
James Nugent dbf725bd68 core: Allow dynamic attributes in helper/schema
The helper/schema framework for building providers previously validated
in all cases that each field being set in state was in the schema.
However, in order to support remote state in a usable fashion, the need
has arisen for the top level attributes of the resource to be created
dynamically. In order to still be able to use helper/schema, this commit
adds the capability to assign additional fields.

Though I do not forsee this being used by providers other than remote
state (and that eventually may move into Terraform Core rather than
being a provider), the usage and semantics are:

To opt into dynamic attributes, add a schema attribute named
"__has_dynamic_attributes", and make it an optional string with no
default value, in order that it does not appear in diffs:

        "__has_dynamic_attributes": {
            Type: schema.TypeString
            Optional: true
        }

In the read callback, use the d.UnsafeSetFieldRaw(key, value) function
to set the dynamic attributes.

Note that other fields in the schema _are_ copied into state, and that
the names of the schema fields cannot currently be used as dynamic
attribute names, as we check to ensure a value is not already set for a
given key.
2016-06-11 13:29:05 +01:00