1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. iam
  5. getWorkforcePoolIamPolicy
Google Cloud v8.40.0 published on Monday, Aug 11, 2025 by Pulumi

gcp.iam.getWorkforcePoolIamPolicy

Explore with Pulumi AI

gcp logo
Google Cloud v8.40.0 published on Monday, Aug 11, 2025 by Pulumi

    Retrieves the current IAM policy data for workforcepool

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const policy = gcp.iam.getWorkforcePoolIamPolicy({
        location: example.location,
        workforcePoolId: example.workforcePoolId,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    policy = gcp.iam.get_workforce_pool_iam_policy(location=example["location"],
        workforce_pool_id=example["workforcePoolId"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.LookupWorkforcePoolIamPolicy(ctx, &iam.LookupWorkforcePoolIamPolicyArgs{
    			Location:        pulumi.StringRef(example.Location),
    			WorkforcePoolId: example.WorkforcePoolId,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var policy = Gcp.Iam.GetWorkforcePoolIamPolicy.Invoke(new()
        {
            Location = example.Location,
            WorkforcePoolId = example.WorkforcePoolId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.iam.IamFunctions;
    import com.pulumi.gcp.iam.inputs.GetWorkforcePoolIamPolicyArgs;
    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 policy = IamFunctions.getWorkforcePoolIamPolicy(GetWorkforcePoolIamPolicyArgs.builder()
                .location(example.location())
                .workforcePoolId(example.workforcePoolId())
                .build());
    
        }
    }
    
    variables:
      policy:
        fn::invoke:
          function: gcp:iam:getWorkforcePoolIamPolicy
          arguments:
            location: ${example.location}
            workforcePoolId: ${example.workforcePoolId}
    

    Using getWorkforcePoolIamPolicy

    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 getWorkforcePoolIamPolicy(args: GetWorkforcePoolIamPolicyArgs, opts?: InvokeOptions): Promise<GetWorkforcePoolIamPolicyResult>
    function getWorkforcePoolIamPolicyOutput(args: GetWorkforcePoolIamPolicyOutputArgs, opts?: InvokeOptions): Output<GetWorkforcePoolIamPolicyResult>
    def get_workforce_pool_iam_policy(location: Optional[str] = None,
                                      workforce_pool_id: Optional[str] = None,
                                      opts: Optional[InvokeOptions] = None) -> GetWorkforcePoolIamPolicyResult
    def get_workforce_pool_iam_policy_output(location: Optional[pulumi.Input[str]] = None,
                                      workforce_pool_id: Optional[pulumi.Input[str]] = None,
                                      opts: Optional[InvokeOptions] = None) -> Output[GetWorkforcePoolIamPolicyResult]
    func LookupWorkforcePoolIamPolicy(ctx *Context, args *LookupWorkforcePoolIamPolicyArgs, opts ...InvokeOption) (*LookupWorkforcePoolIamPolicyResult, error)
    func LookupWorkforcePoolIamPolicyOutput(ctx *Context, args *LookupWorkforcePoolIamPolicyOutputArgs, opts ...InvokeOption) LookupWorkforcePoolIamPolicyResultOutput

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

    public static class GetWorkforcePoolIamPolicy 
    {
        public static Task<GetWorkforcePoolIamPolicyResult> InvokeAsync(GetWorkforcePoolIamPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetWorkforcePoolIamPolicyResult> Invoke(GetWorkforcePoolIamPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetWorkforcePoolIamPolicyResult> getWorkforcePoolIamPolicy(GetWorkforcePoolIamPolicyArgs args, InvokeOptions options)
    public static Output<GetWorkforcePoolIamPolicyResult> getWorkforcePoolIamPolicy(GetWorkforcePoolIamPolicyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:iam/getWorkforcePoolIamPolicy:getWorkforcePoolIamPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    WorkforcePoolId string
    Used to find the parent resource to bind the IAM policy to
    Location string
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.
    WorkforcePoolId string
    Used to find the parent resource to bind the IAM policy to
    Location string
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.
    workforcePoolId String
    Used to find the parent resource to bind the IAM policy to
    location String
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.
    workforcePoolId string
    Used to find the parent resource to bind the IAM policy to
    location string
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.
    workforce_pool_id str
    Used to find the parent resource to bind the IAM policy to
    location str
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.
    workforcePoolId String
    Used to find the parent resource to bind the IAM policy to
    location String
    The location for the resource. Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no location is provided in the parent identifier and no location is specified, it is taken from the provider configuration.

    getWorkforcePoolIamPolicy Result

    The following output properties are available:

    Etag string
    (Computed) The etag of the IAM policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    PolicyData string
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    WorkforcePoolId string
    Etag string
    (Computed) The etag of the IAM policy.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    PolicyData string
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    WorkforcePoolId string
    etag String
    (Computed) The etag of the IAM policy.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    policyData String
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    workforcePoolId String
    etag string
    (Computed) The etag of the IAM policy.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    policyData string
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    workforcePoolId string
    etag str
    (Computed) The etag of the IAM policy.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    policy_data str
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    workforce_pool_id str
    etag String
    (Computed) The etag of the IAM policy.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    policyData String
    (Required only by gcp.iam.WorkforcePoolIamPolicy) The policy data generated by a gcp.organizations.getIAMPolicy data source.
    workforcePoolId String

    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 v8.40.0 published on Monday, Aug 11, 2025 by Pulumi