ResourceDiff => InstanceDiff
This commit is contained in:
parent
0a6c675fba
commit
9b2b3a963f
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_autoscaling_group_create(
|
func resource_aws_autoscaling_group_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
autoscalingconn := p.autoscalingconn
|
autoscalingconn := p.autoscalingconn
|
||||||
|
@ -94,7 +94,7 @@ func resource_aws_autoscaling_group_create(
|
||||||
|
|
||||||
func resource_aws_autoscaling_group_update(
|
func resource_aws_autoscaling_group_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
autoscalingconn := p.autoscalingconn
|
autoscalingconn := p.autoscalingconn
|
||||||
|
@ -187,7 +187,7 @@ func resource_aws_autoscaling_group_refresh(
|
||||||
func resource_aws_autoscaling_group_diff(
|
func resource_aws_autoscaling_group_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_db_instance_create(
|
func resource_aws_db_instance_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
conn := p.rdsconn
|
conn := p.rdsconn
|
||||||
|
@ -137,7 +137,7 @@ func resource_aws_db_instance_create(
|
||||||
|
|
||||||
func resource_aws_db_instance_update(
|
func resource_aws_db_instance_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
panic("Cannot update DB")
|
panic("Cannot update DB")
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ func resource_aws_db_instance_refresh(
|
||||||
func resource_aws_db_instance_diff(
|
func resource_aws_db_instance_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_db_security_group_create(
|
func resource_aws_db_security_group_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
conn := p.rdsconn
|
conn := p.rdsconn
|
||||||
|
@ -86,7 +86,7 @@ func resource_aws_db_security_group_create(
|
||||||
|
|
||||||
func resource_aws_db_security_group_update(
|
func resource_aws_db_security_group_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
panic("Cannot update DB security group")
|
panic("Cannot update DB security group")
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ func resource_aws_db_security_group_refresh(
|
||||||
func resource_aws_db_security_group_diff(
|
func resource_aws_db_security_group_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_elb_create(
|
func resource_aws_elb_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
elbconn := p.elbconn
|
elbconn := p.elbconn
|
||||||
|
@ -125,7 +125,7 @@ func resource_aws_elb_create(
|
||||||
|
|
||||||
func resource_aws_elb_update(
|
func resource_aws_elb_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
elbconn := p.elbconn
|
elbconn := p.elbconn
|
||||||
|
@ -251,7 +251,7 @@ func resource_aws_elb_refresh(
|
||||||
func resource_aws_elb_diff(
|
func resource_aws_elb_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_internet_gateway_create(
|
func resource_aws_internet_gateway_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -36,7 +36,7 @@ func resource_aws_internet_gateway_create(
|
||||||
|
|
||||||
func resource_aws_internet_gateway_update(
|
func resource_aws_internet_gateway_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -128,7 +128,7 @@ func resource_aws_internet_gateway_refresh(
|
||||||
func resource_aws_internet_gateway_diff(
|
func resource_aws_internet_gateway_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"vpc_id": diff.AttrTypeUpdate,
|
"vpc_id": diff.AttrTypeUpdate,
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_launch_configuration_create(
|
func resource_aws_launch_configuration_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
autoscalingconn := p.autoscalingconn
|
autoscalingconn := p.autoscalingconn
|
||||||
|
@ -76,7 +76,7 @@ func resource_aws_launch_configuration_create(
|
||||||
|
|
||||||
func resource_aws_launch_configuration_update(
|
func resource_aws_launch_configuration_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
panic("Update for AWS Launch Configuration is not supported")
|
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(
|
func resource_aws_launch_configuration_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -29,7 +29,7 @@ func resource_aws_r53_record_validation() *config.Validator {
|
||||||
|
|
||||||
func resource_aws_r53_record_create(
|
func resource_aws_r53_record_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
conn := p.route53
|
conn := p.route53
|
||||||
|
@ -234,7 +234,7 @@ func resource_aws_r53_record_update_state(
|
||||||
func resource_aws_r53_record_diff(
|
func resource_aws_r53_record_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"zone_id": diff.AttrTypeCreate,
|
"zone_id": diff.AttrTypeCreate,
|
||||||
|
|
|
@ -22,7 +22,7 @@ func resource_aws_r53_zone_validation() *config.Validator {
|
||||||
|
|
||||||
func resource_aws_r53_zone_create(
|
func resource_aws_r53_zone_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
r53 := p.route53
|
r53 := p.route53
|
||||||
|
@ -109,7 +109,7 @@ func resource_aws_r53_zone_refresh(
|
||||||
func resource_aws_r53_zone_diff(
|
func resource_aws_r53_zone_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_route_table_create(
|
func resource_aws_route_table_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -57,7 +57,7 @@ func resource_aws_route_table_create(
|
||||||
|
|
||||||
func resource_aws_route_table_update(
|
func resource_aws_route_table_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -208,7 +208,7 @@ func resource_aws_route_table_refresh(
|
||||||
func resource_aws_route_table_diff(
|
func resource_aws_route_table_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"vpc_id": diff.AttrTypeCreate,
|
"vpc_id": diff.AttrTypeCreate,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_route_table_association_create(
|
func resource_aws_route_table_association_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -37,7 +37,7 @@ func resource_aws_route_table_association_create(
|
||||||
|
|
||||||
func resource_aws_route_table_association_update(
|
func resource_aws_route_table_association_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -122,7 +122,7 @@ func resource_aws_route_table_association_refresh(
|
||||||
func resource_aws_route_table_association_diff(
|
func resource_aws_route_table_association_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"subnet_id": diff.AttrTypeCreate,
|
"subnet_id": diff.AttrTypeCreate,
|
||||||
|
|
|
@ -23,7 +23,7 @@ func resource_aws_s3_bucket_validation() *config.Validator {
|
||||||
|
|
||||||
func resource_aws_s3_bucket_create(
|
func resource_aws_s3_bucket_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
s3conn := p.s3conn
|
s3conn := p.s3conn
|
||||||
|
@ -82,7 +82,7 @@ func resource_aws_s3_bucket_refresh(
|
||||||
func resource_aws_s3_bucket_diff(
|
func resource_aws_s3_bucket_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_subnet_create(
|
func resource_aws_subnet_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -61,7 +61,7 @@ func resource_aws_subnet_create(
|
||||||
|
|
||||||
func resource_aws_subnet_update(
|
func resource_aws_subnet_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
// This should never be called because we have no update-able
|
// This should never be called because we have no update-able
|
||||||
// attributes
|
// attributes
|
||||||
|
@ -122,7 +122,7 @@ func resource_aws_subnet_refresh(
|
||||||
func resource_aws_subnet_diff(
|
func resource_aws_subnet_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"availability_zone": diff.AttrTypeCreate,
|
"availability_zone": diff.AttrTypeCreate,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
func resource_aws_vpc_create(
|
func resource_aws_vpc_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -90,7 +90,7 @@ func resource_aws_vpc_create(
|
||||||
|
|
||||||
func resource_aws_vpc_update(
|
func resource_aws_vpc_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
ec2conn := p.ec2conn
|
ec2conn := p.ec2conn
|
||||||
|
@ -182,7 +182,7 @@ func resource_aws_vpc_refresh(
|
||||||
func resource_aws_vpc_diff(
|
func resource_aws_vpc_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
"cidr_block": diff.AttrTypeCreate,
|
"cidr_block": diff.AttrTypeCreate,
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
||||||
return p.p.Apply(info, s, d)
|
return p.p.Apply(info, s, d)
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ func (p *ResourceProvider) Apply(
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
||||||
return p.p.Diff(info, s, c)
|
return p.p.Diff(info, s, c)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
func resource_cloudflare_record_create(
|
func resource_cloudflare_record_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -52,7 +52,7 @@ func resource_cloudflare_record_create(
|
||||||
|
|
||||||
func resource_cloudflare_record_update(
|
func resource_cloudflare_record_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -119,7 +119,7 @@ func resource_cloudflare_record_refresh(
|
||||||
func resource_cloudflare_record_diff(
|
func resource_cloudflare_record_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -49,14 +49,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
return resourceMap.Apply(info, s, d, p)
|
return resourceMap.Apply(info, s, d, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return resourceMap.Diff(info, s, c, p)
|
return resourceMap.Diff(info, s, c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ func resource_consul_keys_validation() *config.Validator {
|
||||||
}
|
}
|
||||||
func resource_consul_keys_update(
|
func resource_consul_keys_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
return resource_consul_keys_create(s, d, meta)
|
return resource_consul_keys_create(s, d, meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resource_consul_keys_create(
|
func resource_consul_keys_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ func resource_consul_keys_destroy(
|
||||||
func resource_consul_keys_diff(
|
func resource_consul_keys_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
// Determine the list of computed variables
|
// Determine the list of computed variables
|
||||||
var computed []string
|
var computed []string
|
||||||
|
|
|
@ -45,14 +45,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
return resourceMap.Apply(info, s, d, p)
|
return resourceMap.Apply(info, s, d, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return resourceMap.Diff(info, s, c, p)
|
return resourceMap.Diff(info, s, c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
|
|
||||||
func resource_digitalocean_droplet_create(
|
func resource_digitalocean_droplet_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -91,7 +91,7 @@ func resource_digitalocean_droplet_create(
|
||||||
|
|
||||||
func resource_digitalocean_droplet_update(
|
func resource_digitalocean_droplet_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -238,7 +238,7 @@ func resource_digitalocean_droplet_refresh(
|
||||||
func resource_digitalocean_droplet_diff(
|
func resource_digitalocean_droplet_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -57,7 +57,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
||||||
return p.p.Apply(info, s, d)
|
return p.p.Apply(info, s, d)
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ func (p *ResourceProvider) Apply(
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
if _, ok := p.p.ResourcesMap[info.Type]; ok {
|
||||||
return p.p.Diff(info, s, c)
|
return p.p.Diff(info, s, c)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
func resource_dnsimple_record_create(
|
func resource_dnsimple_record_create(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -54,7 +54,7 @@ func resource_dnsimple_record_create(
|
||||||
|
|
||||||
func resource_dnsimple_record_update(
|
func resource_dnsimple_record_update(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
p := meta.(*ResourceProvider)
|
p := meta.(*ResourceProvider)
|
||||||
client := p.client
|
client := p.client
|
||||||
|
@ -127,7 +127,7 @@ func resource_dnsimple_record_refresh(
|
||||||
func resource_dnsimple_record_diff(
|
func resource_dnsimple_record_diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
|
|
||||||
b := &diff.ResourceBuilder{
|
b := &diff.ResourceBuilder{
|
||||||
Attrs: map[string]diff.AttrType{
|
Attrs: map[string]diff.AttrType{
|
||||||
|
|
|
@ -49,14 +49,14 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
return resourceMap.Apply(info, s, d, p)
|
return resourceMap.Apply(info, s, d, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return resourceMap.Diff(info, s, c, p)
|
return resourceMap.Diff(info, s, c, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ func TestApply_error(t *testing.T) {
|
||||||
p.ApplyFn = func(
|
p.ApplyFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
|
@ -156,8 +156,8 @@ func TestApply_error(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
*terraform.InstanceInfo,
|
*terraform.InstanceInfo,
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
*terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return &terraform.ResourceDiff{
|
return &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ami": &terraform.ResourceAttrDiff{
|
"ami": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -464,8 +464,8 @@ func TestApply_shutdown(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
*terraform.InstanceInfo,
|
*terraform.InstanceInfo,
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
*terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return &terraform.ResourceDiff{
|
return &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ami": &terraform.ResourceAttrDiff{
|
"ami": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -476,7 +476,7 @@ func TestApply_shutdown(t *testing.T) {
|
||||||
p.ApplyFn = func(
|
p.ApplyFn = func(
|
||||||
*terraform.InstanceInfo,
|
*terraform.InstanceInfo,
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
*terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
if !stopped {
|
if !stopped {
|
||||||
stopped = true
|
stopped = true
|
||||||
close(stopCh)
|
close(stopCh)
|
||||||
|
@ -554,7 +554,7 @@ func TestApply_state(t *testing.T) {
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.DiffReturn = &terraform.ResourceDiff{
|
p.DiffReturn = &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ami": &terraform.ResourceAttrDiff{
|
"ami": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -663,12 +663,12 @@ func TestApply_vars(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &terraform.ResourceDiff{}, nil
|
return &terraform.InstanceDiff{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
@ -706,12 +706,12 @@ func TestApply_varFile(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &terraform.ResourceDiff{}, nil
|
return &terraform.InstanceDiff{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
@ -759,12 +759,12 @@ func TestApply_varFileDefault(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &terraform.ResourceDiff{}, nil
|
return &terraform.InstanceDiff{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{
|
args := []string{
|
||||||
|
@ -801,7 +801,7 @@ func TestApply_backup(t *testing.T) {
|
||||||
backupPath := testTempFile(t)
|
backupPath := testTempFile(t)
|
||||||
|
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.DiffReturn = &terraform.ResourceDiff{
|
p.DiffReturn = &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ami": &terraform.ResourceAttrDiff{
|
"ami": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -885,7 +885,7 @@ func TestApply_disableBackup(t *testing.T) {
|
||||||
statePath := testStateFile(t, originalState)
|
statePath := testStateFile(t, originalState)
|
||||||
|
|
||||||
p := testProvider()
|
p := testProvider()
|
||||||
p.DiffReturn = &terraform.ResourceDiff{
|
p.DiffReturn = &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ami": &terraform.ResourceAttrDiff{
|
"ami": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
|
|
@ -104,7 +104,7 @@ func testStateFile(t *testing.T, s *terraform.State) string {
|
||||||
|
|
||||||
func testProvider() *terraform.MockResourceProvider {
|
func testProvider() *terraform.MockResourceProvider {
|
||||||
p := new(terraform.MockResourceProvider)
|
p := new(terraform.MockResourceProvider)
|
||||||
p.DiffReturn = &terraform.ResourceDiff{}
|
p.DiffReturn = &terraform.InstanceDiff{}
|
||||||
p.RefreshFn = func(
|
p.RefreshFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState) (*terraform.InstanceState, error) {
|
s *terraform.InstanceState) (*terraform.InstanceState, error) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (h *CountHook) Reset() {
|
||||||
func (h *CountHook) PreApply(
|
func (h *CountHook) PreApply(
|
||||||
id string,
|
id string,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (terraform.HookAction, error) {
|
d *terraform.InstanceDiff) (terraform.HookAction, error) {
|
||||||
h.Lock()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ const (
|
||||||
func (h *UiHook) PreApply(
|
func (h *UiHook) PreApply(
|
||||||
id string,
|
id string,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (terraform.HookAction, error) {
|
d *terraform.InstanceDiff) (terraform.HookAction, error) {
|
||||||
h.once.Do(h.init)
|
h.once.Do(h.init)
|
||||||
|
|
||||||
op := uiResourceModify
|
op := uiResourceModify
|
||||||
|
|
|
@ -146,7 +146,7 @@ func TestOutput_noVars(t *testing.T) {
|
||||||
originalState := &terraform.State{
|
originalState := &terraform.State{
|
||||||
Modules: []*terraform.ModuleState{
|
Modules: []*terraform.ModuleState{
|
||||||
&terraform.ModuleState{
|
&terraform.ModuleState{
|
||||||
Path: []string{"root"},
|
Path: []string{"root"},
|
||||||
Outputs: map[string]string{},
|
Outputs: map[string]string{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -149,7 +149,7 @@ func TestPlan_outPath(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
p.DiffReturn = &terraform.ResourceDiff{
|
p.DiffReturn = &terraform.InstanceDiff{
|
||||||
Destroy: true,
|
Destroy: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ func TestPlan_vars(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ func TestPlan_varFile(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ func TestPlan_varFileDefault(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
if v, ok := c.Config["value"]; ok {
|
if v, ok := c.Config["value"]; ok {
|
||||||
actual = v.(string)
|
actual = v.(string)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ func testConfig(
|
||||||
return terraform.NewResourceConfig(rc)
|
return terraform.NewResourceConfig(rc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testResourceDiffStr(rd *terraform.ResourceDiff) string {
|
func testResourceDiffStr(rd *terraform.InstanceDiff) string {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
crud := "UPDATE"
|
crud := "UPDATE"
|
||||||
|
|
|
@ -62,7 +62,7 @@ type PreProcessFunc func(string) string
|
||||||
// configuration.
|
// configuration.
|
||||||
func (b *ResourceBuilder) Diff(
|
func (b *ResourceBuilder) Diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
attrs := make(map[string]*terraform.ResourceAttrDiff)
|
attrs := make(map[string]*terraform.ResourceAttrDiff)
|
||||||
|
|
||||||
// We require a new resource if the ID is empty. Or, later, we set
|
// 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
|
// Build our resulting diff if we had attributes change
|
||||||
var result *terraform.ResourceDiff
|
var result *terraform.InstanceDiff
|
||||||
if len(attrs) > 0 {
|
if len(attrs) > 0 {
|
||||||
result = &terraform.ResourceDiff{
|
result = &terraform.InstanceDiff{
|
||||||
Attributes: attrs,
|
Attributes: attrs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (m *Map) Validate(
|
||||||
func (m *Map) Apply(
|
func (m *Map) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
r, ok := m.Mapping[info.Type]
|
r, ok := m.Mapping[info.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -87,7 +87,7 @@ func (m *Map) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig,
|
c *terraform.ResourceConfig,
|
||||||
meta interface{}) (*terraform.ResourceDiff, error) {
|
meta interface{}) (*terraform.InstanceDiff, error) {
|
||||||
r, ok := m.Mapping[info.Type]
|
r, ok := m.Mapping[info.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Unknown resource type: %s", info.Type)
|
return nil, fmt.Errorf("Unknown resource type: %s", info.Type)
|
||||||
|
|
|
@ -18,7 +18,7 @@ type Resource struct {
|
||||||
// exist.
|
// exist.
|
||||||
type CreateFunc func(
|
type CreateFunc func(
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceDiff,
|
*terraform.InstanceDiff,
|
||||||
interface{}) (*terraform.InstanceState, error)
|
interface{}) (*terraform.InstanceState, error)
|
||||||
|
|
||||||
// DestroyFunc is a function that destroys a resource that previously
|
// DestroyFunc is a function that destroys a resource that previously
|
||||||
|
@ -31,7 +31,7 @@ type DestroyFunc func(
|
||||||
type DiffFunc func(
|
type DiffFunc func(
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceConfig,
|
*terraform.ResourceConfig,
|
||||||
interface{}) (*terraform.ResourceDiff, error)
|
interface{}) (*terraform.InstanceDiff, error)
|
||||||
|
|
||||||
// RefreshFunc is a function that performs a refresh of a specific type
|
// RefreshFunc is a function that performs a refresh of a specific type
|
||||||
// of resource.
|
// of resource.
|
||||||
|
@ -45,5 +45,5 @@ type RefreshFunc func(
|
||||||
// a new resource.
|
// a new resource.
|
||||||
type UpdateFunc func(
|
type UpdateFunc func(
|
||||||
*terraform.InstanceState,
|
*terraform.InstanceState,
|
||||||
*terraform.ResourceDiff,
|
*terraform.InstanceDiff,
|
||||||
interface{}) (*terraform.InstanceState, error)
|
interface{}) (*terraform.InstanceState, error)
|
||||||
|
|
|
@ -261,7 +261,7 @@ func (t *mockT) failMessage() string {
|
||||||
|
|
||||||
func testProvider() *terraform.MockResourceProvider {
|
func testProvider() *terraform.MockResourceProvider {
|
||||||
mp := new(terraform.MockResourceProvider)
|
mp := new(terraform.MockResourceProvider)
|
||||||
mp.DiffReturn = &terraform.ResourceDiff{
|
mp.DiffReturn = &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"foo": &terraform.ResourceAttrDiff{
|
"foo": &terraform.ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
|
|
@ -138,7 +138,7 @@ func (p *Provider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *Provider) Apply(
|
func (p *Provider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
r, ok := p.ResourcesMap[info.Type]
|
r, ok := p.ResourcesMap[info.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
|
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
|
||||||
|
@ -151,7 +151,7 @@ func (p *Provider) Apply(
|
||||||
func (p *Provider) Diff(
|
func (p *Provider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
r, ok := p.ResourcesMap[info.Type]
|
r, ok := p.ResourcesMap[info.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
|
return nil, fmt.Errorf("unknown resource type: %s", info.Type)
|
||||||
|
|
|
@ -62,7 +62,7 @@ type DeleteFunc func(*ResourceData, interface{}) error
|
||||||
// Apply creates, updates, and/or deletes a resource.
|
// Apply creates, updates, and/or deletes a resource.
|
||||||
func (r *Resource) Apply(
|
func (r *Resource) Apply(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff,
|
d *terraform.InstanceDiff,
|
||||||
meta interface{}) (*terraform.InstanceState, error) {
|
meta interface{}) (*terraform.InstanceState, error) {
|
||||||
data, err := schemaMap(r.Schema).Data(s, d)
|
data, err := schemaMap(r.Schema).Data(s, d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -112,7 +112,7 @@ func (r *Resource) Apply(
|
||||||
// ResourceProvider interface.
|
// ResourceProvider interface.
|
||||||
func (r *Resource) Diff(
|
func (r *Resource) Diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
return schemaMap(r.Schema).Diff(s, c)
|
return schemaMap(r.Schema).Diff(s, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ type ResourceData struct {
|
||||||
schema map[string]*Schema
|
schema map[string]*Schema
|
||||||
config *terraform.ResourceConfig
|
config *terraform.ResourceConfig
|
||||||
state *terraform.InstanceState
|
state *terraform.InstanceState
|
||||||
diff *terraform.ResourceDiff
|
diff *terraform.InstanceDiff
|
||||||
diffing bool
|
diffing bool
|
||||||
|
|
||||||
// Don't set
|
// Don't set
|
||||||
|
|
|
@ -11,7 +11,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Key string
|
Key string
|
||||||
Value interface{}
|
Value interface{}
|
||||||
}{
|
}{
|
||||||
|
@ -27,7 +27,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "foo",
|
Old: "foo",
|
||||||
|
@ -53,7 +53,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -80,7 +80,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -133,7 +133,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "foo",
|
Old: "foo",
|
||||||
|
@ -273,7 +273,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ingress.#": &terraform.ResourceAttrDiff{
|
"ingress.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -311,7 +311,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ingress.#": &terraform.ResourceAttrDiff{
|
"ingress.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -366,7 +366,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -398,7 +398,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.#": &terraform.ResourceAttrDiff{
|
"config_vars.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "0",
|
Old: "0",
|
||||||
|
@ -482,7 +482,7 @@ func TestResourceDataGet(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.#": &terraform.ResourceAttrDiff{
|
"config_vars.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -550,7 +550,7 @@ func TestResourceDataGetChange(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Key string
|
Key string
|
||||||
OldValue interface{}
|
OldValue interface{}
|
||||||
NewValue interface{}
|
NewValue interface{}
|
||||||
|
@ -567,7 +567,7 @@ func TestResourceDataGetChange(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -599,7 +599,7 @@ func TestResourceDataGetChange(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -636,7 +636,7 @@ func TestResourceDataGetOk(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Key string
|
Key string
|
||||||
Value interface{}
|
Value interface{}
|
||||||
Ok bool
|
Ok bool
|
||||||
|
@ -656,7 +656,7 @@ func TestResourceDataGetOk(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -799,7 +799,7 @@ func TestResourceDataHasChange(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Key string
|
Key string
|
||||||
Change bool
|
Change bool
|
||||||
}{
|
}{
|
||||||
|
@ -815,7 +815,7 @@ func TestResourceDataHasChange(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -846,7 +846,7 @@ func TestResourceDataHasChange(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -879,7 +879,7 @@ func TestResourceDataSet(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Key string
|
Key string
|
||||||
Value interface{}
|
Value interface{}
|
||||||
Err bool
|
Err bool
|
||||||
|
@ -1395,7 +1395,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Set map[string]interface{}
|
Set map[string]interface{}
|
||||||
Result *terraform.InstanceState
|
Result *terraform.InstanceState
|
||||||
Partial []string
|
Partial []string
|
||||||
|
@ -1413,7 +1413,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -1443,7 +1443,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -1500,7 +1500,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -1534,7 +1534,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -1580,7 +1580,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ingress.#": &terraform.ResourceAttrDiff{
|
"ingress.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -1628,7 +1628,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.0.bar": &terraform.ResourceAttrDiff{
|
"config_vars.0.bar": &terraform.ResourceAttrDiff{
|
||||||
NewRemoved: true,
|
NewRemoved: true,
|
||||||
|
@ -1671,7 +1671,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.#": &terraform.ResourceAttrDiff{
|
"config_vars.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -1707,7 +1707,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -1777,7 +1777,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
|
|
||||||
State: nil,
|
State: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -1811,7 +1811,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -1858,7 +1858,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ingress.#": &terraform.ResourceAttrDiff{
|
"ingress.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -1907,7 +1907,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.0.bar": &terraform.ResourceAttrDiff{
|
"config_vars.0.bar": &terraform.ResourceAttrDiff{
|
||||||
NewRemoved: true,
|
NewRemoved: true,
|
||||||
|
@ -1956,7 +1956,7 @@ func TestResourceDataState(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.1": &terraform.ResourceAttrDiff{
|
"ports.1": &terraform.ResourceAttrDiff{
|
||||||
New: "120",
|
New: "120",
|
||||||
|
|
|
@ -27,7 +27,7 @@ func TestResourceApply_create(t *testing.T) {
|
||||||
|
|
||||||
var s *terraform.InstanceState = nil
|
var s *terraform.InstanceState = nil
|
||||||
|
|
||||||
d := &terraform.ResourceDiff{
|
d := &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"foo": &terraform.ResourceAttrDiff{
|
"foo": &terraform.ResourceAttrDiff{
|
||||||
New: "42",
|
New: "42",
|
||||||
|
@ -77,7 +77,7 @@ func TestResourceApply_destroy(t *testing.T) {
|
||||||
ID: "bar",
|
ID: "bar",
|
||||||
}
|
}
|
||||||
|
|
||||||
d := &terraform.ResourceDiff{
|
d := &terraform.InstanceDiff{
|
||||||
Destroy: true,
|
Destroy: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ func TestResourceApply_destroyPartial(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
d := &terraform.ResourceDiff{
|
d := &terraform.InstanceDiff{
|
||||||
Destroy: true,
|
Destroy: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ func TestResourceApply_update(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
d := &terraform.ResourceDiff{
|
d := &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"foo": &terraform.ResourceAttrDiff{
|
"foo": &terraform.ResourceAttrDiff{
|
||||||
New: "13",
|
New: "13",
|
||||||
|
@ -206,7 +206,7 @@ func TestResourceApply_updateNoCallback(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
d := &terraform.ResourceDiff{
|
d := &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"foo": &terraform.ResourceAttrDiff{
|
"foo": &terraform.ResourceAttrDiff{
|
||||||
New: "13",
|
New: "13",
|
||||||
|
|
|
@ -163,7 +163,7 @@ type schemaMap map[string]*Schema
|
||||||
// The diff is optional.
|
// The diff is optional.
|
||||||
func (m schemaMap) Data(
|
func (m schemaMap) Data(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*ResourceData, error) {
|
d *terraform.InstanceDiff) (*ResourceData, error) {
|
||||||
return &ResourceData{
|
return &ResourceData{
|
||||||
schema: m,
|
schema: m,
|
||||||
state: s,
|
state: s,
|
||||||
|
@ -175,8 +175,8 @@ func (m schemaMap) Data(
|
||||||
// state, and configuration.
|
// state, and configuration.
|
||||||
func (m schemaMap) Diff(
|
func (m schemaMap) Diff(
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
result := new(terraform.ResourceDiff)
|
result := new(terraform.InstanceDiff)
|
||||||
result.Attributes = make(map[string]*terraform.ResourceAttrDiff)
|
result.Attributes = make(map[string]*terraform.ResourceAttrDiff)
|
||||||
|
|
||||||
d := &ResourceData{
|
d := &ResourceData{
|
||||||
|
@ -199,7 +199,7 @@ func (m schemaMap) Diff(
|
||||||
// caused that.
|
// caused that.
|
||||||
if result.RequiresNew() {
|
if result.RequiresNew() {
|
||||||
// Create the new diff
|
// Create the new diff
|
||||||
result2 := new(terraform.ResourceDiff)
|
result2 := new(terraform.InstanceDiff)
|
||||||
result2.Attributes = make(map[string]*terraform.ResourceAttrDiff)
|
result2.Attributes = make(map[string]*terraform.ResourceAttrDiff)
|
||||||
|
|
||||||
// Reset the data to not contain state
|
// Reset the data to not contain state
|
||||||
|
@ -344,7 +344,7 @@ func (m schemaMap) InternalValidate() error {
|
||||||
func (m schemaMap) diff(
|
func (m schemaMap) diff(
|
||||||
k string,
|
k string,
|
||||||
schema *Schema,
|
schema *Schema,
|
||||||
diff *terraform.ResourceDiff,
|
diff *terraform.InstanceDiff,
|
||||||
d *ResourceData) error {
|
d *ResourceData) error {
|
||||||
var err error
|
var err error
|
||||||
switch schema.Type {
|
switch schema.Type {
|
||||||
|
@ -370,7 +370,7 @@ func (m schemaMap) diff(
|
||||||
func (m schemaMap) diffList(
|
func (m schemaMap) diffList(
|
||||||
k string,
|
k string,
|
||||||
schema *Schema,
|
schema *Schema,
|
||||||
diff *terraform.ResourceDiff,
|
diff *terraform.InstanceDiff,
|
||||||
d *ResourceData) error {
|
d *ResourceData) error {
|
||||||
o, n, _ := d.diffChange(k)
|
o, n, _ := d.diffChange(k)
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ func (m schemaMap) diffList(
|
||||||
func (m schemaMap) diffMap(
|
func (m schemaMap) diffMap(
|
||||||
k string,
|
k string,
|
||||||
schema *Schema,
|
schema *Schema,
|
||||||
diff *terraform.ResourceDiff,
|
diff *terraform.InstanceDiff,
|
||||||
d *ResourceData) error {
|
d *ResourceData) error {
|
||||||
//elemSchema := &Schema{Type: TypeString}
|
//elemSchema := &Schema{Type: TypeString}
|
||||||
prefix := k + "."
|
prefix := k + "."
|
||||||
|
@ -507,7 +507,7 @@ func (m schemaMap) diffMap(
|
||||||
func (m schemaMap) diffSet(
|
func (m schemaMap) diffSet(
|
||||||
k string,
|
k string,
|
||||||
schema *Schema,
|
schema *Schema,
|
||||||
diff *terraform.ResourceDiff,
|
diff *terraform.InstanceDiff,
|
||||||
d *ResourceData) error {
|
d *ResourceData) error {
|
||||||
return m.diffList(k, schema, diff, d)
|
return m.diffList(k, schema, diff, d)
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ func (m schemaMap) diffSet(
|
||||||
func (m schemaMap) diffString(
|
func (m schemaMap) diffString(
|
||||||
k string,
|
k string,
|
||||||
schema *Schema,
|
schema *Schema,
|
||||||
diff *terraform.ResourceDiff,
|
diff *terraform.InstanceDiff,
|
||||||
d *ResourceData) error {
|
d *ResourceData) error {
|
||||||
var originalN interface{}
|
var originalN interface{}
|
||||||
var os, ns string
|
var os, ns string
|
||||||
|
|
|
@ -14,7 +14,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Config map[string]interface{}
|
Config map[string]interface{}
|
||||||
ConfigVariables map[string]string
|
ConfigVariables map[string]string
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Err bool
|
Err bool
|
||||||
}{
|
}{
|
||||||
/*
|
/*
|
||||||
|
@ -37,7 +37,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"availability_zone": "foo",
|
"availability_zone": "foo",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -64,7 +64,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: map[string]interface{}{},
|
Config: map[string]interface{}{},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -112,7 +112,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: nil,
|
Config: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -140,7 +140,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: nil,
|
Config: nil,
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -170,7 +170,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"availability_zone": "bar",
|
"availability_zone": "bar",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -201,7 +201,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"availability_zone": "foo",
|
"availability_zone": "foo",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -233,7 +233,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"var.foo": "bar",
|
"var.foo": "bar",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -264,7 +264,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"var.foo": config.UnknownVariableValue,
|
"var.foo": config.UnknownVariableValue,
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -296,7 +296,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"port": 27,
|
"port": 27,
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"port": &terraform.ResourceAttrDiff{
|
"port": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -329,7 +329,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"port": false,
|
"port": false,
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"port": &terraform.ResourceAttrDiff{
|
"port": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -361,7 +361,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"ports": []interface{}{1, 2, 5},
|
"ports": []interface{}{1, 2, 5},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "0",
|
Old: "0",
|
||||||
|
@ -433,7 +433,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"ports": []interface{}{1, 2, 5},
|
"ports": []interface{}{1, 2, 5},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "2",
|
Old: "2",
|
||||||
|
@ -465,7 +465,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"ports": []interface{}{1, 2, 5},
|
"ports": []interface{}{1, 2, 5},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "0",
|
Old: "0",
|
||||||
|
@ -507,7 +507,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: map[string]interface{}{},
|
Config: map[string]interface{}{},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
@ -541,7 +541,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"ports": []interface{}{5, 2, 1},
|
"ports": []interface{}{5, 2, 1},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "0",
|
Old: "0",
|
||||||
|
@ -589,7 +589,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"ports": []interface{}{5, 2, 1},
|
"ports": []interface{}{5, 2, 1},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "2",
|
Old: "2",
|
||||||
|
@ -627,7 +627,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: map[string]interface{}{},
|
Config: map[string]interface{}{},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ports.#": &terraform.ResourceAttrDiff{
|
"ports.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "2",
|
Old: "2",
|
||||||
|
@ -703,7 +703,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"ingress.#": &terraform.ResourceAttrDiff{
|
"ingress.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "0",
|
Old: "0",
|
||||||
|
@ -777,7 +777,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"port": 80,
|
"port": 80,
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
NewComputed: true,
|
NewComputed: true,
|
||||||
|
@ -858,7 +858,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.0.foo": &terraform.ResourceAttrDiff{
|
"config_vars.0.foo": &terraform.ResourceAttrDiff{
|
||||||
Old: "bar",
|
Old: "bar",
|
||||||
|
@ -892,7 +892,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
|
|
||||||
Config: map[string]interface{}{},
|
Config: map[string]interface{}{},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"config_vars.#": &terraform.ResourceAttrDiff{
|
"config_vars.#": &terraform.ResourceAttrDiff{
|
||||||
Old: "1",
|
Old: "1",
|
||||||
|
@ -942,7 +942,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"availability_zone": "foo",
|
"availability_zone": "foo",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "bar",
|
Old: "bar",
|
||||||
|
@ -991,7 +991,7 @@ func TestSchemaMap_Diff(t *testing.T) {
|
||||||
"availability_zone": "foo",
|
"availability_zone": "foo",
|
||||||
},
|
},
|
||||||
|
|
||||||
Diff: &terraform.ResourceDiff{
|
Diff: &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"availability_zone": &terraform.ResourceAttrDiff{
|
"availability_zone": &terraform.ResourceAttrDiff{
|
||||||
Old: "bar",
|
Old: "bar",
|
||||||
|
|
|
@ -75,7 +75,7 @@ func (p *ResourceProvider) Configure(c *terraform.ResourceConfig) error {
|
||||||
func (p *ResourceProvider) Apply(
|
func (p *ResourceProvider) Apply(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
d *terraform.ResourceDiff) (*terraform.InstanceState, error) {
|
d *terraform.InstanceDiff) (*terraform.InstanceState, error) {
|
||||||
var resp ResourceProviderApplyResponse
|
var resp ResourceProviderApplyResponse
|
||||||
args := &ResourceProviderApplyArgs{
|
args := &ResourceProviderApplyArgs{
|
||||||
Info: info,
|
Info: info,
|
||||||
|
@ -97,7 +97,7 @@ func (p *ResourceProvider) Apply(
|
||||||
func (p *ResourceProvider) Diff(
|
func (p *ResourceProvider) Diff(
|
||||||
info *terraform.InstanceInfo,
|
info *terraform.InstanceInfo,
|
||||||
s *terraform.InstanceState,
|
s *terraform.InstanceState,
|
||||||
c *terraform.ResourceConfig) (*terraform.ResourceDiff, error) {
|
c *terraform.ResourceConfig) (*terraform.InstanceDiff, error) {
|
||||||
var resp ResourceProviderDiffResponse
|
var resp ResourceProviderDiffResponse
|
||||||
args := &ResourceProviderDiffArgs{
|
args := &ResourceProviderDiffArgs{
|
||||||
Info: info,
|
Info: info,
|
||||||
|
@ -158,9 +158,9 @@ type ResourceProviderConfigureResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderApplyArgs struct {
|
type ResourceProviderApplyArgs struct {
|
||||||
Info *terraform.InstanceInfo
|
Info *terraform.InstanceInfo
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderApplyResponse struct {
|
type ResourceProviderApplyResponse struct {
|
||||||
|
@ -169,19 +169,19 @@ type ResourceProviderApplyResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderDiffArgs struct {
|
type ResourceProviderDiffArgs struct {
|
||||||
Info *terraform.InstanceInfo
|
Info *terraform.InstanceInfo
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
Config *terraform.ResourceConfig
|
Config *terraform.ResourceConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderDiffResponse struct {
|
type ResourceProviderDiffResponse struct {
|
||||||
Diff *terraform.ResourceDiff
|
Diff *terraform.InstanceDiff
|
||||||
Error *BasicError
|
Error *BasicError
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderRefreshArgs struct {
|
type ResourceProviderRefreshArgs struct {
|
||||||
Info *terraform.InstanceInfo
|
Info *terraform.InstanceInfo
|
||||||
State *terraform.InstanceState
|
State *terraform.InstanceState
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResourceProviderRefreshResponse struct {
|
type ResourceProviderRefreshResponse struct {
|
||||||
|
|
|
@ -108,7 +108,7 @@ func TestResourceProvider_apply(t *testing.T) {
|
||||||
// Apply
|
// Apply
|
||||||
info := &terraform.InstanceInfo{}
|
info := &terraform.InstanceInfo{}
|
||||||
state := &terraform.InstanceState{}
|
state := &terraform.InstanceState{}
|
||||||
diff := &terraform.ResourceDiff{}
|
diff := &terraform.InstanceDiff{}
|
||||||
newState, err := provider.Apply(info, state, diff)
|
newState, err := provider.Apply(info, state, diff)
|
||||||
if !p.ApplyCalled {
|
if !p.ApplyCalled {
|
||||||
t.Fatal("apply should be called")
|
t.Fatal("apply should be called")
|
||||||
|
@ -133,7 +133,7 @@ func TestResourceProvider_diff(t *testing.T) {
|
||||||
}
|
}
|
||||||
provider := &ResourceProvider{Client: client, Name: name}
|
provider := &ResourceProvider{Client: client, Name: name}
|
||||||
|
|
||||||
p.DiffReturn = &terraform.ResourceDiff{
|
p.DiffReturn = &terraform.InstanceDiff{
|
||||||
Attributes: map[string]*terraform.ResourceAttrDiff{
|
Attributes: map[string]*terraform.ResourceAttrDiff{
|
||||||
"foo": &terraform.ResourceAttrDiff{
|
"foo": &terraform.ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
|
|
@ -746,7 +746,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
|
||||||
result.init()
|
result.init()
|
||||||
|
|
||||||
cb := func(r *Resource) error {
|
cb := func(r *Resource) error {
|
||||||
var diff *ResourceDiff
|
var diff *InstanceDiff
|
||||||
|
|
||||||
for _, h := range c.hooks {
|
for _, h := range c.hooks {
|
||||||
handleHook(h.PreDiff(r.Id, r.State.Primary))
|
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)
|
log.Printf("[DEBUG] %s: Orphan, marking for destroy", r.Id)
|
||||||
|
|
||||||
// This is an orphan (no config), so we mark it to be destroyed
|
// This is an orphan (no config), so we mark it to be destroyed
|
||||||
diff = &ResourceDiff{Destroy: true}
|
diff = &InstanceDiff{Destroy: true}
|
||||||
} else {
|
} else {
|
||||||
// Make sure the configuration is interpolated
|
// Make sure the configuration is interpolated
|
||||||
if err := r.Config.interpolate(c); err != nil {
|
if err := r.Config.interpolate(c); err != nil {
|
||||||
|
@ -781,7 +781,7 @@ func (c *Context) planWalkFn(result *Plan) depgraph.WalkFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
if diff == nil {
|
if diff == nil {
|
||||||
diff = new(ResourceDiff)
|
diff = new(InstanceDiff)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Tainted {
|
if r.Tainted {
|
||||||
|
@ -858,7 +858,7 @@ func (c *Context) planDestroyWalkFn(result *Plan) depgraph.WalkFunc {
|
||||||
|
|
||||||
l.Lock()
|
l.Lock()
|
||||||
defer l.Unlock()
|
defer l.Unlock()
|
||||||
result.Diff.Resources[r.Id] = &ResourceDiff{Destroy: true}
|
result.Diff.Resources[r.Id] = &InstanceDiff{Destroy: true}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[DEBUG] %s: Not marking for destroy, no ID", r.Id)
|
log.Printf("[DEBUG] %s: Not marking for destroy, no ID", r.Id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -411,8 +411,8 @@ func TestContextApply_badDiff(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"newp": nil,
|
"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 {
|
if !stopped {
|
||||||
stopped = true
|
stopped = true
|
||||||
go ctx.Stop()
|
go ctx.Stop()
|
||||||
|
@ -455,8 +455,8 @@ func TestContextApply_cancel(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -540,7 +540,7 @@ func TestContextApply_nilDiff(t *testing.T) {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ func TestContextApply_outputDiffVars(t *testing.T) {
|
||||||
State: s,
|
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 {
|
for k, ad := range d.Attributes {
|
||||||
if ad.NewComputed {
|
if ad.NewComputed {
|
||||||
return nil, fmt.Errorf("%s: computed", k)
|
return nil, fmt.Errorf("%s: computed", k)
|
||||||
|
@ -720,8 +720,8 @@ func TestContextApply_outputDiffVars(t *testing.T) {
|
||||||
result.ID = "foo"
|
result.ID = "foo"
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
NewComputed: true,
|
NewComputed: true,
|
||||||
|
@ -747,7 +747,7 @@ func TestContextApply_Provisioner_ConnInfo(t *testing.T) {
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
pr := testProvisioner()
|
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 {
|
if s.Ephemeral.ConnInfo == nil {
|
||||||
t.Fatalf("ConnInfo not initialized")
|
t.Fatalf("ConnInfo not initialized")
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@ func TestContextApply_destroyOrphan(t *testing.T) {
|
||||||
State: s,
|
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 {
|
if d.Destroy {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
@ -944,8 +944,8 @@ func TestContextApply_destroyOrphan(t *testing.T) {
|
||||||
result.ID = "foo"
|
result.ID = "foo"
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
New: "bar",
|
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 {
|
if errored {
|
||||||
state := &InstanceState{
|
state := &InstanceState{
|
||||||
ID: "bar",
|
ID: "bar",
|
||||||
|
@ -997,8 +997,8 @@ func TestContextApply_error(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -1051,7 +1051,7 @@ func TestContextApply_errorPartial(t *testing.T) {
|
||||||
State: s,
|
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 {
|
if errored {
|
||||||
return s, fmt.Errorf("error")
|
return s, fmt.Errorf("error")
|
||||||
}
|
}
|
||||||
|
@ -1064,8 +1064,8 @@ func TestContextApply_errorPartial(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
New: "bar",
|
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 := s.MergeDiff(d)
|
||||||
result.ID = "foo"
|
result.ID = "foo"
|
||||||
result.Attributes = map[string]string{
|
result.Attributes = map[string]string{
|
||||||
|
@ -1144,8 +1144,8 @@ func TestContextApply_idAttr(t *testing.T) {
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error) {
|
p.DiffFn = func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error) {
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -1757,12 +1757,12 @@ func TestContextPlan_diffVar(t *testing.T) {
|
||||||
p.DiffFn = func(
|
p.DiffFn = func(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
s *InstanceState,
|
s *InstanceState,
|
||||||
c *ResourceConfig) (*ResourceDiff, error) {
|
c *ResourceConfig) (*InstanceDiff, error) {
|
||||||
if s.ID != "bar" {
|
if s.ID != "bar" {
|
||||||
return testDiffFn(info, s, c)
|
return testDiffFn(info, s, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ResourceDiff{
|
return &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"num": &ResourceAttrDiff{
|
"num": &ResourceAttrDiff{
|
||||||
Old: "2",
|
Old: "2",
|
||||||
|
@ -2112,19 +2112,19 @@ func TestContextRefresh_hook(t *testing.T) {
|
||||||
t.Fatal("should be called")
|
t.Fatal("should be called")
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
TODO(mitchcellh): remove when we add InstanceInfo param
|
TODO(mitchcellh): remove when we add InstanceInfo param
|
||||||
if h.PreRefreshState.Type != "aws_instance" {
|
if h.PreRefreshState.Type != "aws_instance" {
|
||||||
t.Fatalf("bad: %#v", h.PreRefreshState)
|
t.Fatalf("bad: %#v", h.PreRefreshState)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if !h.PostRefreshCalled {
|
if !h.PostRefreshCalled {
|
||||||
t.Fatal("should be called")
|
t.Fatal("should be called")
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
TODO(mitchcellh): remove when we add InstanceInfo param
|
TODO(mitchcellh): remove when we add InstanceInfo param
|
||||||
if h.PostRefreshState.Type != "aws_instance" {
|
if h.PostRefreshState.Type != "aws_instance" {
|
||||||
t.Fatalf("bad: %#v", h.PostRefreshState)
|
t.Fatalf("bad: %#v", h.PostRefreshState)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2234,7 +2234,7 @@ func testContext(t *testing.T, opts *ContextOpts) *Context {
|
||||||
func testApplyFn(
|
func testApplyFn(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
s *InstanceState,
|
s *InstanceState,
|
||||||
d *ResourceDiff) (*InstanceState, error) {
|
d *InstanceDiff) (*InstanceState, error) {
|
||||||
if d.Destroy {
|
if d.Destroy {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
@ -2266,8 +2266,8 @@ func testApplyFn(
|
||||||
func testDiffFn(
|
func testDiffFn(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
s *InstanceState,
|
s *InstanceState,
|
||||||
c *ResourceConfig) (*ResourceDiff, error) {
|
c *ResourceConfig) (*InstanceDiff, error) {
|
||||||
var diff ResourceDiff
|
var diff InstanceDiff
|
||||||
diff.Attributes = make(map[string]*ResourceAttrDiff)
|
diff.Attributes = make(map[string]*ResourceAttrDiff)
|
||||||
|
|
||||||
for k, v := range c.Raw {
|
for k, v := range c.Raw {
|
||||||
|
|
|
@ -18,7 +18,7 @@ const diffFormatByte byte = 1
|
||||||
|
|
||||||
// Diff tracks the differences between resources to apply.
|
// Diff tracks the differences between resources to apply.
|
||||||
type Diff struct {
|
type Diff struct {
|
||||||
Resources map[string]*ResourceDiff
|
Resources map[string]*InstanceDiff
|
||||||
once sync.Once
|
once sync.Once
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ func WriteDiff(d *Diff, dst io.Writer) error {
|
||||||
func (d *Diff) init() {
|
func (d *Diff) init() {
|
||||||
d.once.Do(func() {
|
d.once.Do(func() {
|
||||||
if d.Resources == nil {
|
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()
|
return buf.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResourceDiff is the diff of a resource from some state to another.
|
// InstanceDiff is the diff of a resource from some state to another.
|
||||||
type ResourceDiff struct {
|
type InstanceDiff struct {
|
||||||
Attributes map[string]*ResourceAttrDiff
|
Attributes map[string]*ResourceAttrDiff
|
||||||
Destroy bool
|
Destroy bool
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ const (
|
||||||
DiffAttrOutput
|
DiffAttrOutput
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *ResourceDiff) init() {
|
func (d *InstanceDiff) init() {
|
||||||
d.once.Do(func() {
|
d.once.Do(func() {
|
||||||
if d.Attributes == nil {
|
if d.Attributes == nil {
|
||||||
d.Attributes = make(map[string]*ResourceAttrDiff)
|
d.Attributes = make(map[string]*ResourceAttrDiff)
|
||||||
|
@ -197,7 +197,7 @@ func (d *ResourceDiff) init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty returns true if this diff encapsulates no changes.
|
// Empty returns true if this diff encapsulates no changes.
|
||||||
func (d *ResourceDiff) Empty() bool {
|
func (d *InstanceDiff) Empty() bool {
|
||||||
if d == nil {
|
if d == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ func (d *ResourceDiff) Empty() bool {
|
||||||
|
|
||||||
// RequiresNew returns true if the diff requires the creation of a new
|
// RequiresNew returns true if the diff requires the creation of a new
|
||||||
// resource (implying the destruction of the old).
|
// resource (implying the destruction of the old).
|
||||||
func (d *ResourceDiff) RequiresNew() bool {
|
func (d *InstanceDiff) RequiresNew() bool {
|
||||||
if d == nil {
|
if d == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -221,11 +221,11 @@ func (d *ResourceDiff) RequiresNew() bool {
|
||||||
return false
|
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
|
// we say "same", it is not necessarily exactly equal. Instead, it is
|
||||||
// just checking that the same attributes are changing, a destroy
|
// just checking that the same attributes are changing, a destroy
|
||||||
// isn't suddenly happening, etc.
|
// isn't suddenly happening, etc.
|
||||||
func (d *ResourceDiff) Same(d2 *ResourceDiff) bool {
|
func (d *InstanceDiff) Same(d2 *InstanceDiff) bool {
|
||||||
if d == nil && d2 == nil {
|
if d == nil && d2 == nil {
|
||||||
return true
|
return true
|
||||||
} else if d == nil || d2 == nil {
|
} else if d == nil || d2 == nil {
|
||||||
|
|
|
@ -13,8 +13,8 @@ func TestDiff_Empty(t *testing.T) {
|
||||||
t.Fatal("should be empty")
|
t.Fatal("should be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
diff.Resources = map[string]*ResourceDiff{
|
diff.Resources = map[string]*InstanceDiff{
|
||||||
"nodeA": &ResourceDiff{},
|
"nodeA": &InstanceDiff{},
|
||||||
}
|
}
|
||||||
|
|
||||||
if !diff.Empty() {
|
if !diff.Empty() {
|
||||||
|
@ -42,8 +42,8 @@ func TestDiff_Empty(t *testing.T) {
|
||||||
|
|
||||||
func TestDiff_String(t *testing.T) {
|
func TestDiff_String(t *testing.T) {
|
||||||
diff := &Diff{
|
diff := &Diff{
|
||||||
Resources: map[string]*ResourceDiff{
|
Resources: map[string]*InstanceDiff{
|
||||||
"nodeA": &ResourceDiff{
|
"nodeA": &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
Old: "foo",
|
Old: "foo",
|
||||||
|
@ -71,25 +71,25 @@ func TestDiff_String(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResourceDiff_Empty(t *testing.T) {
|
func TestResourceDiff_Empty(t *testing.T) {
|
||||||
var rd *ResourceDiff
|
var rd *InstanceDiff
|
||||||
|
|
||||||
if !rd.Empty() {
|
if !rd.Empty() {
|
||||||
t.Fatal("should be empty")
|
t.Fatal("should be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
rd = new(ResourceDiff)
|
rd = new(InstanceDiff)
|
||||||
|
|
||||||
if !rd.Empty() {
|
if !rd.Empty() {
|
||||||
t.Fatal("should be empty")
|
t.Fatal("should be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
rd = &ResourceDiff{Destroy: true}
|
rd = &InstanceDiff{Destroy: true}
|
||||||
|
|
||||||
if rd.Empty() {
|
if rd.Empty() {
|
||||||
t.Fatal("should not be empty")
|
t.Fatal("should not be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
rd = &ResourceDiff{
|
rd = &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -103,7 +103,7 @@ func TestResourceDiff_Empty(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResourceDiff_RequiresNew(t *testing.T) {
|
func TestResourceDiff_RequiresNew(t *testing.T) {
|
||||||
rd := &ResourceDiff{
|
rd := &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{},
|
"foo": &ResourceAttrDiff{},
|
||||||
},
|
},
|
||||||
|
@ -121,7 +121,7 @@ func TestResourceDiff_RequiresNew(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResourceDiff_RequiresNew_nil(t *testing.T) {
|
func TestResourceDiff_RequiresNew_nil(t *testing.T) {
|
||||||
var rd *ResourceDiff
|
var rd *InstanceDiff
|
||||||
|
|
||||||
if rd.RequiresNew() {
|
if rd.RequiresNew() {
|
||||||
t.Fatal("should not require new")
|
t.Fatal("should not require new")
|
||||||
|
@ -130,12 +130,12 @@ func TestResourceDiff_RequiresNew_nil(t *testing.T) {
|
||||||
|
|
||||||
func TestResourceDiffSame(t *testing.T) {
|
func TestResourceDiffSame(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
One, Two *ResourceDiff
|
One, Two *InstanceDiff
|
||||||
Same bool
|
Same bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
&ResourceDiff{},
|
&InstanceDiff{},
|
||||||
&ResourceDiff{},
|
&InstanceDiff{},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -146,24 +146,24 @@ func TestResourceDiffSame(t *testing.T) {
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ResourceDiff{Destroy: false},
|
&InstanceDiff{Destroy: false},
|
||||||
&ResourceDiff{Destroy: true},
|
&InstanceDiff{Destroy: true},
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ResourceDiff{Destroy: true},
|
&InstanceDiff{Destroy: true},
|
||||||
&ResourceDiff{Destroy: true},
|
&InstanceDiff{Destroy: true},
|
||||||
true,
|
true,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{},
|
"foo": &ResourceAttrDiff{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{},
|
"foo": &ResourceAttrDiff{},
|
||||||
},
|
},
|
||||||
|
@ -172,12 +172,12 @@ func TestResourceDiffSame(t *testing.T) {
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"bar": &ResourceAttrDiff{},
|
"bar": &ResourceAttrDiff{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{},
|
"foo": &ResourceAttrDiff{},
|
||||||
},
|
},
|
||||||
|
@ -186,12 +186,12 @@ func TestResourceDiffSame(t *testing.T) {
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{RequiresNew: true},
|
"foo": &ResourceAttrDiff{RequiresNew: true},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ResourceDiff{
|
&InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{RequiresNew: false},
|
"foo": &ResourceAttrDiff{RequiresNew: false},
|
||||||
},
|
},
|
||||||
|
@ -210,8 +210,8 @@ func TestResourceDiffSame(t *testing.T) {
|
||||||
|
|
||||||
func TestReadWriteDiff(t *testing.T) {
|
func TestReadWriteDiff(t *testing.T) {
|
||||||
diff := &Diff{
|
diff := &Diff{
|
||||||
Resources: map[string]*ResourceDiff{
|
Resources: map[string]*InstanceDiff{
|
||||||
"nodeA": &ResourceDiff{
|
"nodeA": &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
Old: "foo",
|
Old: "foo",
|
||||||
|
|
|
@ -314,7 +314,7 @@ func graphAddDiff(g *depgraph.Graph, d *Diff) error {
|
||||||
*newNode.Resource = *rn.Resource
|
*newNode.Resource = *rn.Resource
|
||||||
|
|
||||||
// Make the diff _just_ the destroy.
|
// Make the diff _just_ the destroy.
|
||||||
newNode.Resource.Diff = &ResourceDiff{Destroy: true}
|
newNode.Resource.Diff = &InstanceDiff{Destroy: true}
|
||||||
|
|
||||||
// Create the new node
|
// Create the new node
|
||||||
newN := &depgraph.Noun{
|
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
|
// Mark the old diff to not destroy since we handle that in
|
||||||
// the dedicated node.
|
// the dedicated node.
|
||||||
newDiff := new(ResourceDiff)
|
newDiff := new(InstanceDiff)
|
||||||
*newDiff = *rd
|
*newDiff = *rd
|
||||||
newDiff.Destroy = false
|
newDiff.Destroy = false
|
||||||
rd = newDiff
|
rd = newDiff
|
||||||
|
|
|
@ -251,8 +251,8 @@ func TestGraphProvisioners(t *testing.T) {
|
||||||
func TestGraphAddDiff(t *testing.T) {
|
func TestGraphAddDiff(t *testing.T) {
|
||||||
config := testConfig(t, "graph-diff")
|
config := testConfig(t, "graph-diff")
|
||||||
diff := &Diff{
|
diff := &Diff{
|
||||||
Resources: map[string]*ResourceDiff{
|
Resources: map[string]*InstanceDiff{
|
||||||
"aws_instance.foo": &ResourceDiff{
|
"aws_instance.foo": &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
New: "bar",
|
New: "bar",
|
||||||
|
@ -287,11 +287,11 @@ func TestGraphAddDiff(t *testing.T) {
|
||||||
func TestGraphAddDiff_destroy(t *testing.T) {
|
func TestGraphAddDiff_destroy(t *testing.T) {
|
||||||
config := testConfig(t, "graph-diff-destroy")
|
config := testConfig(t, "graph-diff-destroy")
|
||||||
diff := &Diff{
|
diff := &Diff{
|
||||||
Resources: map[string]*ResourceDiff{
|
Resources: map[string]*InstanceDiff{
|
||||||
"aws_instance.foo": &ResourceDiff{
|
"aws_instance.foo": &InstanceDiff{
|
||||||
Destroy: true,
|
Destroy: true,
|
||||||
},
|
},
|
||||||
"aws_instance.bar": &ResourceDiff{
|
"aws_instance.bar": &InstanceDiff{
|
||||||
Destroy: true,
|
Destroy: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -341,7 +341,7 @@ func TestGraphAddDiff_destroy(t *testing.T) {
|
||||||
n := g.Noun("aws_instance.foo (destroy)")
|
n := g.Noun("aws_instance.foo (destroy)")
|
||||||
rn := n.Meta.(*GraphNodeResource)
|
rn := n.Meta.(*GraphNodeResource)
|
||||||
|
|
||||||
expected2 := &ResourceDiff{Destroy: true}
|
expected2 := &InstanceDiff{Destroy: true}
|
||||||
actual2 := rn.Resource.Diff
|
actual2 := rn.Resource.Diff
|
||||||
if !reflect.DeepEqual(actual2, expected2) {
|
if !reflect.DeepEqual(actual2, expected2) {
|
||||||
t.Fatalf("bad: %#v", actual2)
|
t.Fatalf("bad: %#v", actual2)
|
||||||
|
|
|
@ -24,13 +24,13 @@ type Hook interface {
|
||||||
// PreApply and PostApply are called before and after a single
|
// PreApply and PostApply are called before and after a single
|
||||||
// resource is applied. The error argument in PostApply is the
|
// resource is applied. The error argument in PostApply is the
|
||||||
// error, if any, that was returned from the provider Apply call itself.
|
// 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)
|
PostApply(string, *InstanceState, error) (HookAction, error)
|
||||||
|
|
||||||
// PreDiff and PostDiff are called before and after a single resource
|
// PreDiff and PostDiff are called before and after a single resource
|
||||||
// resource is diffed.
|
// resource is diffed.
|
||||||
PreDiff(string, *InstanceState) (HookAction, error)
|
PreDiff(string, *InstanceState) (HookAction, error)
|
||||||
PostDiff(string, *ResourceDiff) (HookAction, error)
|
PostDiff(string, *InstanceDiff) (HookAction, error)
|
||||||
|
|
||||||
// Provisioning hooks
|
// Provisioning hooks
|
||||||
PreProvisionResource(string, *InstanceState) (HookAction, error)
|
PreProvisionResource(string, *InstanceState) (HookAction, error)
|
||||||
|
@ -49,7 +49,7 @@ type Hook interface {
|
||||||
// and only implement the functions you are interested in.
|
// and only implement the functions you are interested in.
|
||||||
type NilHook struct{}
|
type NilHook struct{}
|
||||||
|
|
||||||
func (*NilHook) PreApply(string, *InstanceState, *ResourceDiff) (HookAction, error) {
|
func (*NilHook) PreApply(string, *InstanceState, *InstanceDiff) (HookAction, error) {
|
||||||
return HookActionContinue, nil
|
return HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ func (*NilHook) PreDiff(string, *InstanceState) (HookAction, error) {
|
||||||
return HookActionContinue, nil
|
return HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*NilHook) PostDiff(string, *ResourceDiff) (HookAction, error) {
|
func (*NilHook) PostDiff(string, *InstanceDiff) (HookAction, error) {
|
||||||
return HookActionContinue, nil
|
return HookActionContinue, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ package terraform
|
||||||
type MockHook struct {
|
type MockHook struct {
|
||||||
PreApplyCalled bool
|
PreApplyCalled bool
|
||||||
PreApplyId string
|
PreApplyId string
|
||||||
PreApplyDiff *ResourceDiff
|
PreApplyDiff *InstanceDiff
|
||||||
PreApplyState *InstanceState
|
PreApplyState *InstanceState
|
||||||
PreApplyReturn HookAction
|
PreApplyReturn HookAction
|
||||||
PreApplyError error
|
PreApplyError error
|
||||||
|
@ -25,7 +25,7 @@ type MockHook struct {
|
||||||
|
|
||||||
PostDiffCalled bool
|
PostDiffCalled bool
|
||||||
PostDiffId string
|
PostDiffId string
|
||||||
PostDiffDiff *ResourceDiff
|
PostDiffDiff *InstanceDiff
|
||||||
PostDiffReturn HookAction
|
PostDiffReturn HookAction
|
||||||
PostDiffError error
|
PostDiffError error
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ type MockHook struct {
|
||||||
PreRefreshError error
|
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.PreApplyCalled = true
|
||||||
h.PreApplyId = n
|
h.PreApplyId = n
|
||||||
h.PreApplyDiff = d
|
h.PreApplyDiff = d
|
||||||
|
@ -89,7 +89,7 @@ func (h *MockHook) PreDiff(n string, s *InstanceState) (HookAction, error) {
|
||||||
return h.PreDiffReturn, h.PreDiffError
|
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.PostDiffCalled = true
|
||||||
h.PostDiffId = n
|
h.PostDiffId = n
|
||||||
h.PostDiffDiff = d
|
h.PostDiffDiff = d
|
||||||
|
|
|
@ -10,7 +10,7 @@ type stopHook struct {
|
||||||
stop uint32
|
stop uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *stopHook) PreApply(string, *InstanceState, *ResourceDiff) (HookAction, error) {
|
func (h *stopHook) PreApply(string, *InstanceState, *InstanceDiff) (HookAction, error) {
|
||||||
return h.hook()
|
return h.hook()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func (h *stopHook) PreDiff(string, *InstanceState) (HookAction, error) {
|
||||||
return h.hook()
|
return h.hook()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *stopHook) PostDiff(string, *ResourceDiff) (HookAction, error) {
|
func (h *stopHook) PostDiff(string, *InstanceDiff) (HookAction, error) {
|
||||||
return h.hook()
|
return h.hook()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@ func TestReadWritePlan(t *testing.T) {
|
||||||
plan := &Plan{
|
plan := &Plan{
|
||||||
Config: testConfig(t, "new-good"),
|
Config: testConfig(t, "new-good"),
|
||||||
Diff: &Diff{
|
Diff: &Diff{
|
||||||
Resources: map[string]*ResourceDiff{
|
Resources: map[string]*InstanceDiff{
|
||||||
"nodeA": &ResourceDiff{
|
"nodeA": &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
Old: "foo",
|
Old: "foo",
|
||||||
|
|
|
@ -28,7 +28,7 @@ type ResourceProvisionerConfig struct {
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Id string
|
Id string
|
||||||
Config *ResourceConfig
|
Config *ResourceConfig
|
||||||
Diff *ResourceDiff
|
Diff *InstanceDiff
|
||||||
Provider ResourceProvider
|
Provider ResourceProvider
|
||||||
State *ResourceState
|
State *ResourceState
|
||||||
Provisioners []*ResourceProvisionerConfig
|
Provisioners []*ResourceProvisionerConfig
|
||||||
|
|
|
@ -48,14 +48,14 @@ type ResourceProvider interface {
|
||||||
Apply(
|
Apply(
|
||||||
*InstanceInfo,
|
*InstanceInfo,
|
||||||
*InstanceState,
|
*InstanceState,
|
||||||
*ResourceDiff) (*InstanceState, error)
|
*InstanceDiff) (*InstanceState, error)
|
||||||
|
|
||||||
// Diff diffs a resource versus a desired state and returns
|
// Diff diffs a resource versus a desired state and returns
|
||||||
// a diff.
|
// a diff.
|
||||||
Diff(
|
Diff(
|
||||||
*InstanceInfo,
|
*InstanceInfo,
|
||||||
*InstanceState,
|
*InstanceState,
|
||||||
*ResourceConfig) (*ResourceDiff, error)
|
*ResourceConfig) (*InstanceDiff, error)
|
||||||
|
|
||||||
// Refresh refreshes a resource and updates all of its attributes
|
// Refresh refreshes a resource and updates all of its attributes
|
||||||
// with the latest information.
|
// with the latest information.
|
||||||
|
|
|
@ -15,8 +15,8 @@ type MockResourceProvider struct {
|
||||||
ApplyCalled bool
|
ApplyCalled bool
|
||||||
ApplyInfo *InstanceInfo
|
ApplyInfo *InstanceInfo
|
||||||
ApplyState *InstanceState
|
ApplyState *InstanceState
|
||||||
ApplyDiff *ResourceDiff
|
ApplyDiff *InstanceDiff
|
||||||
ApplyFn func(*InstanceInfo, *InstanceState, *ResourceDiff) (*InstanceState, error)
|
ApplyFn func(*InstanceInfo, *InstanceState, *InstanceDiff) (*InstanceState, error)
|
||||||
ApplyReturn *InstanceState
|
ApplyReturn *InstanceState
|
||||||
ApplyReturnError error
|
ApplyReturnError error
|
||||||
ConfigureCalled bool
|
ConfigureCalled bool
|
||||||
|
@ -26,8 +26,8 @@ type MockResourceProvider struct {
|
||||||
DiffInfo *InstanceInfo
|
DiffInfo *InstanceInfo
|
||||||
DiffState *InstanceState
|
DiffState *InstanceState
|
||||||
DiffDesired *ResourceConfig
|
DiffDesired *ResourceConfig
|
||||||
DiffFn func(*InstanceInfo, *InstanceState, *ResourceConfig) (*ResourceDiff, error)
|
DiffFn func(*InstanceInfo, *InstanceState, *ResourceConfig) (*InstanceDiff, error)
|
||||||
DiffReturn *ResourceDiff
|
DiffReturn *InstanceDiff
|
||||||
DiffReturnError error
|
DiffReturnError error
|
||||||
RefreshCalled bool
|
RefreshCalled bool
|
||||||
RefreshInfo *InstanceInfo
|
RefreshInfo *InstanceInfo
|
||||||
|
@ -85,7 +85,7 @@ func (p *MockResourceProvider) Configure(c *ResourceConfig) error {
|
||||||
func (p *MockResourceProvider) Apply(
|
func (p *MockResourceProvider) Apply(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
state *InstanceState,
|
state *InstanceState,
|
||||||
diff *ResourceDiff) (*InstanceState, error) {
|
diff *InstanceDiff) (*InstanceState, error) {
|
||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ func (p *MockResourceProvider) Apply(
|
||||||
func (p *MockResourceProvider) Diff(
|
func (p *MockResourceProvider) Diff(
|
||||||
info *InstanceInfo,
|
info *InstanceInfo,
|
||||||
state *InstanceState,
|
state *InstanceState,
|
||||||
desired *ResourceConfig) (*ResourceDiff, error) {
|
desired *ResourceConfig) (*InstanceDiff, error) {
|
||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ func (i *InstanceState) deepcopy() *InstanceState {
|
||||||
// If the diff attribute requires computing the value, and hence
|
// If the diff attribute requires computing the value, and hence
|
||||||
// won't be available until apply, the value is replaced with the
|
// won't be available until apply, the value is replaced with the
|
||||||
// computeID.
|
// computeID.
|
||||||
func (s *InstanceState) MergeDiff(d *ResourceDiff) *InstanceState {
|
func (s *InstanceState) MergeDiff(d *InstanceDiff) *InstanceState {
|
||||||
var result InstanceState
|
var result InstanceState
|
||||||
if s != nil {
|
if s != nil {
|
||||||
result = *s
|
result = *s
|
||||||
|
|
|
@ -21,7 +21,7 @@ func TestInstanceState_MergeDiff(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
diff := &ResourceDiff{
|
diff := &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
Old: "bar",
|
Old: "bar",
|
||||||
|
@ -58,7 +58,7 @@ func TestInstanceState_MergeDiff(t *testing.T) {
|
||||||
func TestInstanceState_MergeDiff_nil(t *testing.T) {
|
func TestInstanceState_MergeDiff_nil(t *testing.T) {
|
||||||
var is *InstanceState = nil
|
var is *InstanceState = nil
|
||||||
|
|
||||||
diff := &ResourceDiff{
|
diff := &InstanceDiff{
|
||||||
Attributes: map[string]*ResourceAttrDiff{
|
Attributes: map[string]*ResourceAttrDiff{
|
||||||
"foo": &ResourceAttrDiff{
|
"foo": &ResourceAttrDiff{
|
||||||
Old: "",
|
Old: "",
|
||||||
|
|
|
@ -226,7 +226,7 @@ type ResourceStateV1 struct {
|
||||||
// If the diff attribute requires computing the value, and hence
|
// If the diff attribute requires computing the value, and hence
|
||||||
// won't be available until apply, the value is replaced with the
|
// won't be available until apply, the value is replaced with the
|
||||||
// computeID.
|
// computeID.
|
||||||
func (s *ResourceStateV1) MergeDiff(d *ResourceDiff) *ResourceStateV1 {
|
func (s *ResourceStateV1) MergeDiff(d *InstanceDiff) *ResourceStateV1 {
|
||||||
var result ResourceStateV1
|
var result ResourceStateV1
|
||||||
if s != nil {
|
if s != nil {
|
||||||
result = *s
|
result = *s
|
||||||
|
|
|
@ -60,7 +60,7 @@ type HookRecordApplyOrder struct {
|
||||||
|
|
||||||
IDs []string
|
IDs []string
|
||||||
States []*InstanceState
|
States []*InstanceState
|
||||||
Diffs []*ResourceDiff
|
Diffs []*InstanceDiff
|
||||||
|
|
||||||
l sync.Mutex
|
l sync.Mutex
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ type HookRecordApplyOrder struct {
|
||||||
func (h *HookRecordApplyOrder) PreApply(
|
func (h *HookRecordApplyOrder) PreApply(
|
||||||
id string,
|
id string,
|
||||||
s *InstanceState,
|
s *InstanceState,
|
||||||
d *ResourceDiff) (HookAction, error) {
|
d *InstanceDiff) (HookAction, error) {
|
||||||
if h.Active {
|
if h.Active {
|
||||||
h.l.Lock()
|
h.l.Lock()
|
||||||
defer h.l.Unlock()
|
defer h.l.Unlock()
|
||||||
|
|
Loading…
Reference in New Issue