hashicorp / setup-terraform

Sets up Terraform CLI in your GitHub Actions workflow.
https://developer.hashicorp.com/terraform/tutorials/automation/github-actions
Mozilla Public License 2.0
1.37k stars 241 forks source link

using file provisioner with GCP and Compute Instance #322

Closed rubans closed 10 months ago

rubans commented 1 year ago

Is there any recommended way to use file provisioned in a github action when creating a GCE? I have so far tried using ssh key : 1)

provisioner "file" {
    source = "agent_config"
    destination = "."
    connection {
        host     = "${var.gce_name}"
        type = "ssh"
        private_key = "${file("~/.ssh/google_compute_engine")}"
    }
  }

Bur not sure if the private key exists so also tried 2)

provisioner "file" {
    source = "agent_config"
    destination = "."
    connection {
        host     = "${var.gce_name}"
        type = "ssh"
        agent = true
    }
  }

But get an error related to "SSH agent requested but SSH_AUTH_SOCK not-specified" Any suggestions? I need to use file provisioned to copy some config files to the GCE.

bflad commented 10 months ago

Hi @rubans 👋 Thank you for raising this and sorry you are running into trouble here. Please note that this GitHub repository's issue tracker is only used for feature requests and bug reports for the setup-terraform GitHub action itself. Since this appears to be a Terraform configuration question, my best recommendation would be to submit a topic in the Terraform section of HashiCorp Discuss, where there are many more people asking and answering usage questions such as these.

github-actions[bot] commented 4 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.