mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: Associate spot instances with their instance IDs for auth (#3383)
Fixes #2162.
This commit is contained in:
@@ -185,7 +185,7 @@ require (
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/google/btree v1.0.1 // indirect
|
||||
github.com/google/go-cmp v0.5.8 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
|
||||
@@ -310,6 +310,7 @@ func applyAutomaticInstanceID(resource *tfjson.StateResource, agents []*proto.Ag
|
||||
key, isValid := map[string]string{
|
||||
"google_compute_instance": "instance_id",
|
||||
"aws_instance": "id",
|
||||
"aws_spot_instance_request": "spot_instance_id",
|
||||
"azurerm_linux_virtual_machine": "virtual_machine_id",
|
||||
"azurerm_windows_virtual_machine": "virtual_machine_id",
|
||||
}[resource.Type]
|
||||
|
||||
@@ -219,6 +219,10 @@ func TestInstanceIDAssociation(t *testing.T) {
|
||||
Auth: "aws-instance-identity",
|
||||
ResourceType: "aws_instance",
|
||||
InstanceIDKey: "id",
|
||||
}, {
|
||||
Auth: "aws-instance-identity",
|
||||
ResourceType: "aws_spot_instance_request",
|
||||
InstanceIDKey: "spot_instance_id",
|
||||
}, {
|
||||
Auth: "azure-instance-identity",
|
||||
ResourceType: "azurerm_linux_virtual_machine",
|
||||
|
||||
Reference in New Issue
Block a user