@@ -250,6 +250,10 @@ func (s *Service) CreateInstance(scope *scope.MachineScope, userData []byte, use
250
250
return nil , err
251
251
}
252
252
253
+ // Set the providerID and instanceID as soon as we create an instance so that we keep it in case of errors afterward
254
+ scope .SetProviderID (out .ID , out .AvailabilityZone )
255
+ scope .SetInstanceID (out .ID )
256
+
253
257
if len (input .NetworkInterfaces ) > 0 {
254
258
for _ , id := range input .NetworkInterfaces {
255
259
s .scope .Debug ("Attaching security groups to provided network interface" , "groups" , input .SecurityGroupIDs , "interface" , id )
@@ -261,15 +265,15 @@ func (s *Service) CreateInstance(scope *scope.MachineScope, userData []byte, use
261
265
262
266
s .scope .Debug ("Adding tags on each network interface from resource" , "resource-id" , out .ID )
263
267
264
- // Fetching the network interfaces attached to the specific instanace
268
+ // Fetching the network interfaces attached to the specific instance
265
269
networkInterfaces , err := s .getInstanceENIs (out .ID )
266
270
if err != nil {
267
271
return nil , err
268
272
}
269
273
270
274
s .scope .Debug ("Fetched the network interfaces" )
271
275
272
- // Once all the network interfaces attached to the specific instanace are found, the similar tags of instance are created for network interfaces too
276
+ // Once all the network interfaces attached to the specific instance are found, the similar tags of instance are created for network interfaces too
273
277
if len (networkInterfaces ) > 0 {
274
278
s .scope .Debug ("Attempting to create tags from resource" , "resource-id" , out .ID )
275
279
for _ , networkInterface := range networkInterfaces {
0 commit comments