Enabling GCP Services
GCP services in Guardrails involve two separate configurations:
- Service Enabled policies (
GCP > {Service} > Enabled): control Guardrails permissions and whether resources are considered approved. This is a Guardrails-level setting. - API Enabled policies (
GCP > {Service} > API Enabled): control whether the GCP service API is enabled in the project. This is a GCP-level setting that affects whether Guardrails can discover resources.
Most services need both configured: the Enabled policy for Guardrails governance, and the API enabled in GCP for API access.
Service Enabled Policies
Each GCP service has an Enabled policy (e.g., GCP > Storage > Enabled) that controls whether the service is considered "in use" for governance purposes. By default, all services are Disabled.
What the Enabled Policy Controls
Guardrails Permissions: When Disabled, Guardrails does not create permission grants for that service. This only affects users whose permissions are managed through Guardrails IAM. It does not restrict users who get permissions directly from GCP IAM.
Approved Controls: The Approved > Usage sub-policy defaults to Approved if GCP > {Service} > Enabled. When the service is Disabled, the Approved control marks resources as Not approved. In Check mode this raises an Alarm; in Enforce mode Guardrails takes action on unapproved resources.
API Boundary: When Disabled, the service's APIs are excluded from IAM boundary policies managed by Guardrails.
What the Enabled Policy Does NOT Control
The Enabled policy does not control CMDB or Discovery. Resources are discovered and tracked in the Guardrails CMDB regardless of the Enabled setting. CMDB and Discovery have their own policies (GCP > {Service} > {Resource} > CMDB). Enabling a service is not a prerequisite for resource discovery. It controls Guardrails-managed permissions and the Approved evaluation.
The Enabled policy also does not enable or disable the GCP service API itself. That is managed separately by the API Enabled policy.
Enable a Service
You should enable any services that your users are allowed to use. Examples:
GCP > Storage > EnabledGCP > Compute Engine > EnabledGCP > BigQuery > Enabled
[!TIP] For automating service enablement across many services, see the gcp_services baseline in the Guardrails Samples repository.
Terraform Example
# GCP > Storage > Enabled
resource "turbot_policy_setting" "gcp_storage_enabled" {
resource = "id-of-project-or-folder"
type = "tmod:@turbot/gcp-storage#/policy/types/storageEnabled"
value = "Enabled"
}
API Enabled Policies
Separately from the Enabled policy, GCP allows explicitly enabling and disabling service APIs at the project level. Guardrails provides a corresponding API Enabled policy for each service that can manage this for you.
By default, the API Enabled policy is set to Skip (Guardrails will not modify the setting). Set it to align with the Enabled policy, for example, Enforce: Enabled if Storage > Enabled.
Examples:
GCP > Storage > API EnabledGCP > Compute Engine > API EnabledGCP > BigQuery > API EnabledGCP > Cloud Resource Manager > API Enabled
If a service's API is not enabled in the project, the resource-level CMDB and Discovery controls for that service (for example GCP > Storage > Bucket > Discovery) go to Skipped with the reason Storage API is disabled. Please enable the policy GCP > Storage > API Enabled. Their CMDB policies default to Enforce: Enabled if {Service} API is enabled, so a disabled API is not an error. To govern the service, enable its API in GCP or set the API Enabled policy to Enforce: Enabled.
For Guardrails to enable an API on your behalf, its service account needs serviceusage.services.enable on the project (for example roles/serviceusage.serviceUsageAdmin). The recommended read-only role set for organization imports does not include it, so add it if you plan to use Enforce: Enabled.
APIs Every Project Needs
A few APIs are required in every project Guardrails manages, regardless of which services you govern: Cloud Resource Manager, Service Usage, and Cloud Logging. Unlike service APIs, a missing one of these does produce Error states, in GCP > Project > CMDB and in the event pollers. The gcp-resourcemanager mod provides GCP > Cloud Resource Manager > API Enabled so Guardrails can keep the Cloud Resource Manager API on across the organization. See Required GCP APIs for the full list, where each API must be enabled, and how to enable them in bulk.
Terraform Example
# GCP > Storage > API Enabled
resource "turbot_policy_setting" "gcp_storage_api_enabled" {
resource = "id-of-project-or-folder"
type = "tmod:@turbot/gcp-storage#/policy/types/storageApiEnabled"
value = "Enforce: Enabled if Storage > Enabled"
}
Next Steps
- Configure Real-Time Events to keep Guardrails in sync with changes in your project.
- Manage GCP Permissions to control user access through Guardrails.