From 9b2b3a963f741d72b515cec112a1c9a3eabc14e5 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 17 Sep 2014 16:33:24 -0700 Subject: [PATCH] ResourceDiff => InstanceDiff --- .../aws/resource_aws_autoscaling_group.go | 6 +- .../providers/aws/resource_aws_db_instance.go | 6 +- .../aws/resource_aws_db_security_group.go | 6 +- builtin/providers/aws/resource_aws_elb.go | 6 +- .../aws/resource_aws_internet_gateway.go | 6 +- .../aws/resource_aws_launch_configuration.go | 6 +- .../aws/resource_aws_route53_record.go | 4 +- .../aws/resource_aws_route53_zone.go | 4 +- .../providers/aws/resource_aws_route_table.go | 6 +- .../resource_aws_route_table_association.go | 6 +- .../providers/aws/resource_aws_s3_bucket.go | 4 +- builtin/providers/aws/resource_aws_subnet.go | 6 +- builtin/providers/aws/resource_aws_vpc.go | 6 +- builtin/providers/aws/resource_provider.go | 4 +- .../cloudflare/resource_cloudflare_record.go | 6 +- .../providers/cloudflare/resource_provider.go | 4 +- .../providers/consul/resource_consul_keys.go | 6 +- builtin/providers/consul/resource_provider.go | 4 +- .../resource_digitalocean_droplet.go | 6 +- .../digitalocean/resource_provider.go | 4 +- .../dnsimple/resource_dnsimple_record.go | 6 +- .../providers/dnsimple/resource_provider.go | 4 +- command/apply_test.go | 30 ++++---- command/command_test.go | 2 +- command/hook_count.go | 2 +- command/hook_ui.go | 2 +- command/output_test.go | 2 +- command/plan_test.go | 8 +-- helper/diff/diff_test.go | 2 +- helper/diff/resource_builder.go | 6 +- helper/resource/map.go | 4 +- helper/resource/resource.go | 6 +- helper/resource/testing_test.go | 2 +- helper/schema/provider.go | 4 +- helper/schema/resource.go | 4 +- helper/schema/resource_data.go | 2 +- helper/schema/resource_data_test.go | 66 ++++++++--------- helper/schema/resource_test.go | 10 +-- helper/schema/schema.go | 18 ++--- helper/schema/schema_test.go | 48 ++++++------- rpc/resource_provider.go | 16 ++--- rpc/resource_provider_test.go | 4 +- terraform/context.go | 8 +-- terraform/context_test.go | 70 +++++++++---------- terraform/diff.go | 18 ++--- terraform/diff_test.go | 50 ++++++------- terraform/graph.go | 4 +- terraform/graph_test.go | 12 ++-- terraform/hook.go | 8 +-- terraform/hook_mock.go | 8 +-- terraform/hook_stop.go | 4 +- terraform/plan_test.go | 4 +- terraform/resource.go | 2 +- terraform/resource_provider.go | 4 +- terraform/resource_provider_mock.go | 12 ++-- terraform/state.go | 2 +- terraform/state_test.go | 4 +- terraform/state_v1.go | 2 +- terraform/terraform_test.go | 4 +- 59 files changed, 285 insertions(+), 285 deletions(-) diff --git a/builtin/providers/aws/resource_aws_autoscaling_group.go b/builtin/providers/aws/resource_aws_autoscaling_group.go index 4bd807f41..f41608d76 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_group.go +++ b/builtin/providers/aws/resource_aws_autoscaling_group.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index 79a716992..63d0402f2 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_db_security_group.go b/builtin/providers/aws/resource_aws_db_security_group.go index d9eacd9ac..a4cb1c308 100644 --- a/builtin/providers/aws/resource_aws_db_security_group.go +++ b/builtin/providers/aws/resource_aws_db_security_group.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_elb.go b/builtin/providers/aws/resource_aws_elb.go index 5fd512a77..90c0b9ff7 100644 --- a/builtin/providers/aws/resource_aws_elb.go +++ b/builtin/providers/aws/resource_aws_elb.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_internet_gateway.go b/builtin/providers/aws/resource_aws_internet_gateway.go index 9a60d0333..a13892c60 100644 --- a/builtin/providers/aws/resource_aws_internet_gateway.go +++ b/builtin/providers/aws/resource_aws_internet_gateway.go @@ -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, diff --git a/builtin/providers/aws/resource_aws_launch_configuration.go b/builtin/providers/aws/resource_aws_launch_configuration.go index 6e39aa53c..c68320bb6 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration.go +++ b/builtin/providers/aws/resource_aws_launch_configuration.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_route53_record.go b/builtin/providers/aws/resource_aws_route53_record.go index da530ba34..60ff8df2a 100644 --- a/builtin/providers/aws/resource_aws_route53_record.go +++ b/builtin/providers/aws/resource_aws_route53_record.go @@ -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, diff --git a/builtin/providers/aws/resource_aws_route53_zone.go b/builtin/providers/aws/resource_aws_route53_zone.go index ef93da00f..6b68cf3cf 100644 --- a/builtin/providers/aws/resource_aws_route53_zone.go +++ b/builtin/providers/aws/resource_aws_route53_zone.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_route_table.go b/builtin/providers/aws/resource_aws_route_table.go index 46249a347..b444a083c 100644 --- a/builtin/providers/aws/resource_aws_route_table.go +++ b/builtin/providers/aws/resource_aws_route_table.go @@ -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, diff --git a/builtin/providers/aws/resource_aws_route_table_association.go b/builtin/providers/aws/resource_aws_route_table_association.go index 3d1b53c6d..c8932f749 100644 --- a/builtin/providers/aws/resource_aws_route_table_association.go +++ b/builtin/providers/aws/resource_aws_route_table_association.go @@ -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, diff --git a/builtin/providers/aws/resource_aws_s3_bucket.go b/builtin/providers/aws/resource_aws_s3_bucket.go index 2d9d184a8..36a9f4f0f 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket.go +++ b/builtin/providers/aws/resource_aws_s3_bucket.go @@ -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{ diff --git a/builtin/providers/aws/resource_aws_subnet.go b/builtin/providers/aws/resource_aws_subnet.go index 1935108ff..e964e123e 100644 --- a/builtin/providers/aws/resource_aws_subnet.go +++ b/builtin/providers/aws/resource_aws_subnet.go @@ -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, diff --git a/builtin/providers/aws/resource_aws_vpc.go b/builtin/providers/aws/resource_aws_vpc.go index 5e449f44c..91c5dcfe2 100644 --- a/builtin/providers/aws/resource_aws_vpc.go +++ b/builtin/providers/aws/resource_aws_vpc.go @@ -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, diff --git a/builtin/providers/aws/resource_provider.go b/builtin/providers/aws/resource_provider.go index ba1d5ab1d..b2c2fa1d8 100644 --- a/builtin/providers/aws/resource_provider.go +++ b/builtin/providers/aws/resource_provider.go @@ -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) } diff --git a/builtin/providers/cloudflare/resource_cloudflare_record.go b/builtin/providers/cloudflare/resource_cloudflare_record.go index f03905490..8f9b964a5 100644 --- a/builtin/providers/cloudflare/resource_cloudflare_record.go +++ b/builtin/providers/cloudflare/resource_cloudflare_record.go @@ -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{ diff --git a/builtin/providers/cloudflare/resource_provider.go b/builtin/providers/cloudflare/resource_provider.go index ce1dcdc31..bb0dc0c6a 100644 --- a/builtin/providers/cloudflare/resource_provider.go +++ b/builtin/providers/cloudflare/resource_provider.go @@ -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) } diff --git a/builtin/providers/consul/resource_consul_keys.go b/builtin/providers/consul/resource_consul_keys.go index 36ef6ea59..12da4747b 100644 --- a/builtin/providers/consul/resource_consul_keys.go +++ b/builtin/providers/consul/resource_consul_keys.go @@ -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 diff --git a/builtin/providers/consul/resource_provider.go b/builtin/providers/consul/resource_provider.go index fc20caa49..17da5a55c 100644 --- a/builtin/providers/consul/resource_provider.go +++ b/builtin/providers/consul/resource_provider.go @@ -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) } diff --git a/builtin/providers/digitalocean/resource_digitalocean_droplet.go b/builtin/providers/digitalocean/resource_digitalocean_droplet.go index c55538582..712f94a82 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_droplet.go +++ b/builtin/providers/digitalocean/resource_digitalocean_droplet.go @@ -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{ diff --git a/builtin/providers/digitalocean/resource_provider.go b/builtin/providers/digitalocean/resource_provider.go index d4bcd8798..30310711b 100644 --- a/builtin/providers/digitalocean/resource_provider.go +++ b/builtin/providers/digitalocean/resource_provider.go @@ -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) } diff --git a/builtin/providers/dnsimple/resource_dnsimple_record.go b/builtin/providers/dnsimple/resource_dnsimple_record.go index 10455e032..36b0a058a 100644 --- a/builtin/providers/dnsimple/resource_dnsimple_record.go +++ b/builtin/providers/dnsimple/resource_dnsimple_record.go @@ -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{ diff --git a/builtin/providers/dnsimple/resource_provider.go b/builtin/providers/dnsimple/resource_provider.go index 866271656..25a9ebb7c 100644 --- a/builtin/providers/dnsimple/resource_provider.go +++ b/builtin/providers/dnsimple/resource_provider.go @@ -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) } diff --git a/command/apply_test.go b/command/apply_test.go index f45737c59..f6402ae44 100644 --- a/command/apply_test.go +++ b/command/apply_test.go @@ -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", diff --git a/command/command_test.go b/command/command_test.go index 0acfa9f78..8d994ff72 100644 --- a/command/command_test.go +++ b/command/command_test.go @@ -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) { diff --git a/command/hook_count.go b/command/hook_count.go index bbebcc78c..08dd98fd7 100644 --- a/command/hook_count.go +++ b/command/hook_count.go @@ -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() diff --git a/command/hook_ui.go b/command/hook_ui.go index 8fe6e7c63..16c1d7507 100644 --- a/command/hook_ui.go +++ b/command/hook_ui.go @@ -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 diff --git a/command/output_test.go b/command/output_test.go index 5714ac20d..fbcda9962 100644 --- a/command/output_test.go +++ b/command/output_test.go @@ -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{}, }, }, diff --git a/command/plan_test.go b/command/plan_test.go index af4ab8cca..2f9ec37e2 100644 --- a/command/plan_test.go +++ b/command/plan_test.go @@ -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) } diff --git a/helper/diff/diff_test.go b/helper/diff/diff_test.go index 4df4652f2..4509ff50a 100644 --- a/helper/diff/diff_test.go +++ b/helper/diff/diff_test.go @@ -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" diff --git a/helper/diff/resource_builder.go b/helper/diff/resource_builder.go index e0516a6d8..18d010017 100644 --- a/helper/diff/resource_builder.go +++ b/helper/diff/resource_builder.go @@ -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, } } diff --git a/helper/resource/map.go b/helper/resource/map.go index 979791828..a465136f7 100644 --- a/helper/resource/map.go +++ b/helper/resource/map.go @@ -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) diff --git a/helper/resource/resource.go b/helper/resource/resource.go index 60a56a31d..0d9c831a6 100644 --- a/helper/resource/resource.go +++ b/helper/resource/resource.go @@ -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) diff --git a/helper/resource/testing_test.go b/helper/resource/testing_test.go index ad00f79cc..cf51c7b22 100644 --- a/helper/resource/testing_test.go +++ b/helper/resource/testing_test.go @@ -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", diff --git a/helper/schema/provider.go b/helper/schema/provider.go index 17f27e8e9..b1bb65ccb 100644 --- a/helper/schema/provider.go +++ b/helper/schema/provider.go @@ -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) diff --git a/helper/schema/resource.go b/helper/schema/resource.go index e9661c454..16c49f230 100644 --- a/helper/schema/resource.go +++ b/helper/schema/resource.go @@ -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) } diff --git a/helper/schema/resource_data.go b/helper/schema/resource_data.go index 5fbb0d4ea..e22c6e10d 100644 --- a/helper/schema/resource_data.go +++ b/helper/schema/resource_data.go @@ -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 diff --git a/helper/schema/resource_data_test.go b/helper/schema/resource_data_test.go index 66397dd6a..3f4c9ed9c 100644 --- a/helper/schema/resource_data_test.go +++ b/helper/schema/resource_data_test.go @@ -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", diff --git a/helper/schema/resource_test.go b/helper/schema/resource_test.go index ad4ba5fb6..32ad34454 100644 --- a/helper/schema/resource_test.go +++ b/helper/schema/resource_test.go @@ -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", diff --git a/helper/schema/schema.go b/helper/schema/schema.go index 39d622d22..711262bf9 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -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 diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 66e812055..91b958325 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -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", diff --git a/rpc/resource_provider.go b/rpc/resource_provider.go index a3f8b243d..b9f106bc7 100644 --- a/rpc/resource_provider.go +++ b/rpc/resource_provider.go @@ -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 { diff --git a/rpc/resource_provider_test.go b/rpc/resource_provider_test.go index e5c6a09f5..c8afffa05 100644 --- a/rpc/resource_provider_test.go +++ b/rpc/resource_provider_test.go @@ -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: "", diff --git a/terraform/context.go b/terraform/context.go index f4fbd1fca..55b390fa4 100644 --- a/terraform/context.go +++ b/terraform/context.go @@ -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) } diff --git a/terraform/context_test.go b/terraform/context_test.go index 6ef5706a1..44cb74532 100644 --- a/terraform/context_test.go +++ b/terraform/context_test.go @@ -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 { diff --git a/terraform/diff.go b/terraform/diff.go index b2b120685..64518f51f 100644 --- a/terraform/diff.go +++ b/terraform/diff.go @@ -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 { diff --git a/terraform/diff_test.go b/terraform/diff_test.go index 12fc9c65b..5835dbff7 100644 --- a/terraform/diff_test.go +++ b/terraform/diff_test.go @@ -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", diff --git a/terraform/graph.go b/terraform/graph.go index f5e7babd9..afeca1b7d 100644 --- a/terraform/graph.go +++ b/terraform/graph.go @@ -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 diff --git a/terraform/graph_test.go b/terraform/graph_test.go index 60bb14d89..15b15f637 100644 --- a/terraform/graph_test.go +++ b/terraform/graph_test.go @@ -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) diff --git a/terraform/hook.go b/terraform/hook.go index fab4e7d65..430256fcc 100644 --- a/terraform/hook.go +++ b/terraform/hook.go @@ -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 } diff --git a/terraform/hook_mock.go b/terraform/hook_mock.go index e991d495e..1ab053c41 100644 --- a/terraform/hook_mock.go +++ b/terraform/hook_mock.go @@ -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 diff --git a/terraform/hook_stop.go b/terraform/hook_stop.go index 4beda674d..8c6c0f004 100644 --- a/terraform/hook_stop.go +++ b/terraform/hook_stop.go @@ -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() } diff --git a/terraform/plan_test.go b/terraform/plan_test.go index 7531186c3..985457260 100644 --- a/terraform/plan_test.go +++ b/terraform/plan_test.go @@ -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", diff --git a/terraform/resource.go b/terraform/resource.go index f912382be..18277db10 100644 --- a/terraform/resource.go +++ b/terraform/resource.go @@ -28,7 +28,7 @@ type ResourceProvisionerConfig struct { type Resource struct { Id string Config *ResourceConfig - Diff *ResourceDiff + Diff *InstanceDiff Provider ResourceProvider State *ResourceState Provisioners []*ResourceProvisionerConfig diff --git a/terraform/resource_provider.go b/terraform/resource_provider.go index 2bdf3c238..7a323f5af 100644 --- a/terraform/resource_provider.go +++ b/terraform/resource_provider.go @@ -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. diff --git a/terraform/resource_provider_mock.go b/terraform/resource_provider_mock.go index 79c946dc2..d088594f8 100644 --- a/terraform/resource_provider_mock.go +++ b/terraform/resource_provider_mock.go @@ -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() diff --git a/terraform/state.go b/terraform/state.go index fd5a7926f..d58d4cf5b 100644 --- a/terraform/state.go +++ b/terraform/state.go @@ -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 diff --git a/terraform/state_test.go b/terraform/state_test.go index 13f953e3f..33cf4614f 100644 --- a/terraform/state_test.go +++ b/terraform/state_test.go @@ -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: "", diff --git a/terraform/state_v1.go b/terraform/state_v1.go index fc0a90f5a..14436f205 100644 --- a/terraform/state_v1.go +++ b/terraform/state_v1.go @@ -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 diff --git a/terraform/terraform_test.go b/terraform/terraform_test.go index 75fc36c60..d55050be4 100644 --- a/terraform/terraform_test.go +++ b/terraform/terraform_test.go @@ -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()