0

I am trying to create VM with firewall rule tag and start script. Unfortunately VM is not getting external access and startup script is not working properly.

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"]
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Kunal
  • 1
  • Welcome to Stack Overflow. How is the startup script not working? What did you do to test external access from the VM? Please [edit] the question to add that information. – Jason Aller May 07 '19 at 15:09
  • Are you getting an error message? The manifest syntax looks correct – Patrick W Sep 23 '19 at 18:56

0 Answers0