ICCS-ISAC / terraform-google-indy-node

Terraform module to deploy an Indy node on GCP
Apache License 2.0
0 stars 2 forks source link

Adding SSH Keys to the VM within the module #3

Open SylvainMartel opened 2 years ago

SylvainMartel commented 2 years ago

Find a way to add SSH keys through the module. Problem with the count repetition right now.

Presently, we can add a block like this outside before, or after, calling the module

resource "google_compute_project_metadata" "default" {
  for_each = toset(["username:${file("./files/sshpubkey.pem.pub")}"])
  project  = data.google_project.gpc_indy_node.number
  metadata = {
    ssh-keys = each.value
  }
}

but I'd like to find way to put it inside the module itself. The reason it's not there yet is that if we use a "count" of 2 or higher when calling the module, to deploy more than one node, the SSH keys can only be added once to the project and will give an error when trying to apply a second time.

SylvainMartel commented 2 years ago

After discussion, SSH keys should probably be managed by the ansible code. The only SSH key to add through TF should be the one to allow ansible to connect.