~gcp-py-instance-nginx: formatting changes and add requirements.txt
consolidate resource args into the resource constructors
consistent names for resources
add requirements.txt
formatting
MODIFY
gcp-py-instance-nginx/__main__.py
gcp-py-instance-nginx/__main__.py
import pulumi
from pulumi_gcp import compute
-disk = {
- 'initializeParams': {
- 'image': "centos-cloud/centos-7-v20190116"
- }
-}
-
script = "#!/bin/bash\nsudo touch /tmp/a.txt\nsudo yum install -y nginx\nsudo service nginx start"
-addr = compute.address.Address(resource_name='poc')
-external_ip = addr.address
-network = compute.Network("network")
-network_interface = [
+addr = compute.address.Address("poc")
+
+network = compute.Network("poc")
+
+firewall = compute.Firewall(
+ "poc",
+ network=network.self_link,
+ allows=[
{
- 'network': network.id,
- 'accessConfigs': [{'nat_ip': external_ip}],
+ "protocol": "tcp",
+ "ports": ["22"]
}
]
+)
-firewall = compute.Firewall("firewall", network=network.self_link, allows=[{
- 'protocol': "tcp",
- 'ports': ["22", "80"]
-}])
-
-instance = compute.Instance('poc', name='poc', boot_disk=disk, machine_type="f1-micro",
- network_interfaces=network_interface, metadata_startup_script=script)
+instance = compute.Instance(
+ "poc",
+ name="poc",
+ machine_type="f1-micro",
+ boot_disk={
+ "initializeParams": {
+ "image": "centos-cloud/centos-7-v20190116"
+ }
+ },
+ network_interfaces=[
+ {
+ "network": network.id,
+ "accessConfigs": [{
+ "nat_ip": addr.address
+ }]
+ }
+ ],
+ metadata_startup_script=script,
+)
# Export the DNS name of the bucket
-pulumi.export('instance_name', instance.name)
-pulumi.export('instance_network', instance.network_interfaces)
-pulumi.export('external_ip', addr.address)
+pulumi.export("instance_name", instance.name)
+pulumi.export("instance_network", instance.network_interfaces)
+pulumi.export("external_ip", addr.address)

ADD
gcp-py-instance-nginx/requirements.txt
+pulumi
+pulumi_gcp

~gcp-py-instance-nginx: formatting changes and add requirements.txt (#314)

- consolidate resource args into the resource constructors
- consistent names for resources
- add requirements.txt
- formatting