yamlgoogle-compute-enginegoogle-deployment-manager

How do I configure a Google Compute Instance to allow http traffic when deploying from a YAML config file?


As the title suggests, I'm trying to configure a deployment in GCP. At the moment, all the deployment consists of is a single Compute instance, although I am having trouble trying to add the http-server and https-server tags into the config file. The instance is created fine without trying to add the tags. Here is the top of my yaml file:

resources:
- type: compute.v1.instance
  name: [redacted]
  properties:
    zone: europe-west1-b
    # Allow http and https traffic
    tags:
    - http-server
    - https-server
    machineType: https://www.googleapis.com/compute/v1/projects/[redacted]/zones/europe-west1-b/machineTypes/f1-micro
.......etc

The error I get is:

ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1548860751491-580ae3ee63331-467fd040-1f00fce0]: errors:
- code: CONDITION_NOT_MET
  location: /deployments/[redacted]/resources/[redacted]>$.properties
  message: '"/tags": domain: validation; keyword: type; message: instance does not
    match any allowed primitive type; allowed: ["object"]; found: "array"'

This is my first attempt at writing a yaml config file so there could be some simple context issues.


Solution

  • I managed to fix it myself:

    tags:
      items:
      - http-server
      - https-server