Commit Graph

8715 Commits

Author SHA1 Message Date
Paul Hinze e76fdb92e7 core: fix bug detecting deeply nested module orphans
Context:

As part of building up a Plan, Terraform needs to detect "orphaned"
resources--resources which are present in the state but not in the
config. This happens when config for those resources is removed by the
user, making it Terraform's responsibility to destroy them.

Both state and config are organized by Module into a logical tree, so
the process of finding orphans involves checking for orphaned Resources
in the current module and for orphaned Modules, which themselves will
have all their Resources marked as orphans.

Bug:

In #3114 a problem was exposed where, given a module tree that looked
like this:

```
root
 |
 +-- parent (empty, except for sub-modules)
       |
       +-- child1 (1 resource)
       |
       +-- child2 (1 resource)
```

If `parent` was removed, a bunch of error messages would occur during
the plan. The root cause of this was duplicate orphans appearing for the
resources in child1 and child2.

Fix:

This turned out to be a bug in orphaned module detection. When looking
for deeply nested orphaned modules, root.parent was getting added twice
as an orphaned module to the graph.

Here, we add an additional check to prevent a double add, which
addresses this scenario properly.

Fixes #3114 (the Provisioner side of it was fixed in #4877)
2016-02-09 10:35:46 -06:00
Paul Hinze 3f72837f4b core: Make copies when creating destroy nodes
Fixes an interpolation race that was occurring when a tainted destroy
node and a primary destroy node both tried to interpolate a computed
count in their config. Since they were sharing a pointer to the _same_
config, depending on how the race played out one of them could catch the
config uninterpolated and would then throw a syntax error.

The `Copy()` tree implemented for this fix can probably be used
elsewhere - basically we should copy the config whenever we drop nodes
into the graph - but for now I'm just applying it to the place that
fixes this bug.

