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

azurerm_key_vault_secrets support for Enabled/Disabled state #20459

Closed
1 task done
mpalermo73 opened this issue Feb 14, 2023 · 3 comments · Fixed by #20498
Closed
1 task done

azurerm_key_vault_secrets support for Enabled/Disabled state #20459

mpalermo73 opened this issue Feb 14, 2023 · 3 comments · Fixed by #20498

Comments

@mpalermo73
Copy link

mpalermo73 commented Feb 14, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

There was a time that the Azure API did not allow for seeing the state of a secret. This appears to no longer be the case. I have a secret that I disabled in KV for example here

Note:
"enabled: false"

-> % az keyvault secret list --vault-name my-key-vault
[
  {
    "attributes": {
      "created": "2023-02-14T15:56:32+00:00",
      "enabled": false,
      "expires": null,
      "notBefore": null,
      "recoveryLevel": "CustomizedRecoverable+Purgeable",
      "updated": "2023-02-14T16:07:05+00:00"
    },
    "contentType": "true",
    "id": "https://my-key-vault.vault.azure.net/secrets/my-secret",
    "managed": null,
    "name": "my-secret",
    "tags": {}
  }
]

It clearly shows that this secret is disabled. When I try and list KV secrets with the existing terraform data source azurerm_key_vault_secrets, I get the (known) error:

Error: making Read request on Azure KeyVault Secret my-secret: keyvault.BaseClient#GetSecret: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="Forbidden" Message="Operation get is not allowed on a disabled secret." InnerError={"code":"SecretDisabled"}

this is the raw output from azurerm_key_vault_secrets:

{
  "address": "data.azurerm_key_vault_secrets.my_key_vault",
  "mode": "data",
  "type": "azurerm_key_vault_secrets",
  "name": "my_key_vault",
  "provider_name": "registry.terraform.io/hashicorp/azurerm",
  "schema_version": 0,
  "values": {
    "id": "/subscriptions/1a2b3c4d-1a2b-1a2b-9c2e-1a2b3c4d5e6f/resourceGroups/my-resource-group/providers/Microsoft.KeyVault/vaults/my-key-vault",
    "key_vault_id": "/subscriptions/1a2b3c4d-1a2b-1a2b-9c2e-1a2b3c4d5e6f/resourceGroups/my-resource-group/providers/Microsoft.KeyVault/vaults/my-key-vault",
    "names": [
      "my-secret"
    ],
    "timeouts": null
  }
},

which provides pretty much everything the azure-cli except the state.


Why am I unable to simply read the enabled key when it is clearly being returned from the API without error?

New or Affected Resource(s)/Data Source(s)

3.43.0

Potential Terraform Configuration

No response

References

@mpalermo73 mpalermo73 changed the title azurerm_key_vault_secret support for Enabled/Disabled state azurerm_key_vault_secrets support for Enabled/Disabled state Feb 14, 2023
@StefanSchoof
Copy link
Contributor

Related #20136

@github-actions
Copy link

This functionality has been released in v3.44.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants