ResourceDiff => InstanceDiff

This commit is contained in:
Mitchell Hashimoto 2014-09-17 16:33:24 -07:00
parent 0a6c675fba
commit 9b2b3a963f
59 changed files with 285 additions and 285 deletions

View File

@ -14,7 +14,7 @@ import (
func resource_aws_autoscaling_group_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
autoscalingconn := p.autoscalingconn
@ -94,7 +94,7 @@ func resource_aws_autoscaling_group_create(
func resource_aws_autoscaling_group_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
autoscalingconn := p.autoscalingconn
@ -187,7 +187,7 @@ func resource_aws_autoscaling_group_refresh(
func resource_aws_autoscaling_group_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -17,7 +17,7 @@ import (
func resource_aws_db_instance_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
conn := p.rdsconn
@ -137,7 +137,7 @@ func resource_aws_db_instance_create(
func resource_aws_db_instance_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
panic("Cannot update DB")
}
@ -201,7 +201,7 @@ func resource_aws_db_instance_refresh(
func resource_aws_db_instance_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -16,7 +16,7 @@ import (
func resource_aws_db_security_group_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
conn := p.rdsconn
@ -86,7 +86,7 @@ func resource_aws_db_security_group_create(
func resource_aws_db_security_group_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
panic("Cannot update DB security group")
}
@ -133,7 +133,7 @@ func resource_aws_db_security_group_refresh(
func resource_aws_db_security_group_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -14,7 +14,7 @@ import (
func resource_aws_elb_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
elbconn := p.elbconn
@ -125,7 +125,7 @@ func resource_aws_elb_create(
func resource_aws_elb_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
elbconn := p.elbconn
@ -251,7 +251,7 @@ func resource_aws_elb_refresh(
func resource_aws_elb_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -13,7 +13,7 @@ import (
func resource_aws_internet_gateway_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -36,7 +36,7 @@ func resource_aws_internet_gateway_create(
func resource_aws_internet_gateway_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -128,7 +128,7 @@ func resource_aws_internet_gateway_refresh(
func resource_aws_internet_gateway_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"vpc_id": diff.AttrTypeUpdate,

View File

@ -13,7 +13,7 @@ import (
func resource_aws_launch_configuration_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
autoscalingconn := p.autoscalingconn
@ -76,7 +76,7 @@ func resource_aws_launch_configuration_create(
func resource_aws_launch_configuration_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
panic("Update for AWS Launch Configuration is not supported")
}
@ -120,7 +120,7 @@ func resource_aws_launch_configuration_refresh(
func resource_aws_launch_configuration_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -29,7 +29,7 @@ func resource_aws_r53_record_validation() *config.Validator {
func resource_aws_r53_record_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
conn := p.route53
@ -234,7 +234,7 @@ func resource_aws_r53_record_update_state(
func resource_aws_r53_record_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"zone_id": diff.AttrTypeCreate,

View File

@ -22,7 +22,7 @@ func resource_aws_r53_zone_validation() *config.Validator {
func resource_aws_r53_zone_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
r53 := p.route53
@ -109,7 +109,7 @@ func resource_aws_r53_zone_refresh(
func resource_aws_r53_zone_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -15,7 +15,7 @@ import (
func resource_aws_route_table_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -57,7 +57,7 @@ func resource_aws_route_table_create(
func resource_aws_route_table_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -208,7 +208,7 @@ func resource_aws_route_table_refresh(
func resource_aws_route_table_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"vpc_id": diff.AttrTypeCreate,

View File

@ -11,7 +11,7 @@ import (
func resource_aws_route_table_association_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -37,7 +37,7 @@ func resource_aws_route_table_association_create(
func resource_aws_route_table_association_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -122,7 +122,7 @@ func resource_aws_route_table_association_refresh(
func resource_aws_route_table_association_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"subnet_id": diff.AttrTypeCreate,

View File

@ -23,7 +23,7 @@ func resource_aws_s3_bucket_validation() *config.Validator {
func resource_aws_s3_bucket_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
s3conn := p.s3conn
@ -82,7 +82,7 @@ func resource_aws_s3_bucket_refresh(
func resource_aws_s3_bucket_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -13,7 +13,7 @@ import (
func resource_aws_subnet_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -61,7 +61,7 @@ func resource_aws_subnet_create(
func resource_aws_subnet_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
// This should never be called because we have no update-able
// attributes
@ -122,7 +122,7 @@ func resource_aws_subnet_refresh(
func resource_aws_subnet_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"availability_zone": diff.AttrTypeCreate,

View File

@ -14,7 +14,7 @@ import (
func resource_aws_vpc_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -90,7 +90,7 @@ func resource_aws_vpc_create(
func resource_aws_vpc_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
ec2conn := p.ec2conn
@ -182,7 +182,7 @@ func resource_aws_vpc_refresh(
func resource_aws_vpc_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{
"cidr_block": diff.AttrTypeCreate,

View File

@ -93,7 +93,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
if _, ok := p.p.ResourcesMap[info.Type]; ok {
return p.p.Apply(info, s, d)
}
@ -104,7 +104,7 @@ func (p *ResourceProvider) Apply(
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if _, ok := p.p.ResourcesMap[info.Type]; ok {
return p.p.Diff(info, s, c)
}

View File

@ -12,7 +12,7 @@ import (
func resource_cloudflare_record_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -52,7 +52,7 @@ func resource_cloudflare_record_create(
func resource_cloudflare_record_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -119,7 +119,7 @@ func resource_cloudflare_record_refresh(
func resource_cloudflare_record_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -49,14 +49,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
return resourceMap.Apply(info, s, d, p)
}
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return resourceMap.Diff(info, s, c, p)
}

View File

@ -28,14 +28,14 @@ func resource_consul_keys_validation() *config.Validator {
}
func resource_consul_keys_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
return resource_consul_keys_create(s, d, meta)
}
func resource_consul_keys_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
@ -134,7 +134,7 @@ func resource_consul_keys_destroy(
func resource_consul_keys_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
// Determine the list of computed variables
var computed []string

View File

@ -45,14 +45,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
return resourceMap.Apply(info, s, d, p)
}
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return resourceMap.Diff(info, s, c, p)
}

View File

@ -16,7 +16,7 @@ import (
func resource_digitalocean_droplet_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -91,7 +91,7 @@ func resource_digitalocean_droplet_create(
func resource_digitalocean_droplet_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -238,7 +238,7 @@ func resource_digitalocean_droplet_refresh(
func resource_digitalocean_droplet_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -57,7 +57,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
if _, ok := p.p.ResourcesMap[info.Type]; ok {
return p.p.Apply(info, s, d)
}
@ -68,7 +68,7 @@ func (p *ResourceProvider) Apply(
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if _, ok := p.p.ResourcesMap[info.Type]; ok {
return p.p.Diff(info, s, c)
}

View File

@ -12,7 +12,7 @@ import (
func resource_dnsimple_record_create(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -54,7 +54,7 @@ func resource_dnsimple_record_create(
func resource_dnsimple_record_update(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
p := meta.(*ResourceProvider)
client := p.client
@ -127,7 +127,7 @@ func resource_dnsimple_record_refresh(
func resource_dnsimple_record_diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
b := &diff.ResourceBuilder{
Attrs: map[string]diff.AttrType{

View File

@ -49,14 +49,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
return resourceMap.Apply(info, s, d, p)
}
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return resourceMap.Diff(info, s, c, p)
}

View File

@ -142,7 +142,7 @@ func TestApply_error(t *testing.T) {
p.ApplyFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
lock.Lock()
defer lock.Unlock()
@ -156,8 +156,8 @@ func TestApply_error(t *testing.T) {
p.DiffFn = func(
*terraform.InstanceInfo,
*terraform.InstanceState,
*terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
return &terraform.ResourceDiff{
*terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ami": &terraform.ResourceAttrDiff{
New: "bar",
@ -464,8 +464,8 @@ func TestApply_shutdown(t *testing.T) {
p.DiffFn = func(
*terraform.InstanceInfo,
*terraform.InstanceState,
*terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
return &terraform.ResourceDiff{
*terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ami": &terraform.ResourceAttrDiff{
New: "bar",
@ -476,7 +476,7 @@ func TestApply_shutdown(t *testing.T) {
p.ApplyFn = func(
*terraform.InstanceInfo,
*terraform.InstanceState,
*terraform.ResourceDiff) (*terraform.InstanceState, error) {
*terraform.InstanceDiff) (*terraform.InstanceState, error) {
if !stopped {
stopped = true
close(stopCh)
@ -554,7 +554,7 @@ func TestApply_state(t *testing.T) {
statePath := testStateFile(t, originalState)
p := testProvider()
p.DiffReturn = &terraform.ResourceDiff{
p.DiffReturn = &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ami": &terraform.ResourceAttrDiff{
New: "bar",
@ -663,12 +663,12 @@ func TestApply_vars(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}
return &terraform.ResourceDiff{}, nil
return &terraform.InstanceDiff{}, nil
}
args := []string{
@ -706,12 +706,12 @@ func TestApply_varFile(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}
return &terraform.ResourceDiff{}, nil
return &terraform.InstanceDiff{}, nil
}
args := []string{
@ -759,12 +759,12 @@ func TestApply_varFileDefault(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}
return &terraform.ResourceDiff{}, nil
return &terraform.InstanceDiff{}, nil
}
args := []string{
@ -801,7 +801,7 @@ func TestApply_backup(t *testing.T) {
backupPath := testTempFile(t)
p := testProvider()
p.DiffReturn = &terraform.ResourceDiff{
p.DiffReturn = &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ami": &terraform.ResourceAttrDiff{
New: "bar",
@ -885,7 +885,7 @@ func TestApply_disableBackup(t *testing.T) {
statePath := testStateFile(t, originalState)
p := testProvider()
p.DiffReturn = &terraform.ResourceDiff{
p.DiffReturn = &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ami": &terraform.ResourceAttrDiff{
New: "bar",

View File

@ -104,7 +104,7 @@ func testStateFile(t *testing.T, s *terraform.State) string {
func testProvider() *terraform.MockResourceProvider {
p := new(terraform.MockResourceProvider)
p.DiffReturn = &terraform.ResourceDiff{}
p.DiffReturn = &terraform.InstanceDiff{}
p.RefreshFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState) (*terraform.InstanceState, error) {

View File

@ -40,7 +40,7 @@ func (h *CountHook) Reset() {
func (h *CountHook) PreApply(
id string,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (terraform.HookAction, error) {
d *terraform.InstanceDiff) (terraform.HookAction, error) {
h.Lock()
defer h.Unlock()

View File

@ -36,7 +36,7 @@ const (
func (h *UiHook) PreApply(
id string,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (terraform.HookAction, error) {
d *terraform.InstanceDiff) (terraform.HookAction, error) {
h.once.Do(h.init)
op := uiResourceModify

View File

@ -146,7 +146,7 @@ func TestOutput_noVars(t *testing.T) {
originalState := &terraform.State{
Modules: []*terraform.ModuleState{
&terraform.ModuleState{
Path: []string{"root"},
Path: []string{"root"},
Outputs: map[string]string{},
},
},

View File

@ -149,7 +149,7 @@ func TestPlan_outPath(t *testing.T) {
},
}
p.DiffReturn = &terraform.ResourceDiff{
p.DiffReturn = &terraform.InstanceDiff{
Destroy: true,
}
@ -332,7 +332,7 @@ func TestPlan_vars(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}
@ -372,7 +372,7 @@ func TestPlan_varFile(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}
@ -422,7 +422,7 @@ func TestPlan_varFileDefault(t *testing.T) {
p.DiffFn = func(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
if v, ok := c.Config["value"]; ok {
actual = v.(string)
}

View File

@ -29,7 +29,7 @@ func testConfig(
return terraform.NewResourceConfig(rc)
}
func testResourceDiffStr(rd *terraform.ResourceDiff) string {
func testResourceDiffStr(rd *terraform.InstanceDiff) string {
var buf bytes.Buffer
crud := "UPDATE"

View File

@ -62,7 +62,7 @@ type PreProcessFunc func(string) string
// configuration.
func (b *ResourceBuilder) Diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
attrs := make(map[string]*terraform.ResourceAttrDiff)
// We require a new resource if the ID is empty. Or, later, we set
@ -207,9 +207,9 @@ func (b *ResourceBuilder) Diff(
}
// Build our resulting diff if we had attributes change
var result *terraform.ResourceDiff
var result *terraform.InstanceDiff
if len(attrs) > 0 {
result = &terraform.ResourceDiff{
result = &terraform.InstanceDiff{
Attributes: attrs,
}
}

View File

@ -33,7 +33,7 @@ func (m *Map) Validate(
func (m *Map) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
r, ok := m.Mapping[info.Type]
if !ok {
@ -87,7 +87,7 @@ func (m *Map) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig,
meta interface{}) (*terraform.ResourceDiff, error) {
meta interface{}) (*terraform.InstanceDiff, error) {
r, ok := m.Mapping[info.Type]
if !ok {
return nil, fmt.Errorf("Unknown resource type: %s", info.Type)

View File

@ -18,7 +18,7 @@ type Resource struct {
// exist.
type CreateFunc func(
*terraform.InstanceState,
*terraform.ResourceDiff,
*terraform.InstanceDiff,
interface{}) (*terraform.InstanceState, error)
// DestroyFunc is a function that destroys a resource that previously
@ -31,7 +31,7 @@ type DestroyFunc func(
type DiffFunc func(
*terraform.InstanceState,
*terraform.ResourceConfig,
interface{}) (*terraform.ResourceDiff, error)
interface{}) (*terraform.InstanceDiff, error)
// RefreshFunc is a function that performs a refresh of a specific type
// of resource.
@ -45,5 +45,5 @@ type RefreshFunc func(
// a new resource.
type UpdateFunc func(
*terraform.InstanceState,
*terraform.ResourceDiff,
*terraform.InstanceDiff,
interface{}) (*terraform.InstanceState, error)

View File

@ -261,7 +261,7 @@ func (t *mockT) failMessage() string {
func testProvider() *terraform.MockResourceProvider {
mp := new(terraform.MockResourceProvider)
mp.DiffReturn = &terraform.ResourceDiff{
mp.DiffReturn = &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
New: "bar",

View File

@ -138,7 +138,7 @@ func (p *Provider) Configure(c *terraform.ResourceConfig) error {
func (p *Provider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
@ -151,7 +151,7 @@ func (p *Provider) Apply(
func (p *Provider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
r, ok := p.ResourcesMap[info.Type]
if !ok {
return nil, fmt.Errorf("unknown resource type: %s", info.Type)

View File

@ -62,7 +62,7 @@ type DeleteFunc func(*ResourceData, interface{}) error
// Apply creates, updates, and/or deletes a resource.
func (r *Resource) Apply(
s *terraform.InstanceState,
d *terraform.ResourceDiff,
d *terraform.InstanceDiff,
meta interface{}) (*terraform.InstanceState, error) {
data, err := schemaMap(r.Schema).Data(s, d)
if err != nil {
@ -112,7 +112,7 @@ func (r *Resource) Apply(
// ResourceProvider interface.
func (r *Resource) Diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
return schemaMap(r.Schema).Diff(s, c)
}

View File

@ -24,7 +24,7 @@ type ResourceData struct {
schema map[string]*Schema
config *terraform.ResourceConfig
state *terraform.InstanceState
diff *terraform.ResourceDiff
diff *terraform.InstanceDiff
diffing bool
// Don't set

View File

@ -11,7 +11,7 @@ func TestResourceDataGet(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Key string
Value interface{}
}{
@ -27,7 +27,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "foo",
@ -53,7 +53,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -80,7 +80,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -133,7 +133,7 @@ func TestResourceDataGet(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "foo",
@ -273,7 +273,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ingress.#": &terraform.ResourceAttrDiff{
Old: "",
@ -311,7 +311,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ingress.#": &terraform.ResourceAttrDiff{
Old: "",
@ -366,7 +366,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -398,7 +398,7 @@ func TestResourceDataGet(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.#": &terraform.ResourceAttrDiff{
Old: "0",
@ -482,7 +482,7 @@ func TestResourceDataGet(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -550,7 +550,7 @@ func TestResourceDataGetChange(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Key string
OldValue interface{}
NewValue interface{}
@ -567,7 +567,7 @@ func TestResourceDataGetChange(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -599,7 +599,7 @@ func TestResourceDataGetChange(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -636,7 +636,7 @@ func TestResourceDataGetOk(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Key string
Value interface{}
Ok bool
@ -656,7 +656,7 @@ func TestResourceDataGetOk(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -799,7 +799,7 @@ func TestResourceDataHasChange(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Key string
Change bool
}{
@ -815,7 +815,7 @@ func TestResourceDataHasChange(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -846,7 +846,7 @@ func TestResourceDataHasChange(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -879,7 +879,7 @@ func TestResourceDataSet(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Key string
Value interface{}
Err bool
@ -1395,7 +1395,7 @@ func TestResourceDataState(t *testing.T) {
cases := []struct {
Schema map[string]*Schema
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Set map[string]interface{}
Result *terraform.InstanceState
Partial []string
@ -1413,7 +1413,7 @@ func TestResourceDataState(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -1443,7 +1443,7 @@ func TestResourceDataState(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -1500,7 +1500,7 @@ func TestResourceDataState(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -1534,7 +1534,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -1580,7 +1580,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ingress.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -1628,7 +1628,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.0.bar": &terraform.ResourceAttrDiff{
NewRemoved: true,
@ -1671,7 +1671,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -1707,7 +1707,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -1777,7 +1777,7 @@ func TestResourceDataState(t *testing.T) {
State: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -1811,7 +1811,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -1858,7 +1858,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ingress.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -1907,7 +1907,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.0.bar": &terraform.ResourceAttrDiff{
NewRemoved: true,
@ -1956,7 +1956,7 @@ func TestResourceDataState(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.1": &terraform.ResourceAttrDiff{
New: "120",

View File

@ -27,7 +27,7 @@ func TestResourceApply_create(t *testing.T) {
var s *terraform.InstanceState = nil
d := &terraform.ResourceDiff{
d := &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
New: "42",
@ -77,7 +77,7 @@ func TestResourceApply_destroy(t *testing.T) {
ID: "bar",
}
d := &terraform.ResourceDiff{
d := &terraform.InstanceDiff{
Destroy: true,
}
@ -117,7 +117,7 @@ func TestResourceApply_destroyPartial(t *testing.T) {
},
}
d := &terraform.ResourceDiff{
d := &terraform.InstanceDiff{
Destroy: true,
}
@ -161,7 +161,7 @@ func TestResourceApply_update(t *testing.T) {
},
}
d := &terraform.ResourceDiff{
d := &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
New: "13",
@ -206,7 +206,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) {
},
}
d := &terraform.ResourceDiff{
d := &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
New: "13",

View File

@ -163,7 +163,7 @@ type schemaMap map[string]*Schema
// The diff is optional.
func (m schemaMap) Data(
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*ResourceData, error) {
d *terraform.InstanceDiff) (*ResourceData, error) {
return &ResourceData{
schema: m,
state: s,
@ -175,8 +175,8 @@ func (m schemaMap) Data(
// state, and configuration.
func (m schemaMap) Diff(
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
result := new(terraform.ResourceDiff)
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
result := new(terraform.InstanceDiff)
result.Attributes = make(map[string]*terraform.ResourceAttrDiff)
d := &ResourceData{
@ -199,7 +199,7 @@ func (m schemaMap) Diff(
// caused that.
if result.RequiresNew() {
// Create the new diff
result2 := new(terraform.ResourceDiff)
result2 := new(terraform.InstanceDiff)
result2.Attributes = make(map[string]*terraform.ResourceAttrDiff)
// Reset the data to not contain state
@ -344,7 +344,7 @@ func (m schemaMap) InternalValidate() error {
func (m schemaMap) diff(
k string,
schema *Schema,
diff *terraform.ResourceDiff,
diff *terraform.InstanceDiff,
d *ResourceData) error {
var err error
switch schema.Type {
@ -370,7 +370,7 @@ func (m schemaMap) diff(
func (m schemaMap) diffList(
k string,
schema *Schema,
diff *terraform.ResourceDiff,
diff *terraform.InstanceDiff,
d *ResourceData) error {
o, n, _ := d.diffChange(k)
@ -465,7 +465,7 @@ func (m schemaMap) diffList(
func (m schemaMap) diffMap(
k string,
schema *Schema,
diff *terraform.ResourceDiff,
diff *terraform.InstanceDiff,
d *ResourceData) error {
//elemSchema := &Schema{Type: TypeString}
prefix := k + "."
@ -507,7 +507,7 @@ func (m schemaMap) diffMap(
func (m schemaMap) diffSet(
k string,
schema *Schema,
diff *terraform.ResourceDiff,
diff *terraform.InstanceDiff,
d *ResourceData) error {
return m.diffList(k, schema, diff, d)
}
@ -515,7 +515,7 @@ func (m schemaMap) diffSet(
func (m schemaMap) diffString(
k string,
schema *Schema,
diff *terraform.ResourceDiff,
diff *terraform.InstanceDiff,
d *ResourceData) error {
var originalN interface{}
var os, ns string

View File

@ -14,7 +14,7 @@ func TestSchemaMap_Diff(t *testing.T) {
State *terraform.InstanceState
Config map[string]interface{}
ConfigVariables map[string]string
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Err bool
}{
/*
@ -37,7 +37,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"availability_zone": "foo",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -64,7 +64,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: map[string]interface{}{},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -112,7 +112,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -140,7 +140,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: nil,
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -170,7 +170,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"availability_zone": "bar",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -201,7 +201,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"availability_zone": "foo",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -233,7 +233,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"var.foo": "bar",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -264,7 +264,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"var.foo": config.UnknownVariableValue,
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "",
@ -296,7 +296,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"port": 27,
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"port": &terraform.ResourceAttrDiff{
Old: "",
@ -329,7 +329,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"port": false,
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"port": &terraform.ResourceAttrDiff{
Old: "",
@ -361,7 +361,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"ports": []interface{}{1, 2, 5},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "0",
@ -433,7 +433,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"ports": []interface{}{1, 2, 5},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "2",
@ -465,7 +465,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"ports": []interface{}{1, 2, 5},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "0",
@ -507,7 +507,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: map[string]interface{}{},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "",
@ -541,7 +541,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"ports": []interface{}{5, 2, 1},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "0",
@ -589,7 +589,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"ports": []interface{}{5, 2, 1},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "2",
@ -627,7 +627,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: map[string]interface{}{},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ports.#": &terraform.ResourceAttrDiff{
Old: "2",
@ -703,7 +703,7 @@ func TestSchemaMap_Diff(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"ingress.#": &terraform.ResourceAttrDiff{
Old: "0",
@ -777,7 +777,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"port": 80,
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
NewComputed: true,
@ -858,7 +858,7 @@ func TestSchemaMap_Diff(t *testing.T) {
},
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.0.foo": &terraform.ResourceAttrDiff{
Old: "bar",
@ -892,7 +892,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Config: map[string]interface{}{},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"config_vars.#": &terraform.ResourceAttrDiff{
Old: "1",
@ -942,7 +942,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"availability_zone": "foo",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "bar",
@ -991,7 +991,7 @@ func TestSchemaMap_Diff(t *testing.T) {
"availability_zone": "foo",
},
Diff: &terraform.ResourceDiff{
Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"availability_zone": &terraform.ResourceAttrDiff{
Old: "bar",

View File

@ -75,7 +75,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
func (p *ResourceProvider) Apply(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
var resp ResourceProviderApplyResponse
args := &ResourceProviderApplyArgs{
Info: info,
@ -97,7 +97,7 @@ func (p *ResourceProvider) Apply(
func (p *ResourceProvider) Diff(
info *terraform.InstanceInfo,
s *terraform.InstanceState,
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
var resp ResourceProviderDiffResponse
args := &ResourceProviderDiffArgs{
Info: info,
@ -158,9 +158,9 @@ type ResourceProviderConfigureResponse struct {
}
type ResourceProviderApplyArgs struct {
Info *terraform.InstanceInfo
Info *terraform.InstanceInfo
State *terraform.InstanceState
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
}
type ResourceProviderApplyResponse struct {
@ -169,19 +169,19 @@ type ResourceProviderApplyResponse struct {
}
type ResourceProviderDiffArgs struct {
Info *terraform.InstanceInfo
Info *terraform.InstanceInfo
State *terraform.InstanceState
Config *terraform.ResourceConfig
}
type ResourceProviderDiffResponse struct {
Diff *terraform.ResourceDiff
Diff *terraform.InstanceDiff
Error *BasicError
}
type ResourceProviderRefreshArgs struct {
Info *terraform.InstanceInfo
State *terraform.InstanceState
Info *terraform.InstanceInfo
State *terraform.InstanceState
}
type ResourceProviderRefreshResponse struct {

View File

@ -108,7 +108,7 @@ func TestResourceProvider_apply(t *testing.T) {
// Apply
info := &terraform.InstanceInfo{}
state := &terraform.InstanceState{}
diff := &terraform.ResourceDiff{}
diff := &terraform.InstanceDiff{}
newState, err := provider.Apply(info, state, diff)
if !p.ApplyCalled {
t.Fatal("apply should be called")
@ -133,7 +133,7 @@ func TestResourceProvider_diff(t *testing.T) {
}
provider := &ResourceProvider{Client: client, Name: name}
p.DiffReturn = &terraform.ResourceDiff{
p.DiffReturn = &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"foo": &terraform.ResourceAttrDiff{
Old: "",

View File

@ -746,7 +746,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
result.init()
cb := func(r *Resource) error {
var diff *ResourceDiff
var diff *InstanceDiff
for _, h := range c.hooks {
handleHook(h.PreDiff(r.Id, r.State.Primary))
@ -756,7 +756,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
log.Printf("[DEBUG] %s: Orphan, marking for destroy", r.Id)
// This is an orphan (no config), so we mark it to be destroyed
diff = &ResourceDiff{Destroy: true}
diff = &InstanceDiff{Destroy: true}
} else {
// Make sure the configuration is interpolated
if err := r.Config.interpolate(c); err != nil {
@ -781,7 +781,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
}
if diff == nil {
diff = new(ResourceDiff)
diff = new(InstanceDiff)
}
if r.Tainted {
@ -858,7 +858,7 @@ func (c *Context) planDestroyWalkFn(result *Plan) depgraph.WalkFunc {
l.Lock()
defer l.Unlock()
result.Diff.Resources[r.Id] = &ResourceDiff{Destroy: true}
result.Diff.Resources[r.Id] = &InstanceDiff{Destroy: true}
} else {
log.Printf("[DEBUG] %s: Not marking for destroy, no ID", r.Id)
}

View File

@ -411,8 +411,8 @@ func TestContextApply_badDiff(t *testing.T) {
t.Fatalf("err: %s", err)
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"newp": nil,
},
@ -436,7 +436,7 @@ func TestContextApply_cancel(t *testing.T) {
},
})
p.ApplyFn = func(*InstanceInfo, *InstanceState, *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(*InstanceInfo, *InstanceState, *InstanceDiff) (*InstanceState, error) {
if !stopped {
stopped = true
go ctx.Stop()
@ -455,8 +455,8 @@ func TestContextApply_cancel(t *testing.T) {
},
}, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
New: "bar",
@ -540,7 +540,7 @@ func TestContextApply_nilDiff(t *testing.T) {
t.Fatalf("err: %s", err)
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return nil, nil
}
@ -709,7 +709,7 @@ func TestContextApply_outputDiffVars(t *testing.T) {
State: s,
})
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
for k, ad := range d.Attributes {
if ad.NewComputed {
return nil, fmt.Errorf("%s: computed", k)
@ -720,8 +720,8 @@ func TestContextApply_outputDiffVars(t *testing.T) {
result.ID = "foo"
return result, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
NewComputed: true,
@ -747,7 +747,7 @@ func TestContextApply_Provisioner_ConnInfo(t *testing.T) {
p := testProvider("aws")
pr := testProvisioner()
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
if s.Ephemeral.ConnInfo == nil {
t.Fatalf("ConnInfo not initialized")
}
@ -935,7 +935,7 @@ func TestContextApply_destroyOrphan(t *testing.T) {
State: s,
})
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
if d.Destroy {
return nil, nil
}
@ -944,8 +944,8 @@ func TestContextApply_destroyOrphan(t *testing.T) {
result.ID = "foo"
return result, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
New: "bar",
@ -981,7 +981,7 @@ func TestContextApply_error(t *testing.T) {
},
})
p.ApplyFn = func(*InstanceInfo, *InstanceState, *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(*InstanceInfo, *InstanceState, *InstanceDiff) (*InstanceState, error) {
if errored {
state := &InstanceState{
ID: "bar",
@ -997,8 +997,8 @@ func TestContextApply_error(t *testing.T) {
},
}, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
New: "bar",
@ -1051,7 +1051,7 @@ func TestContextApply_errorPartial(t *testing.T) {
State: s,
})
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
if errored {
return s, fmt.Errorf("error")
}
@ -1064,8 +1064,8 @@ func TestContextApply_errorPartial(t *testing.T) {
},
}, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
New: "bar",
@ -1135,7 +1135,7 @@ func TestContextApply_idAttr(t *testing.T) {
},
})
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *ResourceDiff) (*InstanceState, error) {
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
result := s.MergeDiff(d)
result.ID = "foo"
result.Attributes = map[string]string{
@ -1144,8 +1144,8 @@ func TestContextApply_idAttr(t *testing.T) {
return result, nil
}
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
return &ResourceDiff{
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
New: "bar",
@ -1757,12 +1757,12 @@ func TestContextPlan_diffVar(t *testing.T) {
p.DiffFn = func(
info *InstanceInfo,
s *InstanceState,
c *ResourceConfig) (*ResourceDiff, error) {
c *ResourceConfig) (*InstanceDiff, error) {
if s.ID != "bar" {
return testDiffFn(info, s, c)
}
return &ResourceDiff{
return &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"num": &ResourceAttrDiff{
Old: "2",
@ -2112,19 +2112,19 @@ func TestContextRefresh_hook(t *testing.T) {
t.Fatal("should be called")
}
/*
TODO(mitchcellh): remove when we add InstanceInfo param
if h.PreRefreshState.Type != "aws_instance" {
t.Fatalf("bad: %#v", h.PreRefreshState)
}
TODO(mitchcellh): remove when we add InstanceInfo param
if h.PreRefreshState.Type != "aws_instance" {
t.Fatalf("bad: %#v", h.PreRefreshState)
}
*/
if !h.PostRefreshCalled {
t.Fatal("should be called")
}
/*
TODO(mitchcellh): remove when we add InstanceInfo param
if h.PostRefreshState.Type != "aws_instance" {
t.Fatalf("bad: %#v", h.PostRefreshState)
}
TODO(mitchcellh): remove when we add InstanceInfo param
if h.PostRefreshState.Type != "aws_instance" {
t.Fatalf("bad: %#v", h.PostRefreshState)
}
*/
}
@ -2234,7 +2234,7 @@ func testContext(t *testing.T, opts *ContextOpts) *Context {
func testApplyFn(
info *InstanceInfo,
s *InstanceState,
d *ResourceDiff) (*InstanceState, error) {
d *InstanceDiff) (*InstanceState, error) {
if d.Destroy {
return nil, nil
}
@ -2266,8 +2266,8 @@ func testApplyFn(
func testDiffFn(
info *InstanceInfo,
s *InstanceState,
c *ResourceConfig) (*ResourceDiff, error) {
var diff ResourceDiff
c *ResourceConfig) (*InstanceDiff, error) {
var diff InstanceDiff
diff.Attributes = make(map[string]*ResourceAttrDiff)
for k, v := range c.Raw {

View File

@ -18,7 +18,7 @@ const diffFormatByte byte = 1
// Diff tracks the differences between resources to apply.
type Diff struct {
Resources map[string]*ResourceDiff
Resources map[string]*InstanceDiff
once sync.Once
}
@ -64,7 +64,7 @@ func WriteDiff(d *Diff, dst io.Writer) error {
func (d *Diff) init() {
d.once.Do(func() {
if d.Resources == nil {
d.Resources = make(map[string]*ResourceDiff)
d.Resources = make(map[string]*InstanceDiff)
}
})
}
@ -152,8 +152,8 @@ func (d *Diff) String() string {
return buf.String()
}
// ResourceDiff is the diff of a resource from some state to another.
type ResourceDiff struct {
// InstanceDiff is the diff of a resource from some state to another.
type InstanceDiff struct {
Attributes map[string]*ResourceAttrDiff
Destroy bool
@ -188,7 +188,7 @@ const (
DiffAttrOutput
)
func (d *ResourceDiff) init() {
func (d *InstanceDiff) init() {
d.once.Do(func() {
if d.Attributes == nil {
d.Attributes = make(map[string]*ResourceAttrDiff)
@ -197,7 +197,7 @@ func (d *ResourceDiff) init() {
}
// Empty returns true if this diff encapsulates no changes.
func (d *ResourceDiff) Empty() bool {
func (d *InstanceDiff) Empty() bool {
if d == nil {
return true
}
@ -207,7 +207,7 @@ func (d *ResourceDiff) Empty() bool {
// RequiresNew returns true if the diff requires the creation of a new
// resource (implying the destruction of the old).
func (d *ResourceDiff) RequiresNew() bool {
func (d *InstanceDiff) RequiresNew() bool {
if d == nil {
return false
}
@ -221,11 +221,11 @@ func (d *ResourceDiff) RequiresNew() bool {
return false
}
// Same checks whether or not to ResourceDiffs are the "same." When
// Same checks whether or not to InstanceDiff are the "same." When
// we say "same", it is not necessarily exactly equal. Instead, it is
// just checking that the same attributes are changing, a destroy
// isn't suddenly happening, etc.
func (d *ResourceDiff) Same(d2 *ResourceDiff) bool {
func (d *InstanceDiff) Same(d2 *InstanceDiff) bool {
if d == nil && d2 == nil {
return true
} else if d == nil || d2 == nil {

View File

@ -13,8 +13,8 @@ func TestDiff_Empty(t *testing.T) {
t.Fatal("should be empty")
}
diff.Resources = map[string]*ResourceDiff{
"nodeA": &ResourceDiff{},
diff.Resources = map[string]*InstanceDiff{
"nodeA": &InstanceDiff{},
}
if !diff.Empty() {
@ -42,8 +42,8 @@ func TestDiff_Empty(t *testing.T) {
func TestDiff_String(t *testing.T) {
diff := &Diff{
Resources: map[string]*ResourceDiff{
"nodeA": &ResourceDiff{
Resources: map[string]*InstanceDiff{
"nodeA": &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
Old: "foo",
@ -71,25 +71,25 @@ func TestDiff_String(t *testing.T) {
}
func TestResourceDiff_Empty(t *testing.T) {
var rd *ResourceDiff
var rd *InstanceDiff
if !rd.Empty() {
t.Fatal("should be empty")
}
rd = new(ResourceDiff)
rd = new(InstanceDiff)
if !rd.Empty() {
t.Fatal("should be empty")
}
rd = &ResourceDiff{Destroy: true}
rd = &InstanceDiff{Destroy: true}
if rd.Empty() {
t.Fatal("should not be empty")
}
rd = &ResourceDiff{
rd = &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
New: "bar",
@ -103,7 +103,7 @@ func TestResourceDiff_Empty(t *testing.T) {
}
func TestResourceDiff_RequiresNew(t *testing.T) {
rd := &ResourceDiff{
rd := &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{},
},
@ -121,7 +121,7 @@ func TestResourceDiff_RequiresNew(t *testing.T) {
}
func TestResourceDiff_RequiresNew_nil(t *testing.T) {
var rd *ResourceDiff
var rd *InstanceDiff
if rd.RequiresNew() {
t.Fatal("should not require new")
@ -130,12 +130,12 @@ func TestResourceDiff_RequiresNew_nil(t *testing.T) {
func TestResourceDiffSame(t *testing.T) {
cases := []struct {
One, Two *ResourceDiff
One, Two *InstanceDiff
Same bool
}{
{
&ResourceDiff{},
&ResourceDiff{},
&InstanceDiff{},
&InstanceDiff{},
true,
},
@ -146,24 +146,24 @@ func TestResourceDiffSame(t *testing.T) {
},
{
&ResourceDiff{Destroy: false},
&ResourceDiff{Destroy: true},
&InstanceDiff{Destroy: false},
&InstanceDiff{Destroy: true},
false,
},
{
&ResourceDiff{Destroy: true},
&ResourceDiff{Destroy: true},
&InstanceDiff{Destroy: true},
&InstanceDiff{Destroy: true},
true,
},
{
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{},
},
},
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{},
},
@ -172,12 +172,12 @@ func TestResourceDiffSame(t *testing.T) {
},
{
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"bar": &ResourceAttrDiff{},
},
},
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{},
},
@ -186,12 +186,12 @@ func TestResourceDiffSame(t *testing.T) {
},
{
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{RequiresNew: true},
},
},
&ResourceDiff{
&InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{RequiresNew: false},
},
@ -210,8 +210,8 @@ func TestResourceDiffSame(t *testing.T) {
func TestReadWriteDiff(t *testing.T) {
diff := &Diff{
Resources: map[string]*ResourceDiff{
"nodeA": &ResourceDiff{
Resources: map[string]*InstanceDiff{
"nodeA": &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
Old: "foo",

View File

@ -314,7 +314,7 @@ func graphAddDiff(g *depgraph.Graph, d *Diff) error {
*newNode.Resource = *rn.Resource
// Make the diff _just_ the destroy.
newNode.Resource.Diff = &ResourceDiff{Destroy: true}
newNode.Resource.Diff = &InstanceDiff{Destroy: true}
// Create the new node
newN := &depgraph.Noun{
@ -340,7 +340,7 @@ func graphAddDiff(g *depgraph.Graph, d *Diff) error {
// Mark the old diff to not destroy since we handle that in
// the dedicated node.
newDiff := new(ResourceDiff)
newDiff := new(InstanceDiff)
*newDiff = *rd
newDiff.Destroy = false
rd = newDiff

View File

@ -251,8 +251,8 @@ func TestGraphProvisioners(t *testing.T) {
func TestGraphAddDiff(t *testing.T) {
config := testConfig(t, "graph-diff")
diff := &Diff{
Resources: map[string]*ResourceDiff{
"aws_instance.foo": &ResourceDiff{
Resources: map[string]*InstanceDiff{
"aws_instance.foo": &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
New: "bar",
@ -287,11 +287,11 @@ func TestGraphAddDiff(t *testing.T) {
func TestGraphAddDiff_destroy(t *testing.T) {
config := testConfig(t, "graph-diff-destroy")
diff := &Diff{
Resources: map[string]*ResourceDiff{
"aws_instance.foo": &ResourceDiff{
Resources: map[string]*InstanceDiff{
"aws_instance.foo": &InstanceDiff{
Destroy: true,
},
"aws_instance.bar": &ResourceDiff{
"aws_instance.bar": &InstanceDiff{
Destroy: true,
},
},
@ -341,7 +341,7 @@ func TestGraphAddDiff_destroy(t *testing.T) {
n := g.Noun("aws_instance.foo (destroy)")
rn := n.Meta.(*GraphNodeResource)
expected2 := &ResourceDiff{Destroy: true}
expected2 := &InstanceDiff{Destroy: true}
actual2 := rn.Resource.Diff
if !reflect.DeepEqual(actual2, expected2) {
t.Fatalf("bad: %#v", actual2)

View File

@ -24,13 +24,13 @@ type Hook interface {
// PreApply and PostApply are called before and after a single
// resource is applied. The error argument in PostApply is the
// error, if any, that was returned from the provider Apply call itself.
PreApply(string, *InstanceState, *ResourceDiff) (HookAction, error)
PreApply(string, *InstanceState, *InstanceDiff) (HookAction, error)
PostApply(string, *InstanceState, error) (HookAction, error)
// PreDiff and PostDiff are called before and after a single resource
// resource is diffed.
PreDiff(string, *InstanceState) (HookAction, error)
PostDiff(string, *ResourceDiff) (HookAction, error)
PostDiff(string, *InstanceDiff) (HookAction, error)
// Provisioning hooks
PreProvisionResource(string, *InstanceState) (HookAction, error)
@ -49,7 +49,7 @@ type Hook interface {
// and only implement the functions you are interested in.
type NilHook struct{}
func (*NilHook) PreApply(string, *InstanceState, *ResourceDiff) (HookAction, error) {
func (*NilHook) PreApply(string, *InstanceState, *InstanceDiff) (HookAction, error) {
return HookActionContinue, nil
}
@ -61,7 +61,7 @@ func (*NilHook) PreDiff(string, *InstanceState) (HookAction, error) {
return HookActionContinue, nil
}
func (*NilHook) PostDiff(string, *ResourceDiff) (HookAction, error) {
func (*NilHook) PostDiff(string, *InstanceDiff) (HookAction, error) {
return HookActionContinue, nil
}

View File

@ -5,7 +5,7 @@ package terraform
type MockHook struct {
PreApplyCalled bool
PreApplyId string
PreApplyDiff *ResourceDiff
PreApplyDiff *InstanceDiff
PreApplyState *InstanceState
PreApplyReturn HookAction
PreApplyError error
@ -25,7 +25,7 @@ type MockHook struct {
PostDiffCalled bool
PostDiffId string
PostDiffDiff *ResourceDiff
PostDiffDiff *InstanceDiff
PostDiffReturn HookAction
PostDiffError error
@ -66,7 +66,7 @@ type MockHook struct {
PreRefreshError error
}
func (h *MockHook) PreApply(n string, s *InstanceState, d *ResourceDiff) (HookAction, error) {
func (h *MockHook) PreApply(n string, s *InstanceState, d *InstanceDiff) (HookAction, error) {
h.PreApplyCalled = true
h.PreApplyId = n
h.PreApplyDiff = d
@ -89,7 +89,7 @@ func (h *MockHook) PreDiff(n string, s *InstanceState) (HookAction, error) {
return h.PreDiffReturn, h.PreDiffError
}
func (h *MockHook) PostDiff(n string, d *ResourceDiff) (HookAction, error) {
func (h *MockHook) PostDiff(n string, d *InstanceDiff) (HookAction, error) {
h.PostDiffCalled = true
h.PostDiffId = n
h.PostDiffDiff = d

View File

@ -10,7 +10,7 @@ type stopHook struct {
stop uint32
}
func (h *stopHook) PreApply(string, *InstanceState, *ResourceDiff) (HookAction, error) {
func (h *stopHook) PreApply(string, *InstanceState, *InstanceDiff) (HookAction, error) {
return h.hook()
}
@ -22,7 +22,7 @@ func (h *stopHook) PreDiff(string, *InstanceState) (HookAction, error) {
return h.hook()
}
func (h *stopHook) PostDiff(string, *ResourceDiff) (HookAction, error) {
func (h *stopHook) PostDiff(string, *InstanceDiff) (HookAction, error) {
return h.hook()
}

View File

@ -11,8 +11,8 @@ func TestReadWritePlan(t *testing.T) {
plan := &Plan{
Config: testConfig(t, "new-good"),
Diff: &Diff{
Resources: map[string]*ResourceDiff{
"nodeA": &ResourceDiff{
Resources: map[string]*InstanceDiff{
"nodeA": &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
Old: "foo",

View File

@ -28,7 +28,7 @@ type ResourceProvisionerConfig struct {
type Resource struct {
Id string
Config *ResourceConfig
Diff *ResourceDiff
Diff *InstanceDiff
Provider ResourceProvider
State *ResourceState
Provisioners []*ResourceProvisionerConfig

View File

@ -48,14 +48,14 @@ type ResourceProvider interface {
Apply(
*InstanceInfo,
*InstanceState,
*ResourceDiff) (*InstanceState, error)
*InstanceDiff) (*InstanceState, error)
// Diff diffs a resource versus a desired state and returns
// a diff.
Diff(
*InstanceInfo,
*InstanceState,
*ResourceConfig) (*ResourceDiff, error)
*ResourceConfig) (*InstanceDiff, error)
// Refresh refreshes a resource and updates all of its attributes
// with the latest information.

View File

@ -15,8 +15,8 @@ type MockResourceProvider struct {
ApplyCalled bool
ApplyInfo *InstanceInfo
ApplyState *InstanceState
ApplyDiff *ResourceDiff
ApplyFn func(*InstanceInfo, *InstanceState, *ResourceDiff) (*InstanceState, error)
ApplyDiff *InstanceDiff
ApplyFn func(*InstanceInfo, *InstanceState, *InstanceDiff) (*InstanceState, error)
ApplyReturn *InstanceState
ApplyReturnError error
ConfigureCalled bool
@ -26,8 +26,8 @@ type MockResourceProvider struct {
DiffInfo *InstanceInfo
DiffState *InstanceState
DiffDesired *ResourceConfig
DiffFn func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error)
DiffReturn *ResourceDiff
DiffFn func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error)
DiffReturn *InstanceDiff
DiffReturnError error
RefreshCalled bool
RefreshInfo *InstanceInfo
@ -85,7 +85,7 @@ func (p *MockResourceProvider) Configure(c *ResourceConfig) error {
func (p *MockResourceProvider) Apply(
info *InstanceInfo,
state *InstanceState,
diff *ResourceDiff) (*InstanceState, error) {
diff *InstanceDiff) (*InstanceState, error) {
p.Lock()
defer p.Unlock()
@ -103,7 +103,7 @@ func (p *MockResourceProvider) Apply(
func (p *MockResourceProvider) Diff(
info *InstanceInfo,
state *InstanceState,
desired *ResourceConfig) (*ResourceDiff, error) {
desired *ResourceConfig) (*InstanceDiff, error) {
p.Lock()
defer p.Unlock()

View File

@ -412,7 +412,7 @@ func (i *InstanceState) deepcopy() *InstanceState {
// If the diff attribute requires computing the value, and hence
// won't be available until apply, the value is replaced with the
// computeID.
func (s *InstanceState) MergeDiff(d *ResourceDiff) *InstanceState {
func (s *InstanceState) MergeDiff(d *InstanceDiff) *InstanceState {
var result InstanceState
if s != nil {
result = *s

View File

@ -21,7 +21,7 @@ func TestInstanceState_MergeDiff(t *testing.T) {
},
}
diff := &ResourceDiff{
diff := &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
Old: "bar",
@ -58,7 +58,7 @@ func TestInstanceState_MergeDiff(t *testing.T) {
func TestInstanceState_MergeDiff_nil(t *testing.T) {
var is *InstanceState = nil
diff := &ResourceDiff{
diff := &InstanceDiff{
Attributes: map[string]*ResourceAttrDiff{
"foo": &ResourceAttrDiff{
Old: "",

View File

@ -226,7 +226,7 @@ type ResourceStateV1 struct {
// If the diff attribute requires computing the value, and hence
// won't be available until apply, the value is replaced with the
// computeID.
func (s *ResourceStateV1) MergeDiff(d *ResourceDiff) *ResourceStateV1 {
func (s *ResourceStateV1) MergeDiff(d *InstanceDiff) *ResourceStateV1 {
var result ResourceStateV1
if s != nil {
result = *s

View File

@ -60,7 +60,7 @@ type HookRecordApplyOrder struct {
IDs []string
States []*InstanceState
Diffs []*ResourceDiff
Diffs []*InstanceDiff
l sync.Mutex
}
@ -68,7 +68,7 @@ type HookRecordApplyOrder struct {
func (h *HookRecordApplyOrder) PreApply(
id string,
s *InstanceState,
d *ResourceDiff) (HookAction, error) {
d *InstanceDiff) (HookAction, error) {
if h.Active {
h.l.Lock()
defer h.l.Unlock()