Skip to content

Instantly share code, notes, and snippets.

@softberries
softberries / gcp-goodies-medium-post-snippets1
Created September 8, 2019 07:50
gcp-goodies-medium-post-snippets1
gcloud config set project softwaremill-playground
git clone https://github.com/GoogleCloudPlatform/deploymentmanager-samples.git
resources:
- name: the-first-vm
type: compute.v1.instance
properties:
zone: us-central1-f
machineType: https://www.googleapis.com/compute/v1/projects/[MY_PROJECT]/zones/us-central1-f/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
resources:
- name: the-first-vm
type: compute.v1.instance
properties:
zone: us-central1-f
machineType: https://www.googleapis.com/compute/v1/projects/[MY_PROJECT]/zones/us-central1-f/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
"""Creates the virtual machine."""
COMPUTE_URL_BASE = 'https://www.googleapis.com/compute/v1/'
def GenerateConfig(unused_context):
"""Creates the first virtual machine."""
resources = [{
'name': 'the-first-vm',
"""Creates the virtual machine."""
COMPUTE_URL_BASE = 'https://www.googleapis.com/compute/v1/'
def GenerateConfig(unused_context):
"""Creates the second virtual machine."""
resources = [{
'name': 'the-second-vm',
imports:
- path: vm-template.py
- path: vm-template-2.py
resources:
- name: vm-1
type: vm-template.py
- name: vm-2
type: vm-template-2.py
- name: a-new-network
imports:
- path: vm-template.py
- path: vm-template-2.py
- path: network-template.py
- path: firewall-template.py
- path: compute-engine-template.py
resources:
- name: compute-engine-setup
type: compute-engine-template.py
"""Creates the Compute Engine."""
def GenerateConfig(unused_context):
"""Creates the Compute Engine with network and firewall."""
resources = [{
'name': 'vm-1',
'type': 'vm-template.py'
}, {
"""Creates the virtual machine."""
COMPUTE_URL_BASE = 'https://www.googleapis.com/compute/v1/'
def GenerateConfig(context):
"""Creates the virtual machine with environment variables."""
resources = [{
'name': context.env['name'],