Skip to content

Added validation for gcp destinations

Hitesh Raghuvanshi requested to merge 436608-gcp-handler into master

What does this MR do and why?

Added validation of google cloud logging audit event streaming destinations in newly created consolidated external audit event destinations.

The changes are similar to !150669 (merged) for http destinations.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. You need to have a group, let's say twitter and Gitlab instance with Ultimate license.
  2. Go to http://gitlab.localdev:3000/-/graphql-explorer and run following mutations and queries.
  3. First let's try to create a group level destination with category gcp by running following mutation, it will create the destination successfully:
mutation groupAuditEventStreamingDestinationsCreate {
  groupAuditEventStreamingDestinationsCreate(input: {
    name: "gcp_dest",
    category: "gcp",
    groupPath: "twitter",
    secretToken: "random_secret_token123"
    config: {
      googleProjectIdName: "project-id",
      clientEmail: "abcd@example.com",
      logIdName: "audit-events"
    }
  }) {
    errors
    externalAuditEventDestination {
      id
      name
      config
      category
    }
  }
}
  1. The output will be something like following and there should not be any errors:
{
  "data": {
    "groupAuditEventStreamingDestinationsCreate": {
      "errors": [],
      "externalAuditEventDestination": {
        "id": "gid://gitlab/AuditEvents::Group::ExternalStreamingDestination/10",
        "name": "gcp_dest",
        "config": {
          "googleProjectIdName": "project-id",
          "clientEmail": "abcd@example.com",
          "logIdName": "audit-events"
        },
        "category": "gcp"
      }
    }
  }
}
  1. If you try to create a destination with same mutation params in step 3, then you will get following errors:

    {
      "data": {
        "groupAuditEventStreamingDestinationsCreate": {
          "errors": [
            "Config logIdName is already taken.",
            "Name has already been taken"
          ],
          "externalAuditEventDestination": null
        }
      }
    }

Related to #436608

Edited by Hitesh Raghuvanshi

Merge request reports