Can you attach a firewall rule to a instance template

Lets say I have the following instance template:

resource "google_compute_instance_template" "label_studio_template" {
  name         = "label-studio-template"
  machine_type = "e2-micro"  # Free tier instance
  tags         = ["label-studio-server-template"]
  
  disk {
    auto_delete = false
    source_image = "debian-11-bullseye-v20230509"
  }

  network_interface {
    network = "default"
    access_config {
      // Public IP
      nat_ip = google_compute_address.standard.address
      network_tier = "STANDARD"
    }
  }
  metadata = {
    label_studio_username   = var.label_studio_username
    label_studio_password   = var.label_studio_password
    label_studio_user_token = var.label_studio_user_token
  }
  metadata_startup_script = file("${path.module}/compute_metadata.sh")
}

is it possible to use the tags here to attach firewall policies to all instances that are created from the template?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation