Read manually created Azure KeyVault Secret

I’m currently struggling with reading manually created secrets from Azure KeyVault with CDKTF (Java).

If I try to get an existing secret, an error is thrown that the value is missing. It looks like that the stack tries to create the secret, not to receive it.

KeyVaultSecret.Builder.create(this, "manually-created-secret")

Any ideas?

Thanks. :coffee:

Hey @Aldjinn :wave:

To read resources instead of creating (and managing) them you need to use the data source instead of the resource. I think it might be called data_key_vault_secret.DataKeyVaultSecret or similar.

1 Like

Damn… that’s too easy. :roll_eyes:

DataAzurermKeyVaultSecret.Builder.create(this, "manually-created-secret")

Thank you very very much, you saved my day! :beers: