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

Support for set and get activation and expiration date on azurerm_key_vault_secret #4858

Closed
Tomaswe opened this issue Nov 12, 2019 · 2 comments · Fixed by #4873
Closed

Support for set and get activation and expiration date on azurerm_key_vault_secret #4858

Tomaswe opened this issue Nov 12, 2019 · 2 comments · Fixed by #4873

Comments

@Tomaswe
Copy link

Tomaswe commented Nov 12, 2019

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

The secrets can have activation and expiration date (datetime) set via Azure Portal or CLI.
Lacking the ability to set expiration date on the resource makes this security measure a manual task with the risk of forgetting and leaving the secrets valid forever.

New or Affected Resource(s)

  • azurerm_key_vault_secret

Potential Terraform Configuration

resource "azurerm_key_vault_secret" "expiring_secret" {
  name = "my-secret"
  value = "hush"
  key_vault_id = var.key_vault_id
  set_activation_date = false
  set_expiration_date = true
  expiration_date = "2020-01-01T12:00:00Z"
}

Today, while setting the expiration date manually, also setting a timestamp in a tag is the best way I've found to provide the expiration information to applications configuration during terraforming.
But that is manually synchronized and error prone or relying on some external scripting.

resource "azurerm_key_vault_secret" "expiring_secret" {
  name = "my-secret"
  value = "hush"
  key_vault_id = var.key_vault_id
  tags = {
    expires = var.expire_date
  }
}

and then to retrieve it

data "azurerm_key_vault_secret" "expiring_secret" {
  name = "my-secret"
  key_vault_id = var.key_vault_id
}
output "secret_expires"{
  value = data.azurerm_key_vault_secret.expiring_secret.tags["expires"]
}

References

@aqche
Copy link
Contributor

aqche commented Nov 14, 2019

Made an attempt at adding the not_before_date and expiration_date options to the azurerm_key_vault_secret in this PR!

@ghost
Copy link

ghost commented Mar 29, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants