e-help

Terraform Plan

terraform init -no-color -input=false
terraform plan -detailed-exitcode -no-color -input=false -out infra_plan.out

Terraform apply

terraform init -no-color -input=false
terraform apply -no-color -input=false infra_plan.out

Other sample command

terraform import module.moduleName.resourceName.resourceLocalName InstanceId
# rename the state file reference name
terraform state mv oldName newName

Terraform output

output "configure" {
  value = <<CONFIGURE

Run the following to configure kubernetes client:

mkdir -p ~/.kube/
export AZURE_KEY_VAULT_NAME=${var.key_vault.name}
sh ./scripts/helpers/read-secret-from-keyvault.sh "aks-kube-config" > ~/.kube/${var.aks.name}
export KUBECONFIG=~/.kube/${var.aks.name}

Test configuration using kubectl:

kubectl get nodes
CONFIGURE
}

Terraform Import

If you r just using the resouce - just find the terraform import command from the resource provider documentation

if you are using a module the standard terraform import resourceName.localName InstanceId will not work . to make this work , you have to use the module name which will show with command teraform plan command . - it’s describe quite well here.