Skip to content

Commit 69664ed

Browse files
authored
fix: Use "virtual_machine_id" for instance identity with Azure (#3355)
This was using the wrong property, causing automatic auth to break.
1 parent 420fae8 commit 69664ed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

provisioner/terraform/resources.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ 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-
"azurerm_linux_virtual_machine": "id",
314-
"azurerm_windows_virtual_machine": "id",
313+
"azurerm_linux_virtual_machine": "virtual_machine_id",
314+
"azurerm_windows_virtual_machine": "virtual_machine_id",
315315
}[resource.Type]
316316
if !isValid {
317317
return

provisioner/terraform/resources_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,11 @@ func TestInstanceIDAssociation(t *testing.T) {
222222
}, {
223223
Auth: "azure-instance-identity",
224224
ResourceType: "azurerm_linux_virtual_machine",
225-
InstanceIDKey: "id",
225+
InstanceIDKey: "virtual_machine_id",
226226
}, {
227227
Auth: "azure-instance-identity",
228228
ResourceType: "azurerm_windows_virtual_machine",
229-
InstanceIDKey: "id",
229+
InstanceIDKey: "virtual_machine_id",
230230
}} {
231231
tc := tc
232232
t.Run(tc.ResourceType, func(t *testing.T) {

0 commit comments

Comments
 (0)