I am trying to deploy a Linux VM with tag "http" and creating firewall for allowing HTTP Port 80 access as tagged firewall "http". The VM is getting deployed but no external access is working for the VM. Also gave startup script for VM but its not working
resources:
- type: compute.v1.instance
name: vm-test
properties:
metadata:
items:
- key: startup-script-url
value: https://storage.googleapis.com/cf405bucket/install-web.sh
zone: {{ properties["zone"] }}
machineType: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/zones/{{ properties["zone"] }}/machineTypes/n1-standard-2
# For examples on how to use startup scripts on an instance, see:
# https://cloud.google.com/compute/docs/startupscript
tags:
items: ["http"]
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
diskName: disk-{{ env["deployment"] }}
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-9
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/global/networks/default
# Access Config required to give the instance a public IP address
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
- type: compute.v1.firewall
name: default-allow-http
properties:
sourceRanges: ["0.0.0.0/0"]
network: https://www.googleapis.com/compute/v1/projects/{{ env["project"] }}/global/networks/default
targetTags: ["http"]
allowed:
- IPProtocol: TCP
ports: ["80"]
Hello World
This page was created from a simple startup script!
EOF service apache2 start