Skip to content

Commit 1fac7b6

Browse files
committed
state: cache should use State.Equal to check equality
reflect.DeepEqual was returning false, sometimes.
1 parent c9fe0c1 commit 1fac7b6

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
## 0.4.1 (unreleased)
22

3+
BUG FIXES:
34

5+
* command/remote-config: remove spurrious error "nil" when initializing
6+
remote state on a new configuration. [GH-1392]
47

58
## 0.4.0 (April 2, 2015)
69

@@ -13,7 +16,7 @@ BACKWARDS INCOMPATIBILITIES:
1316
* Period-prefixed configuration files are now ignored. This might break
1417
existing Terraform configurations if you had period-prefixed files.
1518
* The `block_device` attribute of `aws_instance` has been removed in favor
16-
of three more specific attributes to specify block device mappings:
19+
of three more specific attributes to specify block device mappings:
1720
`root_block_device`, `ebs_block_device`, and `ephemeral_block_device`.
1821
Configurations using the old attribute will generate a validation error
1922
indicating that they must be updated to use the new fields [GH-1045].

‎command/state.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ func remoteState(
255255
"Error preparing remote state: {{err}}", err)
256256
}
257257
default:
258-
return nil, errwrap.Wrapf(
259-
"Error initilizing remote state: {{err}}", err)
258+
return nil, fmt.Errorf(
259+
"Unknown refresh result: %s", cache.RefreshResult())
260260
}
261261
}
262262

‎state/cache.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package state
22

33
import (
44
"fmt"
5-
"reflect"
65

76
"github.com/hashicorp/terraform/terraform"
87
)
@@ -77,7 +76,7 @@ func (s *CacheState) RefreshState() error {
7776
s.refreshResult = CacheRefreshUpdateLocal
7877
case durable.Serial == cached.Serial:
7978
// They're supposedly equal, verify.
80-
if reflect.DeepEqual(cached, durable) {
79+
if cached.Equal(durable) {
8180
// Hashes are the same, everything is great
8281
s.refreshResult = CacheRefreshNoop
8382
break

0 commit comments

Comments
 (0)