Created gcp-py-webserver example
ADD
gcp-py-webserver/.gitignore
+*.pyc
+venv/

ADD
gcp-py-webserver/Pulumi.yaml
+name: gcp-py-webserver
+runtime:
+ name: python
+ options:
+ virtualenv: venv
+description: Basic example of a Google Cloud web server accessible over HTTP
+template:
+ config:
+ gcp:project:
+ description: The Google Cloud project to deploy into
+ gcp:zone:
+ description: The Google Cloud zone
+ default: us-central1-a

ADD
gcp-py-webserver/__main__.py
+import pulumi
+from pulumi import ResourceOptions
+from pulumi_gcp import compute
+
+compute_network = compute.Network(
+ "network",
+ auto_create_subnetworks=True,
+)
+
+compute_firewall = compute.Firewall(
+ "firewall",
+ network=compute_network.self_link,
+ allows=[{
+ "protocol": "tcp",
+ "ports": [ "22", "80" ],
+ }]
+)
+
+# A simple bash script that will run when the webserver is initalized
+startup_script = """#!/bin/bash
+echo "Hello, World!" > index.html
+nohup python -m SimpleHTTPServer 80 &"""
+
+instance_addr = compute.address.Address("address")
+compute_instance = compute.Instance(
+ "instance",
+ machine_type="f1-micro",
+ metadata_startup_script=startup_script,
+ boot_disk={
+ "initializeParams": {
+ "image": "debian-cloud/debian-9-stretch-v20181210"
+ }
+ },
+ network_interfaces=[{
+ "network": compute_network.id,
+ "accessConfigs": [{
+ "natIp": instance_addr.address
+ }],
+ }],
+ service_account={
+ "scopes": ["https://www.googleapis.com/auth/cloud-platform"],
+ },
+ opts=ResourceOptions(depends_on=[compute_firewall]),
+)
+
+pulumi.export("instanceName", compute_instance.name)
+pulumi.export("instanceIP", instance_addr.address)
\ No newline at end of file

ADD
gcp-py-webserver/requirements.txt
+pulumi>=2.0.0,<3.0.0
+pulumi-gcp>=3.0.0,<4.0.0

Created gcp-py-webserver example (#712)