jpvorenk
jpvorenk

Reputation: 153

google deployment manager logging v2 sinks type validation error

I am attempting to create a logging.v2.sink in my deployment manager configuration:

resources:
- name: audit-log-sink
  type: logging.v2.sink
  properties:
    name: audit-log
    destination: projects/{{ env["project"] }}/topics/audit-log-topic
  metadata:
    dependsOn:
      - audit-log-topic

After running the command:

gcloud deployment-manager deployments create my-deployment --config ./my-deployment.jinja --preview

I receive the following validation error:

errors:
- code: CONDITION_NOT_MET
  location: /deployments/my-deployment/resources/audit-log-sink->$.properties
  message: '"/name": domain: validation; keyword: type; message: instance does not
    match any allowed primitive type; allowed: ["string"]; found: "null"'

No matter what I put for the value of the name property it is passed as a null value to the validation.

Upvotes: 4

Views: 793

Answers (2)

Sanmay Mishra
Sanmay Mishra

Reputation: 25

resources:
- name: {{ env["name"] }}-projecthub-log-centralization-bucket
  type: projecthubname/sharedstoragetype1:buckets
  properties:
    kind: storage#bucket
    name: {{ env["name"] }}-projecthub-log-centralization-bucket
    project: gcp-oc-ser-hub-sbx
    storageClass: MULTI_REGIONAL
    labels:
      resourceid: {{ properties["resourceid"] }}
      billingcode: {{ properties["billingcode"] }}
- name: {{ env["name"] }}-iam
  type: gcp-types/storage-v1:storage.buckets.setIamPolicy
  properties:
    bucket: $(ref.{{ env["name"] }}-projecthub-log-centralization-bucket.name)
    bindings:
      - role: roles/storage.objectCreator
        members:
        - $(ref.{{ env["name"] }}-sink.writerIdentity)
- name: {{ env["name"] }}-sink
  type: gcp-types/logging-v2:organizations.sinks
  properties:
    sink: {{ env["name"] }}
    uniqueWriterIdentity: {{ properties["uniqueWriterIdentity"] }}
    includeChildren: true
    outputVersionFormat: V2
    destination: storage.googleapis.com/$(ref.{{ env["name"] }}-servicehub-log-centralization-bucket.name)
    filter: {{ properties["filter"] }}
    organization: "{{ properties["organizationid"] }}"

Upvotes: -2

jpvorenk
jpvorenk

Reputation: 153

The proper field is sink not name. Here is the correct configuration:

resources:
- name: audit-log-sink
  type: logging.v2.sink
  properties:
    sink: audit-log
    destination: projects/{{ env["project"] }}/topics/audit-log-topic
  metadata:
    dependsOn:
      - audit-log-topic

Upvotes: 7

Related Questions