Terraform-provider-azurerm: sample to use keyvault secret while deploying

Created on 17 Oct 2017  ยท  6Comments  ยท  Source: terraform-providers/terraform-provider-azurerm

_This issue was originally opened by @retheshnair as hashicorp/terraform#16370. It was migrated here as a result of the provider split. The original body of the issue is below._


resource "azurerm_key_vault_secret" "test" {
  name      = "secret-sauce"
  value     = "szechuan"
  vault_uri = "${azurerm_key_vault.test.vault_uri}"

  tags {
    environment = "Production"
  }
}

How to use this Key vault secret when deploying the windows vm . I did try to use this reference document for ARM template to set it up but didn't work as expected .Unable to fetch the secret

[root@puppettest ~]# terraform -v
Terraform v0.10.7

[root@puppettest ~]#

  os_profile {
        computer_name   = "${var.azure_windowsserver}${format("%02d", count.index + 1)}"
        admin_username  = "${var.azure_os_admin_user}"
        admin_password  = "${var.azure_os_admin_password}"
#        admin_password   = {
#             reference   {
#                     keyVault {
#                         id = "/subscriptions/XXXXX-XXXX-XXXXX-XXXXX/resourceGroups/testdevrg101/providers/Microsoft.KeyVault/vaults/myvault"
#                      }
#                     secretName = "windowsserverkey"
#               }
#          }
    }
question

Most helpful comment

๐Ÿ‘‹๐Ÿป hey folks!

Thanks for opening this issue

We've had a similar issue opened about accessing the value of the Key Vault Secret in #606 - which I believe we should close this we close this issue in favour of. In that issue we've reached out to the team at Microsoft and at this time it appears it's not possible to reference a Key Vault Secret through the Azure API (although, a feature request has been opened). Instead the recommendation would be to investigate adding a Data Source for Key Vault Secrets - which would allow accessing the value in other Resources.

Given this is now a duplicate of #606 - I'm going to close this in favour of that that issue.

Thanks!

All 6 comments

+1

+1

๐Ÿ‘‹๐Ÿป hey folks!

Thanks for opening this issue

We've had a similar issue opened about accessing the value of the Key Vault Secret in #606 - which I believe we should close this we close this issue in favour of. In that issue we've reached out to the team at Microsoft and at this time it appears it's not possible to reference a Key Vault Secret through the Azure API (although, a feature request has been opened). Instead the recommendation would be to investigate adding a Data Source for Key Vault Secrets - which would allow accessing the value in other Resources.

Given this is now a duplicate of #606 - I'm going to close this in favour of that that issue.

Thanks!

Hi
I use terraform v 0.11.7
And I would be interressed to have a solution for get secret values from key vault for my vm password.
Do we have a solution ?

@mikaelkrief there's a separate feature request tracking this in #606

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 ๐Ÿ‘‰ [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings