Skip to main content

CCM GCP Permissions

When assigning permissions to Harness' service account to GCP for CCM, there are many different permissions sets based on the features you are trying to leverage in specific accounts. This guide is meant to cover all the different features of CCM and the permissions you need to assign to enable them.

To enable specific features on a connector you need to set a specific string in the featuresEnabled field (list) in the connector YAML. The keys for each feature are listed in the sections below.

Cost Ingestion

featuresEnabled

BILLING

When to enable

Project which holds the BigQuery table where your Billing Export lives

To ingest cost from GCP, Harness leverages a Billing Export that is generated by GCP. These reports are delivered to a BigQuery table in some project. When assigning permissions, we will need access to read the data in the table.

To do this you can assign roles/bigquery.dataViewer on the table.

Events/Inventory

featuresEnabled

VISIBILITY

When to enable

Projects where infrastructure is provisioned, usually all

To let Harness collect inventory data (used in dashboards) you need to give read permissions to the subscription. You can do this by assigning the built in roles/Reader role.

Asset Governance

featuresEnabled

GOVERNANCE

When to enable

Projects where infrastructure is provisioned, usually all

When enabling asset governance, it is best practice to start with a read-only policy so you can run rules in dry-run, receive out-of-the-box recommendations, and begin to create your own custom governance recommendations.

We suggest you use the GCP-provided roles/Reader role which will allow Harness to access GCP resources in a read-only manner.

Once you are ready to perform actions using governance, you can create a custom policy to allow only the actions you want to take via governance, or use built-in roles to provide whatever access you are comfortable with.

For example if you are going to begin auto-deleting disks using governance, you might assign compute.disks.delete.

Autostopping

featuresEnabled

OPTIMIZATION

When to enable

Projects where infrastructure is provisioned, usually all

Autostopping has many ways to optimize resource usage and reduce costs. Across the different compute and routing SKUs there are many possible permissions needed. Based on your compute and application architecture you can use the following information to build a least-privileged policy.

VM with Fixed Schedules

PolicyUsage
compute.instances.listList VMs
compute.instances.setLabelsTag VM
compute.regions.getGet region information to list zones
compute.regions.listList regions
compute.zoneOperations.getRequired while waiting to complete VM operations, for example stop operation
compute.instances.stopStop VM
compute.instances.startStart VM

Instance Group with Fixed schedules

PolicyUsage
compute.regions.getGet region information to list zones
compute.regions.listList regions
compute.instanceGroups.listlist instance groups
compute.instanceGroupManagers.listlist managed instance groups
compute.instanceGroups.getget instance groups details
compute.instances.getGet instances in instance groups
compute.autoscalers.listList autoscalers
compute.autoscalers.getGet autoscaler details
compute.autoscalers.updateFor updating autoscaler configurations. This is needed during warm up and cool down
compute.instances.listList VMS in instance group
compute.instances.deleteDeleting VMs from managed instance groups during cool down
compute.globalOperations.getGet status of operations
compute.regionOperations.getGet status of operations
compute.zoneOperations.getGet status of operations

Provisioning Autostopping Proxy

PolicyUsage
compute.networks.listList networks
compute.machineTypes.listList machine types
compute.subnetworks.listList subnets
compute.firewalls.listList security groups
compute.addresses.createCreate address
compute.addresses.getGet address
compute.disks.createcreate disk
compute.subnetworks.useUse sub network
compute.instances.createCreate proxy VM
compute.subnetworks.useExternalIpuse static IP
compute.addresses.useUse address
compute.instances.setMetadataSet VM metadata
compute.instances.setTagsSet tags
compute.addresses.deleteDelete address
compute.instances.deleteDelete proxy VM