Fixes #4982 - Includes a test covering that race condition.
2016-02-09 09:25:16 -06:00
Sander van Harmelen ac0cbd400e Add `attributes_json` param for consistency
Add `attributes_json` param for both consistency and easier management
of deprecating the old `attributes` param.
2016-02-09 11:11:46 +01:00
Trevor Pounds 164596880a Update acceptance test to use t2.micro instances.
The AWS free tier allows up to 750 hours on t2.micro
instance types. It's better to use cheaper instances
in case the resources are not cleaned up if a tests
is canceled or crashes.
2016-02-09 00:24:38 -08:00
Trevor Pounds 5801b991c9 Cleanup unrelated config to speed up autogenerate name acc test.
Removes overspecified config that is unrelated to testing the auto scaling
group's autogenerated name. The test is only concerned with checking that
the auto scaling group was created successfully with an autogenerated name
matching a specific pattern.
2016-02-08 21:28:35 -08:00
Trevor Pounds eba605fa6a Cleanup unrelated config to speed up AZ/VPC acc tests.
Removes overspecified config that is unrelated to the auto scaling
group's availability zone and VPC identifier acceptance tests. The
created auto scaling groups do not need to spin up any hosts since
the acceptance tests are only concerned with checking the existence
of the associated availability zones and VPC identifiers.
2016-02-08 19:55:11 -08:00
James Nugent 73102aba42 Update CHANGELOG.md 2016-02-08 18:01:22 -05: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
James Nugent 1ff5f6fb0c Merge pull request #5060 from stack72/f-lint-changes
Fixing some golint issues on the new validate command
2016-02-08 17:58:17 -05:00
stack72 1628f19bc1 Fixing some golint issues on the new validate command 2016-02-08 22:04:24 +00:00
James Nugent d3daf3e917 Update CHANGELOG.md 2016-02-08 16:44:46 -05:00
James Nugent dad70e4659 Merge pull request #5057 from stack72/azurerm-sql-firewall-rule
provider/azurerm: Add `azurerm_sql_firewall_rule` resource
2016-02-08 16:43:30 -05:00
Paul Stack 62fe83cf54 Update CHANGELOG.md 2016-02-08 21:38:18 +00:00
Paul Stack 4baa8fa691 Merge pull request #5044 from tpounds/fix-read-aws-asg-az
provider/aws: Fix reading auto scaling group availability zones
2016-02-08 21:37:23 +00:00
stack72 584b52c34c provider/azurerm: Add `azurerm_sql_firewall_rule` resource 2016-02-08 21:13:59 +00:00
Radek Simko f57068bbd5 Update CHANGELOG.md 2016-02-08 21:06:50 +00:00
Radek Simko 05b6af5d83 Merge pull request #5051 from TimeIncOSS/f-aws-cloudtrail-fields
provider/aws: Add support for CloudTrail log validation + KMS encryption
2016-02-08 21:05:35 +00:00
Paul Stack 82206ff3be Update CHANGELOG.md 2016-02-08 19:48:22 +00:00
Paul Stack 6d33234e1e Update CHANGELOG.md 2016-02-08 19:48:02 +00:00
Paul Stack 83b1c4ae52 Merge pull request #5045 from tpounds/fix-read-aws-asg-elbs
provider/aws: Fix reading auto scaling group load balancers
2016-02-08 19:47:22 +00:00
Sander van Harmelen f6822dcb7d Merge pull request #4999 from svanharmelen/f-rename-missing-provider-node
Rename `graphNodeMissingProvider` to `graphNodeProvider`
2016-02-08 20:32:03 +01:00
Radek Simko 276e8fe932 Update CHANGELOG.md 2016-02-08 12:37:11 +00:00
Radek Simko 7fed07a0a2 docs: Clarify use cases in docs for the validate cmd 2016-02-08 12:36:30 +00:00
Radek Simko e968bfd55e Merge pull request #3783 from sorenmat/verify
Added validate command
2016-02-08 12:21:13 +00:00
Radek Simko d8de124c89 provider/aws: Document log file validation + KMS Key ID in CloudTrail 2016-02-08 11:53:40 +00:00
Radek Simko 531e60047b provider/aws: Add support for CloudTrail log validation + KMS encryption 2016-02-08 11:51:25 +00:00
Soren Mathiasen db69a2959b Added verify command 2016-02-08 12:48:14 +01:00
Trevor Pounds 0cd0ff0f8e Use built-in schema.HashString. 2016-02-07 16:29:34 -08:00
Trevor Pounds 8ceeaaf7ff Fix load balancers read logic. 2016-02-07 15:00:21 -08:00
James Nugent 819db3469e Update CHANGELOG.md 2016-02-07 17:56:29 -05:00
James Nugent a79563ee28 Merge pull request #5042 from stack72/f-cloudflare-record-ttl-computed
provider/cloudflare: Change CloudFlare record TTL property to be `computed`
2016-02-07 17:54:24 -05:00
James Nugent 815df069c0 Merge pull request #5041 from stack72/azurerm-dns-recordsets-2
provider/azurerm: MX, SRV, TXT and NS Resources
2016-02-07 17:53:23 -05:00
stack72 46f51b7bd8 provider/cloudflare: Change CloudFlare record TTL property to be
`computed`
2016-02-07 22:33:21 +00:00
stack72 81b50330a1 provider/azurerm: Add `azurerm_dns_mx_record` resource 2016-02-07 22:26:56 +00:00
Trevor Pounds dac7226a8e Check calculated availability zones. 2016-02-07 14:24:31 -08:00
Trevor Pounds 37eb1cba88 Make availability zones a computed attribute.
Fixes a diff calculation error when only a VPC zone
identifiers is provided. In this case the associated
availability zones are computed from the subnets per
the AWS documentation.
2016-02-07 14:14:00 -08:00
Trevor Pounds e0f4be47a8 Remove redundant metadata get. 2016-02-07 14:14:00 -08:00
Trevor Pounds cd42705bf1 Fix availability zones read logic. 2016-02-07 14:14:00 -08:00
stack72 8ac4d2e080 provider/azurerm: Add `azurerm_dns_srv_record` resource 2016-02-07 21:49:02 +00:00
James Nugent 2baff8ad22 Merge pull request #5039 from TimeIncOSS/b-update-hil
Update vendored hashicorp/hil
2016-02-07 15:47:40 -05:00
Radek Simko d437ca5924 Update vendored hashicorp/hil 2016-02-07 20:43:23 +00:00
Radek Simko 8b3f4a82b0 Update CHANGELOG.md 2016-02-07 20:30:44 +00:00
Radek Simko 14e6f6e4ce docs: Clarify example usage of the signum function 2016-02-07 20:28:58 +00:00
Radek Simko 4edf782260 Merge pull request #4854 from jfromaniello/add_signum_interpolation
Add signum interpolation function
2016-02-07 19:44:16 +00:00
Paul Stack 862c5d958f Update CHANGELOG.md 2016-02-06 23:49:31 +00:00
Paul Stack 00ea9c969d Merge pull request #4943 from stack72/f-aws-dynamodbtable-refresh
provider/aws: DynamoDB Table Refresh State on Error
2016-02-06 23:47:41 +00:00
Cameron Stokes 24f034a2c6 Acc tests for aws_vpn_connection tunnel attributes. 2016-02-06 14:00:26 -08:00
Cameron Stokes a239a2a125 Add docs for new aws_vpn_connection attributes. 2016-02-06 12:49:55 -08:00
Cameron Stokes 6a5cb5b109 Provide tunnel info from XML config. 2016-02-06 12:39:49 -08:00
stack72 f9ffeae0f6 provider/azurerm: Add `azurerm_dns_ns_record` resource 2016-02-06 19:09:52 +00:00