Known Issues Terraform Archives - For all your terraform needs https://terraformarchitect.com/category/known-issues-terraform/ Automation cannot be an afterthought (TM) Wed, 08 Mar 2023 00:42:42 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts: Failure sending request: StatusCode=0 — Original Error: context deadline exceeded https://terraformarchitect.com/known-issues-terraform/error-retrieving-contact-for-keyvault-keyvault-baseclientgetcertificatecontacts-failure-sending-request-statuscode0-original-error-context-deadline-exceeded/?utm_source=rss&utm_medium=rss&utm_campaign=error-retrieving-contact-for-keyvault-keyvault-baseclientgetcertificatecontacts-failure-sending-request-statuscode0-original-error-context-deadline-exceeded https://terraformarchitect.com/known-issues-terraform/error-retrieving-contact-for-keyvault-keyvault-baseclientgetcertificatecontacts-failure-sending-request-statuscode0-original-error-context-deadline-exceeded/#comments Mon, 13 Feb 2023 04:32:15 +0000 https://terraformarchitect.com/?p=248 When creating a key vault in Azure using terraform,  you may encounter this error Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts data "azurerm_client_config" "current" {} resource “azurerm_key_vault” “my_key_vault” {  name   […]

The post Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts: Failure sending request: StatusCode=0 — Original Error: context deadline exceeded appeared first on For all your terraform needs.

]]>
When creating a key vault in Azure using terraform,  you may encounter this error
Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts

data "azurerm_client_config" "current" {}

resource “azurerm_key_vault” “my_key_vault” {  name                        = “sample-keyvault-av”

  location                    = azurerm_resource_group.rg_des.location
resource_group_name         = azurerm_resource_group.rg_des.name
tenant_id                   = data.azurerm_client_config.current.tenant_id
sku_name                    = “standard”
#sku_name                    = “premium”
enabled_for_disk_encryption = true
#soft_delete_enabled         = true
purge_protection_enabled    = true

}

}

The issue has been fixed in version 3.3.0 of the azure provider

terraform {
  required_providers {
    azurerm = {
      source  = “hashicorp/azurerm”
      version = “=3.3.0”
    }
  }
}




Need an experienced Cloud Networking or a Cloud Data Protection Expert?  Anuj has successfully delivered over a dozen deployments on each of the public clouds (AWS/GCP/Azure) including several DevSecOps engagements. Set up a time with Anuj Varma.

The post Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts: Failure sending request: StatusCode=0 — Original Error: context deadline exceeded appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/error-retrieving-contact-for-keyvault-keyvault-baseclientgetcertificatecontacts-failure-sending-request-statuscode0-original-error-context-deadline-exceeded/feed/ 2
VS Code does not pick up the latest terraform version https://terraformarchitect.com/known-issues-terraform/vs-code-does-not-pick-up-the-latest-terraform-version/?utm_source=rss&utm_medium=rss&utm_campaign=vs-code-does-not-pick-up-the-latest-terraform-version https://terraformarchitect.com/known-issues-terraform/vs-code-does-not-pick-up-the-latest-terraform-version/#respond Wed, 09 Nov 2022 13:26:30 +0000 https://terraformarchitect.com/?p=299 From a powershell prompt, get the current executable path for terraform using: Get-Command terraform If this is pointing to the older terraform version, simply delete the older terraform.exe file. ReInstall […]

The post VS Code does not pick up the latest terraform version appeared first on For all your terraform needs.

]]>
From a powershell prompt, get the current executable path for terraform using:

Get-Command terraform

If this is pointing to the older terraform version, simply delete the older terraform.exe file.

ReInstall the newer version.  Now, do Get-Command again to see the executable path.

VS Code should also pick up whatever version exe is returned by the Get-Command terraform.

 

 

 

The post VS Code does not pick up the latest terraform version appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/vs-code-does-not-pick-up-the-latest-terraform-version/feed/ 0
VS Code Scripts Error: Cannot be loaded because running scripts is disabled on this system https://terraformarchitect.com/known-issues-terraform/vs-code-scripts-error-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system/?utm_source=rss&utm_medium=rss&utm_campaign=vs-code-scripts-error-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system https://terraformarchitect.com/known-issues-terraform/vs-code-scripts-error-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system/#respond Thu, 03 Nov 2022 14:59:31 +0000 https://terraformarchitect.com/?p=293 VS Code Terminal displays this error Cannot be loaded because running scripts is disabled on this system  If you want to continue using powershell as the terminal, you will need […]

