Skip to content

Commit e406659

Browse files
committed
providers/consul: tests passing, compiling
1 parent aafbc2a commit e406659

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

builtin/providers/consul/resource_consul_keys.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ func resource_consul_keys_validation() *config.Validator {
2727
}
2828
}
2929
func resource_consul_keys_update(
30-
s *terraform.ResourceState,
30+
s *terraform.InstanceState,
3131
d *terraform.ResourceDiff,
32-
meta interface{}) (*terraform.ResourceState, error) {
32+
meta interface{}) (*terraform.InstanceState, error) {
3333
return resource_consul_keys_create(s, d, meta)
3434
}
3535

3636
func resource_consul_keys_create(
37-
s *terraform.ResourceState,
37+
s *terraform.InstanceState,
3838
d *terraform.ResourceDiff,
39-
meta interface{}) (*terraform.ResourceState, error) {
39+
meta interface{}) (*terraform.InstanceState, error) {
4040
p := meta.(*ResourceProvider)
4141

4242
// Merge the diff into the state so that we have all the attributes
@@ -97,7 +97,7 @@ func resource_consul_keys_create(
9797
}
9898

9999
func resource_consul_keys_destroy(
100-
s *terraform.ResourceState,
100+
s *terraform.InstanceState,
101101
meta interface{}) error {
102102
p := meta.(*ResourceProvider)
103103
client := p.client
@@ -132,7 +132,7 @@ func resource_consul_keys_destroy(
132132
}
133133

134134
func resource_consul_keys_diff(
135-
s *terraform.ResourceState,
135+
s *terraform.InstanceState,
136136
c *terraform.ResourceConfig,
137137
meta interface{}) (*terraform.ResourceDiff, error) {
138138

@@ -162,8 +162,8 @@ AFTER:
162162
}
163163

164164
func resource_consul_keys_refresh(
165-
s *terraform.ResourceState,
166-
meta interface{}) (*terraform.ResourceState, error) {
165+
s *terraform.InstanceState,
166+
meta interface{}) (*terraform.InstanceState, error) {
167167
p := meta.(*ResourceProvider)
168168
client := p.client
169169
kv := client.KV()

builtin/providers/consul/resource_consul_keys_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ func testAccCheckConsulKeysExists() resource.TestCheckFunc {
5858

5959
func testAccCheckConsulKeysValue(n, attr, val string) resource.TestCheckFunc {
6060
return func(s *terraform.State) error {
61-
rn, ok := s.Resources[n]
61+
rn, ok := s.RootModule().Resources[n]
6262
if !ok {
6363
return fmt.Errorf("Resource not found")
6464
}
65-
out, ok := rn.Attributes["var."+attr]
65+
out, ok := rn.Primary.Attributes["var."+attr]
6666
if !ok {
67-
return fmt.Errorf("Attribute '%s' not found: %#v", attr, rn.Attributes)
67+
return fmt.Errorf("Attribute '%s' not found: %#v", attr, rn.Primary.Attributes)
6868
}
6969
if val != "<any>" && out != val {
7070
return fmt.Errorf("Attribute '%s' value '%s' != '%s'", attr, out, val)

builtin/providers/consul/resource_provider.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,23 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
4343
}
4444

4545
func (p *ResourceProvider) Apply(
46-
s *terraform.ResourceState,
47-
d *terraform.ResourceDiff) (*terraform.ResourceState, error) {
48-
return resourceMap.Apply(s, d, p)
46+
info *terraform.InstanceInfo,
47+
s *terraform.InstanceState,
48+
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
49+
return resourceMap.Apply(info, s, d, p)
4950
}
5051

5152
func (p *ResourceProvider) Diff(
52-
s *terraform.ResourceState,
53+
info *terraform.InstanceInfo,
54+
s *terraform.InstanceState,
5355
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
54-
return resourceMap.Diff(s, c, p)
56+
return resourceMap.Diff(info, s, c, p)
5557
}
5658

5759
func (p *ResourceProvider) Refresh(
58-
s *terraform.ResourceState) (*terraform.ResourceState, error) {
59-
return resourceMap.Refresh(s, p)
60+
info *terraform.InstanceInfo,
61+
s *terraform.InstanceState) (*terraform.InstanceState, error) {
62+
return resourceMap.Refresh(info, s, p)
6063
}
6164

6265
func (p *ResourceProvider) Resources() []terraform.ResourceType {

0 commit comments

Comments
 (0)