Define and customize Blueprints to set what infrastructure configuration options are available to developers.
---
constants:
__name: "{{ name }}_{{ __guid }}"
variables:
name:
desc: "Name of the subnetwork."
required: true
group: Subnetwork Details
network:
desc: "The VPC network to attach the subnetwork to."
required: true
group: Subnetwork Details
links_to: resource.google_compute_network.self_link
ip_cidr_range:
desc: "The IP CIDR range of the subnetwork."
required: true
group: Subnetwork Details
default: "10.0.0.0/24"
region:
desc: "The region where the subnetwork will be created."
required: true
group: Subnetwork Details
default: "us-central1"
private_ip_google_access:
desc: "Whether VMs in this subnetwork can access Google services without external IP addresses."
required: false
group: Subnetwork Settings
default: true
enable_flow_logs:
desc: "Whether to enable flow logging for this subnetwork."
required: false
group: Subnetwork Settings
default: true
secondary_ip_ranges:
group: Secondary IP Ranges
required: false
tags:
group: Tags
required: false
groups:
Subnetwork Details:
order: 1
desc: "Basic settings for the subnetwork."
Subnetwork Settings:
order: 2
desc: "Additional settings for the subnetwork."
Secondary IP Ranges:
order: 3
desc: "Configure secondary IP ranges for the subnetwork."
Tags:
order: 4
desc: "Labels to assign to the subnetwork."
---
resource "google_compute_subnetwork" "__name" {
name = {{ name }}
network = {{ network }}
ip_cidr_range = {{ ip_cidr_range }}
region = {{ region }}
private_ip_google_access = {{ private_ip_google_access }}
enable_flow_logs = {{ enable_flow_logs }}
{{# secondary_ip_ranges }}
secondary_ip_range {
range_name = {{ secondary_ip_ranges.range_name | desc: "Name of the secondary range." | required: true }}
ip_cidr_range = {{ secondary_ip_ranges.ip_cidr_range | desc: "CIDR range of the secondary range." | required: true }}
}
{{/ secondary_ip_ranges }}
labels = {
Name = {{ name }}
{{# tags }}
{{ tags.key | required: false }} = {{ tags.value | required: false }}
{{/ tags }}
}
}
// This subnetwork blueprint follows best practices by enabling private Google access and flow logs by default to enhance security and observability. It allows the configuration of secondary IP ranges and encourages the use of labels for better resource management. The blueprint is organized to assist users, including those who may not be cloud infrastructure experts, in configuring essential settings easily.
//
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.