published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
A Cloud Identity Policy binds a Setting to a PolicyQuery for a Google Workspace / Cloud Identity customer.
Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about Policy, see:
- API documentation
- How-to Guides
Note: This is available only in beta
Example Usage
Cloudidentity Policy Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const primary = new gcp.cloudidentity.Policy("primary", {
customer: "customers/C01234567",
policyQuery: {
orgUnit: "orgUnits/03abcxyz",
group: "groups/0123456789",
query: "true",
},
setting: {
type: "something.googleapis.com/SettingType",
valueJson: JSON.stringify({
enabled: true,
}),
},
});
import pulumi
import json
import pulumi_gcp as gcp
primary = gcp.cloudidentity.Policy("primary",
customer="customers/C01234567",
policy_query={
"org_unit": "orgUnits/03abcxyz",
"group": "groups/0123456789",
"query": "true",
},
setting={
"type": "something.googleapis.com/SettingType",
"value_json": json.dumps({
"enabled": True,
}),
})
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/cloudidentity"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
tmpJSON0, err := json.Marshal(map[string]interface{}{
"enabled": true,
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = cloudidentity.NewPolicy(ctx, "primary", &cloudidentity.PolicyArgs{
Customer: pulumi.String("customers/C01234567"),
PolicyQuery: &cloudidentity.PolicyPolicyQueryArgs{
OrgUnit: pulumi.String("orgUnits/03abcxyz"),
Group: pulumi.String("groups/0123456789"),
Query: pulumi.String("true"),
},
Setting: &cloudidentity.PolicySettingArgs{
Type: pulumi.String("something.googleapis.com/SettingType"),
ValueJson: pulumi.String(json0),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var primary = new Gcp.CloudIdentity.Policy("primary", new()
{
Customer = "customers/C01234567",
PolicyQuery = new Gcp.CloudIdentity.Inputs.PolicyPolicyQueryArgs
{
OrgUnit = "orgUnits/03abcxyz",
Group = "groups/0123456789",
Query = "true",
},
Setting = new Gcp.CloudIdentity.Inputs.PolicySettingArgs
{
Type = "something.googleapis.com/SettingType",
ValueJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["enabled"] = true,
}),
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.cloudidentity.Policy;
import com.pulumi.gcp.cloudidentity.PolicyArgs;
import com.pulumi.gcp.cloudidentity.inputs.PolicyPolicyQueryArgs;
import com.pulumi.gcp.cloudidentity.inputs.PolicySettingArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var primary = new Policy("primary", PolicyArgs.builder()
.customer("customers/C01234567")
.policyQuery(PolicyPolicyQueryArgs.builder()
.orgUnit("orgUnits/03abcxyz")
.group("groups/0123456789")
.query("true")
.build())
.setting(PolicySettingArgs.builder()
.type("something.googleapis.com/SettingType")
.valueJson(serializeJson(
jsonObject(
jsonProperty("enabled", true)
)))
.build())
.build());
}
}
resources:
primary:
type: gcp:cloudidentity:Policy
properties:
customer: customers/C01234567
policyQuery:
orgUnit: orgUnits/03abcxyz
group: groups/0123456789
query: 'true'
setting:
type: something.googleapis.com/SettingType
valueJson:
fn::toJSON:
enabled: true
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);@overload
def Policy(resource_name: str,
args: PolicyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
opts: Optional[ResourceOptions] = None,
customer: Optional[str] = None,
policy_query: Optional[PolicyPolicyQueryArgs] = None,
setting: Optional[PolicySettingArgs] = None)func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: gcp:cloudidentity:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var gcpPolicyResource = new Gcp.CloudIdentity.Policy("gcpPolicyResource", new()
{
Customer = "string",
PolicyQuery = new Gcp.CloudIdentity.Inputs.PolicyPolicyQueryArgs
{
OrgUnit = "string",
Group = "string",
Query = "string",
SortOrder = 0,
},
Setting = new Gcp.CloudIdentity.Inputs.PolicySettingArgs
{
Type = "string",
ValueJson = "string",
},
});
example, err := cloudidentity.NewPolicy(ctx, "gcpPolicyResource", &cloudidentity.PolicyArgs{
Customer: pulumi.String("string"),
PolicyQuery: &cloudidentity.PolicyPolicyQueryArgs{
OrgUnit: pulumi.String("string"),
Group: pulumi.String("string"),
Query: pulumi.String("string"),
SortOrder: pulumi.Int(0),
},
Setting: &cloudidentity.PolicySettingArgs{
Type: pulumi.String("string"),
ValueJson: pulumi.String("string"),
},
})
var gcpPolicyResource = new com.pulumi.gcp.cloudidentity.Policy("gcpPolicyResource", com.pulumi.gcp.cloudidentity.PolicyArgs.builder()
.customer("string")
.policyQuery(PolicyPolicyQueryArgs.builder()
.orgUnit("string")
.group("string")
.query("string")
.sortOrder(0)
.build())
.setting(PolicySettingArgs.builder()
.type("string")
.valueJson("string")
.build())
.build());
gcp_policy_resource = gcp.cloudidentity.Policy("gcpPolicyResource",
customer="string",
policy_query={
"org_unit": "string",
"group": "string",
"query": "string",
"sort_order": 0,
},
setting={
"type": "string",
"value_json": "string",
})
const gcpPolicyResource = new gcp.cloudidentity.Policy("gcpPolicyResource", {
customer: "string",
policyQuery: {
orgUnit: "string",
group: "string",
query: "string",
sortOrder: 0,
},
setting: {
type: "string",
valueJson: "string",
},
});
type: gcp:cloudidentity:Policy
properties:
customer: string
policyQuery:
group: string
orgUnit: string
query: string
sortOrder: 0
setting:
type: string
valueJson: string
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Policy resource accepts the following input properties:
- Customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - Policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- Setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- Customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - Policy
Query PolicyPolicy Query Args - The PolicyQuery the Setting applies to. Structure is documented below.
- Setting
Policy
Setting Args - The Setting configured by this Policy. Structure is documented below.
- customer String
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- customer str
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - policy_
query PolicyPolicy Query Args - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting Args - The Setting configured by this Policy. Structure is documented below.
- customer String
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - policy
Query Property Map - The PolicyQuery the Setting applies to. Structure is documented below.
- setting Property Map
- The Setting configured by this Policy. Structure is documented below.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
Look up Existing Policy Resource
Get an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PolicyState, opts?: CustomResourceOptions): Policy@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
customer: Optional[str] = None,
name: Optional[str] = None,
policy_query: Optional[PolicyPolicyQueryArgs] = None,
setting: Optional[PolicySettingArgs] = None) -> Policyfunc GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)resources: _: type: gcp:cloudidentity:Policy get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - Name string
- The resource name of the Policy. Format:
policies/{policy_id}. - Policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- Setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- Customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - Name string
- The resource name of the Policy. Format:
policies/{policy_id}. - Policy
Query PolicyPolicy Query Args - The PolicyQuery the Setting applies to. Structure is documented below.
- Setting
Policy
Setting Args - The Setting configured by this Policy. Structure is documented below.
- customer String
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - name String
- The resource name of the Policy. Format:
policies/{policy_id}. - policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- customer string
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - name string
- The resource name of the Policy. Format:
policies/{policy_id}. - policy
Query PolicyPolicy Query - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting - The Setting configured by this Policy. Structure is documented below.
- customer str
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - name str
- The resource name of the Policy. Format:
policies/{policy_id}. - policy_
query PolicyPolicy Query Args - The PolicyQuery the Setting applies to. Structure is documented below.
- setting
Policy
Setting Args - The Setting configured by this Policy. Structure is documented below.
- customer String
- The customer that the Policy belongs to. Format:
customers/{customer_id}. - name String
- The resource name of the Policy. Format:
policies/{policy_id}. - policy
Query Property Map - The PolicyQuery the Setting applies to. Structure is documented below.
- setting Property Map
- The Setting configured by this Policy. Structure is documented below.
Supporting Types
PolicyPolicyQuery, PolicyPolicyQueryArgs
- org_
unit str - The OrgUnit the query applies to.
- group str
- The group that the query applies to.
- query str
- The CEL query that defines which entities the Policy applies to.
- sort_
order int - (Output) Decimal sort order of this PolicyQuery.
PolicySetting, PolicySettingArgs
- type str
- The type of the Setting.
- value_
json str - The value of the Setting as JSON string.
Import
Policy can be imported using any of these accepted formats:
policies/{{name}}{{name}}
When using the pulumi import command, Policy can be imported using one of the formats above. For example:
$ pulumi import gcp:cloudidentity/policy:Policy default policies/{{name}}
$ pulumi import gcp:cloudidentity/policy:Policy default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
published on Thursday, Mar 12, 2026 by Pulumi
