Skip to content

Commit

Permalink
Getting below mentioned error on azure_key_vault table. Closes #103
Browse files Browse the repository at this point in the history
  • Loading branch information
visiit committed Apr 26, 2021
1 parent 6da75a1 commit f3c0f9c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions azure/table_azure_key_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func getKeyVault(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData

func listKmsKeyVaultDiagnosticSettings(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
plugin.Logger(ctx).Trace("listKmsKeyVaultDiagnosticSettings")
data := h.Item.(keyvault.Vault)
id := getKeyVaultID(h.Item)

// Create session
session, err := GetNewSession(ctx, d, "MANAGEMENT")
Expand All @@ -261,7 +261,7 @@ func listKmsKeyVaultDiagnosticSettings(ctx context.Context, d *plugin.QueryData,
client := insights.NewDiagnosticSettingsClient(subscriptionID)
client.Authorizer = session.Authorizer

op, err := client.List(ctx, *data.ID)
op, err := client.List(ctx, id)
if err != nil {
return nil, err
}
Expand All @@ -287,3 +287,13 @@ func listKmsKeyVaultDiagnosticSettings(ctx context.Context, d *plugin.QueryData,
}
return diagnosticSettings, nil
}

func getKeyVaultID(item interface{}) string {
switch item.(type) {
case keyvault.Vault:
return *item.(keyvault.Vault).ID
case keyvault.Resource:
return *item.(keyvault.Resource).ID
}
return ""
}

0 comments on commit f3c0f9c

Please sign in to comment.