Viewing docs for Google Cloud v9.18.0
published on Wednesday, Apr 1, 2026 by Pulumi
published on Wednesday, Apr 1, 2026 by Pulumi
Viewing docs for Google Cloud v9.18.0
published on Wednesday, Apr 1, 2026 by Pulumi
published on Wednesday, Apr 1, 2026 by Pulumi
Use this data source to retrieve a Cloud Identity policy.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const test = gcp.cloudidentity.getPolicy({
name: "policies/{policy_id}",
});
export const policyCustomer = test.then(test => test.customer);
export const policyQueryQuery = test.then(test => test.policyQueries?.[0]?.query);
export const policyQueryOrgUnit = test.then(test => test.policyQueries?.[0]?.orgUnit);
export const policyQueryGroup = test.then(test => test.policyQueries?.[0]?.group);
export const policyQuerySortOrder = test.then(test => test.policyQueries?.[0]?.sortOrder);
export const policySetting = test.then(test => test.setting);
import pulumi
import pulumi_gcp as gcp
test = gcp.cloudidentity.get_policy(name="policies/{policy_id}")
pulumi.export("policyCustomer", test.customer)
pulumi.export("policyQueryQuery", test.policy_queries[0].query)
pulumi.export("policyQueryOrgUnit", test.policy_queries[0].org_unit)
pulumi.export("policyQueryGroup", test.policy_queries[0].group)
pulumi.export("policyQuerySortOrder", test.policy_queries[0].sort_order)
pulumi.export("policySetting", test.setting)
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 {
test, err := cloudidentity.LookupPolicy(ctx, &cloudidentity.LookupPolicyArgs{
Name: "policies/{policy_id}",
}, nil)
if err != nil {
return err
}
ctx.Export("policyCustomer", test.Customer)
ctx.Export("policyQueryQuery", test.PolicyQueries[0].Query)
ctx.Export("policyQueryOrgUnit", test.PolicyQueries[0].OrgUnit)
ctx.Export("policyQueryGroup", test.PolicyQueries[0].Group)
ctx.Export("policyQuerySortOrder", test.PolicyQueries[0].SortOrder)
ctx.Export("policySetting", test.Setting)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var test = Gcp.CloudIdentity.GetPolicy.Invoke(new()
{
Name = "policies/{policy_id}",
});
return new Dictionary<string, object?>
{
["policyCustomer"] = test.Apply(getPolicyResult => getPolicyResult.Customer),
["policyQueryQuery"] = test.Apply(getPolicyResult => getPolicyResult.PolicyQueries[0]?.Query),
["policyQueryOrgUnit"] = test.Apply(getPolicyResult => getPolicyResult.PolicyQueries[0]?.OrgUnit),
["policyQueryGroup"] = test.Apply(getPolicyResult => getPolicyResult.PolicyQueries[0]?.Group),
["policyQuerySortOrder"] = test.Apply(getPolicyResult => getPolicyResult.PolicyQueries[0]?.SortOrder),
["policySetting"] = test.Apply(getPolicyResult => getPolicyResult.Setting),
};
});
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.GetPolicyArgs;
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 test = CloudidentityFunctions.getPolicy(GetPolicyArgs.builder()
.name("policies/{policy_id}")
.build());
ctx.export("policyCustomer", test.customer());
ctx.export("policyQueryQuery", test.policyQueries()[0].query());
ctx.export("policyQueryOrgUnit", test.policyQueries()[0].orgUnit());
ctx.export("policyQueryGroup", test.policyQueries()[0].group());
ctx.export("policyQuerySortOrder", test.policyQueries()[0].sortOrder());
ctx.export("policySetting", test.setting());
}
}
variables:
test:
fn::invoke:
function: gcp:cloudidentity:getPolicy
arguments:
name: policies/{policy_id}
outputs:
# The customer the policy belongs to
policyCustomer: ${test.customer}
# The CEL query of the policy
policyQueryQuery: ${test.policyQueries[0].query}
# The org unit the policy applies to
policyQueryOrgUnit: ${test.policyQueries[0].orgUnit}
# The group the policy applies to
policyQueryGroup: ${test.policyQueries[0].group}
# The sort order of the policy
policyQuerySortOrder: ${test.policyQueries[0].sortOrder}
# The setting of the policy as a JSON string
policySetting: ${test.setting}
Using getPolicy
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 getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>def get_policy(name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPolicyResult
def get_policy_output(name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]func LookupPolicy(ctx *Context, args *LookupPolicyArgs, opts ...InvokeOption) (*LookupPolicyResult, error)
func LookupPolicyOutput(ctx *Context, args *LookupPolicyOutputArgs, opts ...InvokeOption) LookupPolicyResultOutput> Note: This function is named LookupPolicy in the Go SDK.
public static class GetPolicy
{
public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
public static Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
fn::invoke:
function: gcp:cloudidentity/getPolicy:getPolicy
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
- Name string
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
- name String
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
- name string
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
- name str
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
- name String
- The resource name of the policy to retrieve. Format:
policies/{policy_id}.
getPolicy Result
The following output properties are available:
- Customer string
- The customer that the policy belongs to.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the policy.
- Policy
Queries List<GetPolicy Policy Query> - 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.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the policy.
- Policy
Queries []GetPolicy Policy Query - 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.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the policy.
- policy
Queries List<GetPolicy Policy Query> - 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.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the policy.
- policy
Queries GetPolicy Policy Query[] - 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.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The resource name of the policy.
- policy_
queries Sequence[GetPolicy Policy Query] - 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.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the policy.
- policy
Queries 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.
Supporting Types
GetPolicyPolicyQuery
- 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.
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.
Viewing docs for Google Cloud v9.18.0
published on Wednesday, Apr 1, 2026 by Pulumi
published on Wednesday, Apr 1, 2026 by Pulumi
