1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. cloudidentity
  5. getPolicies
Google Cloud v9.7.0 published on Wednesday, Dec 24, 2025 by Pulumi
gcp logo
Google Cloud v9.7.0 published on Wednesday, Dec 24, 2025 by Pulumi

    Use this data source to list Cloud Identity policies.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const all = gcp.cloudidentity.getPolicies({});
    export const firstPolicyName = all.then(all => all.policies?.[0]?.name);
    export const firstPolicyCustomer = all.then(all => all.policies?.[0]?.customer);
    export const policyQueryQuery = all.then(all => all.policies?.[0]?.policyQueries?.[0]?.query);
    export const policyQueryOrgUnit = all.then(all => all.policies?.[0]?.policyQueries?.[0]?.orgUnit);
    export const policyQueryGroup = all.then(all => all.policies?.[0]?.policyQueries?.[0]?.group);
    export const policyQuerySortOrder = all.then(all => all.policies?.[0]?.policyQueries?.[0]?.sortOrder);
    export const policySetting = all.then(all => all.policies?.[0]?.setting);
    export const policyType = all.then(all => all.policies?.[0]?.type);
    
    import pulumi
    import pulumi_gcp as gcp
    
    all = gcp.cloudidentity.get_policies()
    pulumi.export("firstPolicyName", all.policies[0].name)
    pulumi.export("firstPolicyCustomer", all.policies[0].customer)
    pulumi.export("policyQueryQuery", all.policies[0].policy_queries[0].query)
    pulumi.export("policyQueryOrgUnit", all.policies[0].policy_queries[0].org_unit)
    pulumi.export("policyQueryGroup", all.policies[0].policy_queries[0].group)
    pulumi.export("policyQuerySortOrder", all.policies[0].policy_queries[0].sort_order)
    pulumi.export("policySetting", all.policies[0].setting)
    pulumi.export("policyType", all.policies[0].type)
    
    package main
    
    import (
    	"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 {
    		all, err := cloudidentity.GetPolicies(ctx, &cloudidentity.GetPoliciesArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstPolicyName", all.Policies[0].Name)
    		ctx.Export("firstPolicyCustomer", all.Policies[0].Customer)
    		ctx.Export("policyQueryQuery", all.Policies[0].PolicyQueries[0].Query)
    		ctx.Export("policyQueryOrgUnit", all.Policies[0].PolicyQueries[0].OrgUnit)
    		ctx.Export("policyQueryGroup", all.Policies[0].PolicyQueries[0].Group)
    		ctx.Export("policyQuerySortOrder", all.Policies[0].PolicyQueries[0].SortOrder)
    		ctx.Export("policySetting", all.Policies[0].Setting)
    		ctx.Export("policyType", all.Policies[0].Type)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Gcp.CloudIdentity.GetPolicies.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["firstPolicyName"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.Name),
            ["firstPolicyCustomer"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.Customer),
            ["policyQueryQuery"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.PolicyQueries[0]?.Query),
            ["policyQueryOrgUnit"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.PolicyQueries[0]?.OrgUnit),
            ["policyQueryGroup"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.PolicyQueries[0]?.Group),
            ["policyQuerySortOrder"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.PolicyQueries[0]?.SortOrder),
            ["policySetting"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.Setting),
            ["policyType"] = all.Apply(getPoliciesResult => getPoliciesResult.Policies[0]?.Type),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.cloudidentity.CloudidentityFunctions;
    import com.pulumi.gcp.cloudidentity.inputs.GetPoliciesArgs;
    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) {
            final var all = CloudidentityFunctions.getPolicies(GetPoliciesArgs.builder()
                .build());
    
            ctx.export("firstPolicyName", all.policies()[0].name());
            ctx.export("firstPolicyCustomer", all.policies()[0].customer());
            ctx.export("policyQueryQuery", all.policies()[0].policyQueries()[0].query());
            ctx.export("policyQueryOrgUnit", all.policies()[0].policyQueries()[0].orgUnit());
            ctx.export("policyQueryGroup", all.policies()[0].policyQueries()[0].group());
            ctx.export("policyQuerySortOrder", all.policies()[0].policyQueries()[0].sortOrder());
            ctx.export("policySetting", all.policies()[0].setting());
            ctx.export("policyType", all.policies()[0].type());
        }
    }
    
    variables:
      all:
        fn::invoke:
          function: gcp:cloudidentity:getPolicies
          arguments: {}
    outputs:
      # The name of the first policy in the list of policies
      firstPolicyName: ${all.policies[0].name}
      # The customer to whom the first policy belongs to. This will always be the
      # // same across multiple policies as well.
      firstPolicyCustomer: ${all.policies[0].customer}
      # The CEL query of the first policy
      policyQueryQuery: ${all.policies[0].policyQueries[0].query}
      # The org unit the first policy applies to
      policyQueryOrgUnit: ${all.policies[0].policyQueries[0].orgUnit}
      # The group the first policy applies to
      policyQueryGroup: ${all.policies[0].policyQueries[0].group}
      # The sort order of the first policy
      policyQuerySortOrder: ${all.policies[0].policyQueries[0].sortOrder}
      # The setting of the first policy as a JSON string
      policySetting: ${all.policies[0].setting}
      # The type of policy - ADMIN/SYSTEM
      policyType: ${all.policies[0].type}
    

    Using getPolicies

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getPolicies(args: GetPoliciesArgs, opts?: InvokeOptions): Promise<GetPoliciesResult>
    function getPoliciesOutput(args: GetPoliciesOutputArgs, opts?: InvokeOptions): Output<GetPoliciesResult>
    def get_policies(filter: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetPoliciesResult
    def get_policies_output(filter: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetPoliciesResult]
    func GetPolicies(ctx *Context, args *GetPoliciesArgs, opts ...InvokeOption) (*GetPoliciesResult, error)
    func GetPoliciesOutput(ctx *Context, args *GetPoliciesOutputArgs, opts ...InvokeOption) GetPoliciesResultOutput

    > Note: This function is named GetPolicies in the Go SDK.

    public static class GetPolicies 
    {
        public static Task<GetPoliciesResult> InvokeAsync(GetPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetPoliciesResult> Invoke(GetPoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
    public static Output<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:cloudidentity/getPolicies:getPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filter string
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.
    Filter string
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.
    filter String
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.
    filter string
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.
    filter str
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.
    filter String
    Filter expression for listing policies, as documented in the Cloud Identity Policy API policies.list method.

    getPolicies Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Policies List<GetPoliciesPolicy>
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    Filter string
    Id string
    The provider-assigned unique ID for this managed resource.
    Policies []GetPoliciesPolicy
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    Filter string
    id String
    The provider-assigned unique ID for this managed resource.
    policies List<GetPoliciesPolicy>
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    filter String
    id string
    The provider-assigned unique ID for this managed resource.
    policies GetPoliciesPolicy[]
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    filter string
    id str
    The provider-assigned unique ID for this managed resource.
    policies Sequence[GetPoliciesPolicy]
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    filter str
    id String
    The provider-assigned unique ID for this managed resource.
    policies List<Property Map>
    List of Cloud Identity policies that match the filter (or all policies if no filter is provided). Structure is documented below.
    filter String

    Supporting Types

    GetPoliciesPolicy

    Customer string
    The customer that the policy belongs to.
    Name string
    The resource name of the policy.
    PolicyQueries List<GetPoliciesPolicyPolicyQuery>
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    Setting string
    The setting configured by this policy, represented as a JSON string.
    Type string
    The type of the policy.
    Customer string
    The customer that the policy belongs to.
    Name string
    The resource name of the policy.
    PolicyQueries []GetPoliciesPolicyPolicyQuery
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    Setting string
    The setting configured by this policy, represented as a JSON string.
    Type string
    The type of the policy.
    customer String
    The customer that the policy belongs to.
    name String
    The resource name of the policy.
    policyQueries List<GetPoliciesPolicyPolicyQuery>
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    setting String
    The setting configured by this policy, represented as a JSON string.
    type String
    The type of the policy.
    customer string
    The customer that the policy belongs to.
    name string
    The resource name of the policy.
    policyQueries GetPoliciesPolicyPolicyQuery[]
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    setting string
    The setting configured by this policy, represented as a JSON string.
    type string
    The type of the policy.
    customer str
    The customer that the policy belongs to.
    name str
    The resource name of the policy.
    policy_queries Sequence[GetPoliciesPolicyPolicyQuery]
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    setting str
    The setting configured by this policy, represented as a JSON string.
    type str
    The type of the policy.
    customer String
    The customer that the policy belongs to.
    name String
    The resource name of the policy.
    policyQueries List<Property Map>
    A list containing the CEL query that defines which entities the policy applies to. Structure is documented below.
    setting String
    The setting configured by this policy, represented as a JSON string.
    type String
    The type of the policy.

    GetPoliciesPolicyPolicyQuery

    Group string
    The group that the policy applies to.
    OrgUnit string
    The org unit that the policy applies to.
    Query string
    The query that defines which entities the policy applies to.
    SortOrder double
    The sort order of the policy.
    Group string
    The group that the policy applies to.
    OrgUnit string
    The org unit that the policy applies to.
    Query string
    The query that defines which entities the policy applies to.
    SortOrder float64
    The sort order of the policy.
    group String
    The group that the policy applies to.
    orgUnit String
    The org unit that the policy applies to.
    query String
    The query that defines which entities the policy applies to.
    sortOrder Double
    The sort order of the policy.
    group string
    The group that the policy applies to.
    orgUnit string
    The org unit that the policy applies to.
    query string
    The query that defines which entities the policy applies to.
    sortOrder number
    The sort order of the policy.
    group str
    The group that the policy applies to.
    org_unit str
    The org unit that the policy applies to.
    query str
    The query that defines which entities the policy applies to.
    sort_order float
    The sort order of the policy.
    group String
    The group that the policy applies to.
    orgUnit String
    The org unit that the policy applies to.
    query String
    The query that defines which entities the policy applies to.
    sortOrder Number
    The sort order of the policy.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud v9.7.0 published on Wednesday, Dec 24, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate