Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an error as column 'id' requires hydrate data from getKeyVaultSecret but none is available on azure_key_vault_secret table. Closes #104 #111

Merged
merged 7 commits into from
May 4, 2021
7 changes: 6 additions & 1 deletion azure/table_azure_key_vault_secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func tableAzureKeyVaultSecret(_ context.Context) *plugin.Table {
Get: &plugin.GetConfig{
KeyColumns: plugin.AllColumns([]string{"vault_name", "name"}),
Hydrate: getKeyVaultSecret,
ShouldIgnoreError: isNotFoundError([]string{"ResourceNotFound", "404"}),
ShouldIgnoreError: isNotFoundError([]string{"ResourceNotFound", "404", "SecretDisabled"}),
},
List: &plugin.ListConfig{
Hydrate: listKeyVaultSecrets,
Expand Down Expand Up @@ -201,6 +201,11 @@ func getKeyVaultSecret(ctx context.Context, d *plugin.QueryData, h *plugin.Hydra
splitID := strings.Split(*data.ID, "/")
vaultName = strings.Split(splitID[2], ".")[0]
name = splitID[4]

// Operation get is not allowed on a disabled secret
if !*data.Attributes.Enabled {
return nil, nil
}
Comment on lines +206 to +208
Copy link
Contributor

@Subhajit97 Subhajit97 Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if someone has passed quals to make GET call, i.e. select * from azure_key_vault_secret where name = 'secret123' and vault_name = 'vault123'?

} else {
vaultName = d.KeyColumnQuals["vault_name"].GetStringValue()
name = d.KeyColumnQuals["name"].GetStringValue()
Expand Down