Resource Shutdown via terraform
Terraform is often used to destroy environments - which keeps the state file consistent, when the next create event needs to occur. However, sometimes, instead of destroying resources, all you…
Terraform for IAM resource creation
Overview Is terraform a suitable tool for creating and managing cloud IAM resources? The short answer is - no. Especially, if you are going to be dealing with a large…
Error: retrieving `contact` for KeyVault: keyvault.BaseClient#GetCertificateContacts: Failure sending request: StatusCode=0 — Original Error: context deadline exceeded
When creating a key vault in Azure using terraform, you may encounter this error Error: retrieving `contact` for KeyVault: #GetCertificateContacts data "azurerm_client_config" "current" {} resource "azurerm_key_vault" "my_key_vault" { name …
Retrieving Resource IDs in Terraform – The Terraform Data Block
Also read - Terraform external data querying The Terraform Data Block - Retrieving a Project Id for a GCP project data "google_project" "project" { } output "project_number" { value =…
tfvars versus variables.tf
Prompting a user for Input in Terraform To me, the primary use case is that I want to prompt a user to provide the value for the input variable. In…
VS Code does not pick up the latest terraform version
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 file. ReInstall the…
VS Code Scripts Error: Cannot be loaded because running scripts is disabled on this system
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…
Error – ‘registry.terraform.io/hashicorp/local: there is no package for registry.terraform.io/hashicorp/local cached in .terraform/providers’
Terraform init or terraform init -upgrade or terraform apply fails with this error message: The installed provider plugins are not consistent with the packages selected in the dependency lock file:…
Using -out with terraform plan – terraform plan -out
This is a short post - always use the -out option. This saves the current plan - and will execute it exactly as saved (once you pass in the saved…
Data Block External Data – Querying External Resources in Terraform
Retrieving External data Use either the data block or the terraform_remote_state block to retrieve external data. However, there are scenarios where the data block does not exist in the provider or terraform_remote_state cannot be used, such as…