1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. accesscontextmanager
  5. getAccessPolicy
Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi

gcp.accesscontextmanager.getAccessPolicy

Start a Neo task
Explain and create a gcp.accesscontextmanager.getAccessPolicy resource
gcp logo
Google Cloud v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi

    Get information about an Access Context Manager AccessPolicy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const policy_org = gcp.accesscontextmanager.getAccessPolicy({
        parent: "organizations/1234567",
    });
    const policy_scoped = gcp.accesscontextmanager.getAccessPolicy({
        parent: "organizations/1234567",
        scopes: ["projects/1234567"],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    policy_org = gcp.accesscontextmanager.get_access_policy(parent="organizations/1234567")
    policy_scoped = gcp.accesscontextmanager.get_access_policy(parent="organizations/1234567",
        scopes=["projects/1234567"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/accesscontextmanager"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := accesscontextmanager.LookupAccessPolicy(ctx, &accesscontextmanager.LookupAccessPolicyArgs{
    			Parent: "organizations/1234567",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = accesscontextmanager.LookupAccessPolicy(ctx, &accesscontextmanager.LookupAccessPolicyArgs{
    			Parent: "organizations/1234567",
    			Scopes: []string{
    				"projects/1234567",
    			},
    		}, 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_org = Gcp.AccessContextManager.GetAccessPolicy.Invoke(new()
        {
            Parent = "organizations/1234567",
        });
    
        var policy_scoped = Gcp.AccessContextManager.GetAccessPolicy.Invoke(new()
        {
            Parent = "organizations/1234567",
            Scopes = new[]
            {
                "projects/1234567",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.accesscontextmanager.AccesscontextmanagerFunctions;
    import com.pulumi.gcp.accesscontextmanager.inputs.GetAccessPolicyArgs;
    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-org = AccesscontextmanagerFunctions.getAccessPolicy(GetAccessPolicyArgs.builder()
                .parent("organizations/1234567")
                .build());
    
            final var policy-scoped = AccesscontextmanagerFunctions.getAccessPolicy(GetAccessPolicyArgs.builder()
                .parent("organizations/1234567")
                .scopes("projects/1234567")
                .build());
    
        }
    }
    
    variables:
      policy-org:
        fn::invoke:
          function: gcp:accesscontextmanager:getAccessPolicy
          arguments:
            parent: organizations/1234567
      policy-scoped:
        fn::invoke:
          function: gcp:accesscontextmanager:getAccessPolicy
          arguments:
            parent: organizations/1234567
            scopes:
              - projects/1234567
    

    Using getAccessPolicy

    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 getAccessPolicy(args: GetAccessPolicyArgs, opts?: InvokeOptions): Promise<GetAccessPolicyResult>
    function getAccessPolicyOutput(args: GetAccessPolicyOutputArgs, opts?: InvokeOptions): Output<GetAccessPolicyResult>
    def get_access_policy(parent: Optional[str] = None,
                          scopes: Optional[Sequence[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> GetAccessPolicyResult
    def get_access_policy_output(parent: Optional[pulumi.Input[str]] = None,
                          scopes: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetAccessPolicyResult]
    func LookupAccessPolicy(ctx *Context, args *LookupAccessPolicyArgs, opts ...InvokeOption) (*LookupAccessPolicyResult, error)
    func LookupAccessPolicyOutput(ctx *Context, args *LookupAccessPolicyOutputArgs, opts ...InvokeOption) LookupAccessPolicyResultOutput

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

    public static class GetAccessPolicy 
    {
        public static Task<GetAccessPolicyResult> InvokeAsync(GetAccessPolicyArgs args, InvokeOptions? opts = null)
        public static Output<GetAccessPolicyResult> Invoke(GetAccessPolicyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAccessPolicyResult> getAccessPolicy(GetAccessPolicyArgs args, InvokeOptions options)
    public static Output<GetAccessPolicyResult> getAccessPolicy(GetAccessPolicyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:accesscontextmanager/getAccessPolicy:getAccessPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Parent string
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    Scopes List<string>
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}
    Parent string
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    Scopes []string
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}
    parent String
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    scopes List<String>
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}
    parent string
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    scopes string[]
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}
    parent str
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    scopes Sequence[str]
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}
    parent String
    The parent of this AccessPolicy in the Cloud Resource Hierarchy. Format: organizations/{{organization_id}}
    scopes List<String>
    Folder or project on which this policy is applicable. Format: folders/{{folder_id}} or projects/{{project_number}}

    getAccessPolicy Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Resource name of the AccessPolicy.
    Parent string
    Title string
    Human readable title. Does not affect behavior.
    Scopes List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Resource name of the AccessPolicy.
    Parent string
    Title string
    Human readable title. Does not affect behavior.
    Scopes []string
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Resource name of the AccessPolicy.
    parent String
    title String
    Human readable title. Does not affect behavior.
    scopes List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Resource name of the AccessPolicy.
    parent string
    title string
    Human readable title. Does not affect behavior.
    scopes string[]
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Resource name of the AccessPolicy.
    parent str
    title str
    Human readable title. Does not affect behavior.
    scopes Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Resource name of the AccessPolicy.
    parent String
    title String
    Human readable title. Does not affect behavior.
    scopes List<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 v9.4.0 published on Tuesday, Nov 4, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate