Score:0

How to retrieve private key information when we are creating azure vm from terraform?

uz flag

I have created a linux centos machine on azure cloud using terraform.

I tried to see the content of private key so I can connect later using output variable.

But, I got error as I need to set it as sensitive and I did the same and the outputs is shown as below.

Apply complete! Resources: 15 added, 0 changed, 0 destroyed.

Outputs:

tls_private_key = <sensitive>

How to get the private key content then? My terraform files link

It seems I can retrieve that from state file but it has all the lines kept with \n and I need to manually replace all of them one by one with new line from editor like vscode.

Any other suugestions?

Score:0
us flag

refer :https://docs.microsoft.com/en-us/azure/developer/terraform/create-linux-virtual-machine-with-infrastructure

  1. terraform output -raw tls_private_key > id_rsa
  2. terraform output public_ip_address
  3. ssh -i id_rsa azureuser@<public_ip_address>
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.