Pulumi import existing key from Azure KeyVault gives error

126 views Asked by At

I want to import an existing key from the keyvault in the following way:

key_import_url = '/subscriptions/{subscription_id}/resourceGroups/{key_vault_rg_name}/providers/Microsoft.KeyVault/vaults/{keyvault_name}/keys/{key_name}'

key_vault_key = keyvault.Key(self.key_name,
    key_name            = self.key_name,
    resource_group_name = self.key_vault_rg_name,
    vault_name          = self.keyvault_name,
    opts                = ResourceOptions(
                            protect=True,
                            import_= key_import_url.format(self.app_subscription_id, self.key_vault_rg_name, self.keyvault_name, self.key_name),
                            ignore_changes=['tags','properties'])
)

I get the following error:

File "/home/vsts/work/r1/a/Source/pulumi/venv/lib/python3.8/site-packages/pulumi_azure_native/keyvault/key.py", line 168, in _internal_init
        raise TypeError("Missing required property 'properties'")
    TypeError: Missing required property 'properties'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1

I don't understand why it says there is missing property when I put it in the ignore list.

Can you please point out why it does not import that way and what should I change to be imported. I don't want to include the existing properties. If I want to import something that means I should only give the url and then pulumi should recognise all of its properties without specifying them. Why it does not work simply with the import string or what do I do wrong?

0

There are 0 answers