The post VS Code Scripts Error: Cannot be loaded because running scripts is disabled on this system appeared first on For all your terraform needs.

]]>
VS Code Terminal displays this error
Cannot be loaded because running scripts is disabled on this system 
If you want to continue using powershell as the terminal, you will need to tweak settings.json (ctrl shft p and search for settings). Add the following json code to this file.
{
    “terminal.integrated.profiles.windows”: {
        “PowerShell”: {
          “source”: “PowerShell”,
          “icon”: “terminal-powershell”,
          “args”: [“-ExecutionPolicy”, “Bypass”]
        }
      },
      “terminal.integrated.defaultProfile.windows”: “PowerShell”,
}
If you can make do with the windows cmd prompt,  change the VS Code terminal from powerShell to cmd (cmd already has the privileges for running scripts).
  1. Terminal -> New Terminal –> “Default Shell” –> Windows

That’s it.

 

The post VS Code Scripts Error: Cannot be loaded because running scripts is disabled on this system appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/vs-code-scripts-error-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system/feed/ 0
data.azurerm_client_config.current.object_id returns null “” https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/?utm_source=rss&utm_medium=rss&utm_campaign=data-azurerm_client_config-current-object_id-returns-null https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/#respond Tue, 06 Sep 2022 13:48:44 +0000 https://terraformarchitect.com/?p=245 You may be using the current client config object to retrieve the current user’s object id. And that used to work just fine. object_id =  data.azurerm_client_config.current.object_id However, for me, this […]

The post data.azurerm_client_config.current.object_id returns null “” appeared first on For all your terraform needs.

]]>
You may be using the current client config object to retrieve the current user’s object id. And that used to work just fine.

object_id =  data.azurerm_client_config.current.object_id
However, for me, this started returning an empty string. This was the workaround I found:
#AV - diff route to get current user object id

data external account_info {
  program                      = [
                                 "az",
                                 "ad",
                                 "signed-in-user",
                                 "show",
                                 "--query",
                                 "{object_id:id}",
                                 "-o",
                                 "json",
                                 ]
}
/*output user_object_id {
    value = data.external.account_info.result.object_id
}*/
Summary
data.azurerm_client_config.current.object_id  does not return a correct user object id can be fixed by using a different approach – shown above.

The post data.azurerm_client_config.current.object_id returns null “” appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/data-azurerm_client_config-current-object_id-returns-null/feed/ 0
Error: Error decoding “admin_ssh_key.0.public_key” for public key data https://terraformarchitect.com/known-issues-terraform/error-error-decoding-admin_ssh_key-0-public_key-for-public-key-data/?utm_source=rss&utm_medium=rss&utm_campaign=error-error-decoding-admin_ssh_key-0-public_key-for-public-key-data https://terraformarchitect.com/known-issues-terraform/error-error-decoding-admin_ssh_key-0-public_key-for-public-key-data/#respond Tue, 06 Sep 2022 13:36:26 +0000 https://terraformarchitect.com/?p=246 This is an error I encountered while trying to set the admin ssh key for a linux instance – and attempting to use an existing pub key in my .ssh […]

The post Error: Error decoding “admin_ssh_key.0.public_key” for public key data appeared first on For all your terraform needs.

]]>
This is an error I encountered while trying to set the admin ssh key for a linux instance – and attempting to use an existing pub key in my .ssh folder (puttygen can be used to create ssh key pairs)

resource "azurerm_linux_virtual_machine" "myvm" {

  name                = local.vm_name

  resource_group_name = azurerm_resource_group.rg_des.name

  location            = azurerm_resource_group.rg_des.location

  size                = var.vm_size

  admin_username      = "adminuser"

  network_interface_ids = [

    azurerm_network_interface.myvm.id,

  ]

  admin_ssh_key {

    username   = "adminuser"

    #public_key = file("~/.ssh/id_rsa.pub")

     public_key = tls_private_key.linux_test_ssh.public_key_openssh

  }

Instead of doing it through an existing key pair, I used terraform to create the ssh key pair. This worked – no error

# Create (and display) an SSH key

resource "tls_private_key" "linux_test_ssh" {

  algorithm = "RSA"

  rsa_bits  = 4096

}
Summary
If you encounter this error on trying to create linux VMs on azure – Error decoding “admin_ssh_key.0.public_key” for public key data, try creating the key pair directly as a terraform resource.

The post Error: Error decoding “admin_ssh_key.0.public_key” for public key data appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/known-issues-terraform/error-error-decoding-admin_ssh_key-0-public_key-for-public-key-data/feed/ 0