Skip to main content

Examples

This page contains the base examples for mapping GCP resources to Port.

This base example thrives to provide a simpler and more abstract way to map GCP resources to Port.

The simplification is achieved by using the generic cloudResource kind and blueprint, which can be used to map any GCP resource to Port.

Mapping GCP Projects

In the following example you will ingest your GCP Projects to Port, you may use the following Port blueprint definitions and integration configuration:

Project Blueprint
{
"identifier": "gcpProject",
"title": "GCP Project",
"icon": "GoogleCloud",
"schema": {
"properties": {}
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {}
},
Mapping configuration for Google Cloud Projects
resources:
- kind: cloudresourcemanager.googleapis.com/Project
selector:
query: "true"
port:
entity:
mappings:
identifier: ".name"
blueprint: '"gcpProject"'
title: ".display_name"

Here are the API references we used to create those blueprints and app config:

Mapping Cloud Resources

In the following example you will ingest your GCP Resources to Port, you may use the following Port blueprint definitions and integration configuration:

Relate resources and Projects

The Resources below have a relation to the Project, so the creation of the Project is required.

Cloud Resource Blueprint
{
"identifier": "gcpCloudResource",
"title": "Cloud Resource",
"icon": "GoogleCloud",
"schema": {
"properties": {
"type": {
"icon": "Service",
"title": "Type",
"type": "string"
},
"location": {
"icon": "Home",
"title": "Location",
"type": "string"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"project": {
"target": "gcpProject",
"title": "Project",
"required": false,
"many": false
}
}
}
Mapping configuration for cloud resources
Cloud resource kind

The cloudResource kind is a generic kind that can be used to map most cloud resources.

The mapping requires passing the resource kind as a parameter inside the resourceKinds object.

It is possible that some of the kinds that you want to export are not in this example, head to the bottom of the page to see how to add them.

resources:
- kind: cloudResource
selector:
query: 'true'
resourceKinds:
[
"compute.googleapis.com/Disk",
"pubsub.googleapis.com/Subscription",
"iam.googleapis.com/ServiceAccount",
]
port:
entity:
mappings:
identifier: ".name"
title: ".display_name"
blueprint: '"gcpCloudResource"'
properties:
type: ".asset_type"
location: ".location"
relations:
project: ".project"

Here are the API references we used to create those blueprints and app config:

Mapping Extra Resources

The resources in this page are only a few of the resources that the GCP Integration supports.

If the resources you want to ingest into Port do not appear in these examples, you can head to the Mapping Extra Resources page to learn about all of the kinds of GCP resources that are supported by the GCP integration and how to map them into Port.