Skip to content

Commit 303b280

Browse files
authored
fix: Associate spot instances with their instance IDs for auth (#3383)
Fixes #2162.
1 parent 075454c commit 303b280

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ require (
185185
github.com/godbus/dbus/v5 v5.1.0 // indirect
186186
github.com/gogo/protobuf v1.3.2 // indirect
187187
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
188-
github.com/golang/protobuf v1.5.2 // indirect
188+
github.com/golang/protobuf v1.5.2
189189
github.com/google/btree v1.0.1 // indirect
190190
github.com/google/go-cmp v0.5.8 // indirect
191191
github.com/google/go-querystring v1.1.0 // indirect

provisioner/terraform/resources.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ func applyAutomaticInstanceID(resource *tfjson.StateResource, agents []*proto.Ag
310310
key, isValid := map[string]string{
311311
"google_compute_instance": "instance_id",
312312
"aws_instance": "id",
313+
"aws_spot_instance_request": "spot_instance_id",
313314
"azurerm_linux_virtual_machine": "virtual_machine_id",
314315
"azurerm_windows_virtual_machine": "virtual_machine_id",
315316
}[resource.Type]

provisioner/terraform/resources_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ func TestInstanceIDAssociation(t *testing.T) {
219219
Auth: "aws-instance-identity",
220220
ResourceType: "aws_instance",
221221
InstanceIDKey: "id",
222+
}, {
223+
Auth: "aws-instance-identity",
224+
ResourceType: "aws_spot_instance_request",
225+
InstanceIDKey: "spot_instance_id",
222226
}, {
223227
Auth: "azure-instance-identity",
224228
ResourceType: "azurerm_linux_virtual_machine",

0 commit comments

Comments
 (0)