Commit Graph

11396 Commits

Author SHA1 Message Date
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
Patrick Sodré 71dc5ea1c3 Add AccTest for tags with dots for Triton provider
- Tests for issue hashicorp/terraform#2143.
- Fixed package names since Triton deprecated the g3-series.
- Must supply SDC_URL when invoking tests.

Test will fail on metadata_3 but not on _2 as discussed with
@jen20 on 11 June 2016.
2016-06-11 22:19:18 -04: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
James Nugent 93a2703d46 Merge pull request #7126 from hashicorp/build-plugin-format-check
build: Remove format check from plugin-dev
2016-06-11 13:28:46 +01:00
James Nugent 3593ea8b0a build: Remove format check from plugin-dev
This is intended to reduce cycle time during provider development.
2016-06-11 13:27:08 +01:00
James Nugent 21f2728a17 Merge pull request #7125 from hashicorp/make-skip-bins
build: Skip running tests on /builtin/bins
2016-06-11 13:19:17 +01:00
James Nugent fb56c010fb Merge pull request #7124 from hashicorp/b-acceptance-test-as-normal-test
testing: Allow acceptance test to run as unit test
2016-06-11 13:10:01 +01:00
James Nugent 1b011dedf4 build: Skip running tests on /builtin/bins
This is time consuming and spams the output of Travis - to run no tests.
2016-06-11 13:09:19 +01:00
James Nugent 9c7cf639b3 testing: Allow acceptance test to run as unit test
This commit adds a flag to acceptance tests in order to make
appropriately named tests work during `make test` irrespective of the
TF_ACC environment variable. This should only be used on tests which are
known to be fast.
2016-06-11 12:55:14 +01:00
Paul Stack 5bf9a95f8c Update CHANGELOG.md 2016-06-11 12:28:48 +01:00
Paul Stack ab721e2ffc provider/azurerm: Fix `azurerm_virtual_machine` windows_config (#7123)
When using winrm config block, we had an address issue. This is no
longer a set but a list (As a list fits it more approp)

    ```
    make testacc TEST=./builtin/providers/azurerm
    TESTARGS='-run=TestAccAzureRMVirtualMachine_'
    ==> Checking that code complies with gofmt requirements...
    go generate $(go list ./... | grep -v /vendor/)
    TF_ACC=1 go test ./builtin/providers/azurerm -v
    -run=TestAccAzureRMVirtualMachine_ -timeout 120m
    === RUN   TestAccAzureRMVirtualMachine_basicLinuxMachine
    --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine (587.80s)
    === RUN   TestAccAzureRMVirtualMachine_tags
    --- PASS: TestAccAzureRMVirtualMachine_tags (554.53s)
    === RUN   TestAccAzureRMVirtualMachine_updateMachineSize
    --- PASS: TestAccAzureRMVirtualMachine_updateMachineSize (612.52s)
    === RUN   TestAccAzureRMVirtualMachine_basicWindowsMachine
    --- PASS: TestAccAzureRMVirtualMachine_basicWindowsMachine (765.90s)
    === RUN   TestAccAzureRMVirtualMachine_windowsUnattendedConfig
    --- PASS: TestAccAzureRMVirtualMachine_windowsUnattendedConfig
    (770.53s)
    === RUN   TestAccAzureRMVirtualMachine_winRMConfig
    --- PASS: TestAccAzureRMVirtualMachine_winRMConfig (827.90s)
    PASS
    ok      github.com/hashicorp/terraform/builtin/providers/azurerm
    4119.192s
    ```
2016-06-11 13:28:18 +02:00
Paul Stack b4ed5dfba3 provider/azurerm: VMSS Tests still used old naming convention (#7121) 2016-06-11 10:12:20 +02:00
Joe Topjian f563b24002 provider/openstack: lbaas v2 updates
This commit cleans up the acceptance test formatting for the lbaas v2
resources. It also modifies the devstack script to enable the lbaas
v2 service for testing. Finally, this commit increases the timeout
for load balancer creation since it takes some time to do within
devstack.
2016-06-11 04:20:44 +00:00
Paul Hinze 1c883b6854 Update CHANGELOG.md 2016-06-10 18:20:26 -05:00
Paul Hinze b0485db5f4
website: Remove `-backup` from `plan` docs
Refs #7087
2016-06-10 18:06:26 -05: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
Paul Stack 4d0db07183 Update CHANGELOG.md 2016-06-10 23:37:51 +01:00
Paul Stack 514d8422f3 provider/azurerm: Add `azurerm_virtual_machine_scale_set` resource (#6711) 2016-06-11 00:37:14 +02:00
Paul Stack 5e23e87c30 provider/aws: `aws_db_instance` change to the default for (#7118)
`publicly_accessible` to be false
2016-06-11 00:13:53 +02:00
Paul Hinze bba5a38c95 Merge pull request #7116 from hashicorp/b-aws-map-list-test-merrymaking
provider/aws: Clean up some map/set test checks
2016-06-10 16:57:24 -05:00
Paul Stack 5c2320d4d9 Update CHANGELOG.md 2016-06-10 22:56:12 +01:00
Paul Hinze 133b65d2ca Merge pull request #7040 from jritsema/master
Clarify HTTP URL module source docs
2016-06-10 16:56:00 -05:00
Paul Stack 5ecc8e3169 provider/aws: `aws_db_instance` now defaults `publicly_accessible` to (#7117)
false

Fixes #7035

A known issue in Terraform means that d.GetOk() on a bool which is false
will mean it doesn't get evaulated. Therefore, when people set
publicly_accessible to false, it will never get evaluated on the Create

We are going to make it default to false now
2016-06-10 23:55:36 +02:00
Paul Stack 2d4c0be268 Update CHANGELOG.md 2016-06-10 22:55:18 +01:00
Paul Hinze 00d004394c Merge pull request #7109 from hashicorp/f-state-lineage
core: State "Lineage" concept
2016-06-10 16:54:31 -05:00