1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. accesscontextmanager
  5. getAccessPolicy
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.accesscontextmanager.getAccessPolicy

Explore with Pulumi AI

Google Cloud v8.26.0 published on Thursday, Apr 10, 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"],
});
Copy
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"])
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/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
	})
}
Copy
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",
        },
    });

});
Copy
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());

    }
}
Copy
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
Copy

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>
Copy
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]
Copy
func LookupAccessPolicy(ctx *Context, args *LookupAccessPolicyArgs, opts ...InvokeOption) (*LookupAccessPolicyResult, error)
func LookupAccessPolicyOutput(ctx *Context, args *LookupAccessPolicyOutputArgs, opts ...InvokeOption) LookupAccessPolicyResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetAccessPolicyResult> getAccessPolicy(GetAccessPolicyArgs args, InvokeOptions options)
public static Output<GetAccessPolicyResult> getAccessPolicy(GetAccessPolicyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:accesscontextmanager/getAccessPolicy:getAccessPolicy
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Parent
This property is required.
Changes to this property will trigger replacement.
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
This property is required.
Changes to this property will trigger replacement.
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
This property is required.
Changes to this property will trigger replacement.
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
This property is required.
Changes to this property will trigger replacement.
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
This property is required.
Changes to this property will trigger replacement.
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
This property is required.
Changes to this property will trigger replacement.
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.
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi