provider "google" {
credentials = "${file("${var.credentials}")}"
project = "${var.gcp_project_id}"
region = "${var.region}"
}
resource "google_compute_instance" "test" {
project = "${var.gcp_project_id}"
name = "${var.new_instance_name}"
machine_type = "${var.machine_type}"
zone = "${var.zone}"
tags = ["allow-ssh-fw-rule"]
boot_disk {
initialize_params {
image = "${var.new_image_name}"
}
}
service_account {
email = "0000000-compute@developer.gserviceaccount.com"
scopes = ["https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/trace.append","https://www.googleapis.com/auth/cloud-platform"]
}
metadata_startup_script=<<SCRIPT
${file("${var.startup_script}")}
SCRIPT
network_interface {
subnetwork = "${var.gce_subnetwork}"
access_config = {
}
}
}
resource "google_compute_instance_group" "test-uig" {
name = "${var.new_instance_group}"
description = "Terraform test instance group"
zone = "${var.zone}"
instances = [
"${google_compute_instance.test.self_link}"
]
lifecycle {
create_before_destroy = true
}
}
Hi @anmohamed,
I found this post at the end of an old topic about a Terraform 0.12 release. Since that was an old thread and this new topic didn’t seem to be obviously related to it I split it out into a new topic here, but since this includes only a configuration example and no other text I’m not sure what your intent was in posting this. If you had a question related to this configuration, or if you were sharing it as an example of how to achieve a particular goal, it’d help if you could add some words to explain what your intent was. Thanks!