如何向部署添加标签?

How do I add labels to a deployment?

我找到了 0 个这样的例子

我有这个模板:

resources:
  - name: resource-name
    type: 'gcp-types/cloudfunctions-v1:projects.locations.functions'
    properties:
      labels:
      - key: testlabel1
        value: testlabel1value
      - key: testlabel2
        value: testlabel2value
      parent: projects/sdfsfsdf/locations/us-central1
      location: us-central1
      function: function-name
      sourceArchiveUrl: 'gs://sdfsfsdf/b50d36e265ec71d457bb7ba5cc13e44c.zip'
      environmentVariables:
        TEST_ENV_VAR: 'zzzzzzzzz'
      entryPoint: handler
      httpsTrigger: {}
      timeout: 60s
      availableMemoryMb: 256
      runtime: nodejs8

产生此错误:

ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation 
- code: CONDITION_NOT_MET
  location: /deployments/test-templates/resources/resource-name->$.properties
  message: |
    error: instance type (array) does not match any allowed primitive type (allowed: ["object"])
        level: "error"
        schema: {"loadingURI":"#","pointer":"/create/properties/labels"}
        instance: {"pointer":"/labels"}
        domain: "validation"
        keyword: "type"
        found: "array"
        expected: ["object"]

虽然文档中应该有这方面的实际示例,但我还是太蠢了。这是正确的格式

resources:
  - name: resource-name
    type: 'gcp-types/cloudfunctions-v1:projects.locations.functions'
    properties:
      labels:
        testlabel1: testlabel1value
        testlabel2: testlabel2value