providers/aws: properly create an i nstance after destroy
This commit is contained in:
parent
b6a02e473d
commit
e8035a5c96
|
@ -34,9 +34,15 @@ func resource_aws_instance_create(
|
|||
p := meta.(*ResourceProvider)
|
||||
ec2conn := p.ec2conn
|
||||
|
||||
// Merge the diff into the state so that we have all the attributes
|
||||
// properly. Note that this merged state will contain some computed
|
||||
// properties so it won't actually be our result (which we build from
|
||||
// scratch later).
|
||||
ms := s.MergeDiff(d)
|
||||
|
||||
runOpts := &ec2.RunInstances{
|
||||
ImageId: d.Attributes["ami"].New,
|
||||
InstanceType: d.Attributes["instance_type"].New,
|
||||
ImageId: ms.Attributes["ami"],
|
||||
InstanceType: ms.Attributes["instance_type"],
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Run configuration: %#v", runOpts)
|
||||
|
|
|
@ -170,6 +170,11 @@ func (t *Terraform) applyWalkFn(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Make sure the result is instantiated
|
||||
if rs == nil {
|
||||
rs = new(ResourceState)
|
||||
}
|
||||
|
||||
// Force the resource state type to be our type
|
||||
rs.Type = r.State.Type
|
||||
|
||||
|
|
Loading…
Reference in New Issue