Skip to content

Terraform: Unable to deploy due to Keyvault not allowing access #171

Open
@ksaye

Description

@ksaye

When doing a fresh deploy, you get the error when attempting to create the backend_webapp secret. This is because keyvault does not allow remote access. You get the error:

module.backend_webapp.null_resource.linux_webapp_deployment[0]: Still creating... [8m20s elapsed]
module.backend_webapp.null_resource.linux_webapp_deployment[0]: Creation complete after 8m21s [id=223016596939359480]
╷
│ Error: checking for presence of existing Secret "clientapp-secret-ac76373a" (Key Vault "https://kv-ac76373a.vault.azure.net/"): keyvault.BaseClient#GetSecret: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="Forbidden" Message="Public network access is disabled and request is not from a trusted service nor via an approved private link.\r\nCaller: appid=04b07795-8ddb-461a-bbee-02f9e1bf7b46;oid=eaadeb4c-a236-48a1-84f9-5c3685078b2c;iss=https://sts.windows.net/9d5f9c99-0e52-4b50-82d9-6152df0d794a/\r\nVault: kv-ac76373a;location=eastus2" InnerError={"code":"ForbiddenByConnection"}
│ 
│   with module.keyvault.azurerm_key_vault_secret.key_vault_secret[1],
│   on modules/keyvault/keyvault_secret.tf line 1, in resource "azurerm_key_vault_secret" "key_vault_secret":
│    1: resource "azurerm_key_vault_secret" "key_vault_secret" {
│ 
╵
╷
│ Error: checking for presence of existing Secret "serverapp-secret-ac76373a" (Key Vault "https://kv-ac76373a.vault.azure.net/"): keyvault.BaseClient#GetSecret: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="Forbidden" Message="Public network access is disabled and request is not from a trusted service nor via an approved private link.\r\nCaller: appid=04b07795-8ddb-461a-bbee-02f9e1bf7b46;oid=eaadeb4c-a236-48a1-84f9-5c3685078b2c;iss=https://sts.windows.net/9d5f9c99-0e52-4b50-82d9-6152df0d794a/\r\nVault: kv-ac76373a;location=eastus2" InnerError={"code":"ForbiddenByConnection"}
│ 
│   with module.keyvault.azurerm_key_vault_secret.key_vault_secret[0],
│   on modules/keyvault/keyvault_secret.tf line 1, in resource "azurerm_key_vault_secret" "key_vault_secret":
│    1: resource "azurerm_key_vault_secret" "key_vault_secret" {
│ 
╵
vscode ➜ .../multimodal-ai-1/deployment/terraform/infra (main) $ 

To work around this, I reran the apply command. After it refreshed state, I enabled public access to keyvault and they typed yes to allow terraform to execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions