<- All Blueprints
Customizable templates for deploying cloud infrastructure

GCP Compute Instance

This blueprint creates a Google Compute Engine instance with best practices in mind, such as not assigning a public IP address by default to enhance security. It uses a default machine type of e2-medium and a Debian 10 image for the boot disk, promoting cost-effectiveness and stability. The blueprint encourages the use of labels for better resource management and organizes variables into logical groups to assist users—including those who may not be cloud infrastructure experts—in configuring essential settings easily.

Define and customize Blueprints to set what infrastructure configuration options are available to developers.

---
constants:
  __name: "{{ name }}_{{ __guid }}"
variables:
  name:
    desc: "Name of the Compute Engine instance."
    required: true
    group: Instance Details
  machine_type:
    desc: "The machine type to create."
    required: true
    group: Instance Details
    default: "e2-medium"
  zone:
    desc: "The zone to deploy the instance in."
    required: true
    group: Instance Details
    default: "us-central1-a"
  image:
    desc: "The image to use for the boot disk. Format: 'project/image'."
    required: false
    group: Boot Disk
    default: "debian-cloud/debian-10"
  disk_size_gb:
    desc: "Size of the boot disk in GB."
    required: false
    group: Boot Disk
    default: 10
  network:
    desc: "The network to attach the instance to."
    required: true
    group: Network
    default: "default"
    links_to: resource.google_compute_network.self_link
  subnetwork:
    desc: "The subnetwork to attach the instance to."
    required: false
    group: Network
    links_to: resource.google_compute_subnetwork.self_link
  service_account_email:
    desc: "Service account email to attach to the instance."
    required: false
    group: Service Account
    default: "default"
    links_to: resource.google_service_account.email
  service_account_scopes:
    desc: "Scopes for the service account."
    required: false
    group: Service Account
    default: ["https://www.googleapis.com/auth/cloud-platform"]
  metadata:
    group: Metadata
    required: false
  labels:
    group: Labels
    required: false
groups:
  Instance Details:
    order: 1
    desc: "Basic settings for the Compute Engine instance."
  Boot Disk:
    order: 2
    desc: "Configuration for the boot disk."
  Network:
    order: 3
    desc: "Network settings for the instance."
  Service Account:
    order: 4
    desc: "Service account settings."
  Metadata:
    order: 5
    desc: "Metadata for the instance."
  Labels:
    order: 6
    desc: "Labels to assign to the instance."
---

resource "google_compute_instance" "__name" {
  name         = {{ name }}
  machine_type = {{ machine_type }}
  zone         = {{ zone }}

  boot_disk {
    initialize_params {
      image = {{ image }}
      size  = {{ disk_size_gb }}
    }
  }

  network_interface {
    network    = {{ network }}
    subnetwork = {{ subnetwork | required: false }}
    # By omitting 'access_config', no public IP will be assigned for enhanced security.
  }

  service_account {
    email  = {{ service_account_email }}
    scopes = {{ service_account_scopes }}
  }

  metadata = {
    {{# metadata }}
      {{ metadata.key | required: false }} = {{ metadata.value | required: false }}
    {{/ metadata }}
  }

  labels = {
    Name = {{ name }}
    {{# labels }}
      {{ labels.key | required: false }} = {{ labels.value | required: false }}
    {{/ labels }}
  }
}

// This Compute Engine instance blueprint defaults to secure settings by not assigning a public IP address and using a minimal machine type. It encourages the use of labels for resource management and allows customization of boot disk, network settings, service account, and metadata. By adhering to best practices, it enhances security and resource organization while providing flexibility for users.
//
A form is created automatically that accepts inputs that you defined in the Blueprint.
After filling out the Blueprint form, Terraform is generated and a PR is automatically submitted.
What am I looking at?

Talk to a Human

See Resourcely in action and learn how it can help you secure and manage your cloud infrastructure today!