无法创建标记的防火墙规则,无法通过Deployment Manager将其分配给VM

时间:2019-05-07 14:58:57

标签: google-deployment-manager

我正在尝试使用防火墙规则标记创建虚拟机并启动脚本。不幸的是,VM无法获得外部访问权限,并且启动脚本无法正常工作。

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"]

0 个答案:

没有答案