'how to setup self connection to google_compute_instance_template for file provisioning
I am trying to do a file provisioned into google_compute_instance_template
using the method shown below
...
provisioner "file" {
source = file("${path.module}/../scripts/infrastructure/circleci/docker-compose.production.yml")
destination = "/tmp/docker_compose_file"
connection {
host = google_compute_instance_template.media_apps_template.self_link.public_ip
agent = false
type = "ssh"
user = "ubuntu"
private_key = "${file("./creds/media_apps")}"
}
}
....
the parent google_compute_instance_template
looks like this
resource "google_compute_instance_template" "media_apps_template" {
}
The error am getting is
Can't access attributes on a primitive-typed value (string).
How can I configure the host part
Solution 1:[1]
try this
? ?connection? {
? type ?=? ?"?ssh?"
? user ?=? ?"?ubuntu?"
? private_key ?=? ?file?(?"?./creds/media_apps?.pem"?)
? host ?=? google_compute_instance_template.self_link.public_ip
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Victor Biga |