User Story 124432 (#236)

* Replaced password with SSH key
This commit is contained in:
Tom Archer
2023-07-12 18:24:59 -07:00
committed by GitHub
parent 7c224d76a1
commit aecb7d60e3
6 changed files with 42 additions and 36 deletions

View File

@ -0,0 +1,25 @@
resource "random_pet" "ssh_key_name" {
prefix = "ssh"
separator = ""
}
resource "azapi_resource" "ssh_public_key" {
type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
name = random_pet.ssh_key_name.id
location = "westus3"
parent_id = azurerm_resource_group.rg.id
}
resource "azapi_resource_action" "ssh_public_key_gen" {
type = "Microsoft.Compute/sshPublicKeys@2022-11-01"
resource_id = azapi_resource.ssh_public_key.id
action = "generateKeyPair"
method = "POST"
response_export_values = ["publicKey"]
}
output "key_data" {
value = azapi_resource.ssh_public_key.body
sensitive = true
}