1. Packages
  2. OVH
  3. API Docs
  4. Iam
  5. getPolicy
OVHCloud v2.11.0 published on Monday, Feb 9, 2026 by OVHcloud
ovh logo
OVHCloud v2.11.0 published on Monday, Feb 9, 2026 by OVHcloud

    Use this data source to retrieve am IAM policy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    
    const myPolicy = ovh.Iam.getPolicy({
        id: "my_policy_id",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    my_policy = ovh.Iam.get_policy(id="my_policy_id")
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh/iam"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := iam.GetPolicy(ctx, &iam.GetPolicyArgs{
    			Id: "my_policy_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var myPolicy = Ovh.Iam.GetPolicy.Invoke(new()
        {
            Id = "my_policy_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.Iam.IamFunctions;
    import com.pulumi.ovh.Iam.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 myPolicy = IamFunctions.getPolicy(GetPolicyArgs.builder()
                .id("my_policy_id")
                .build());
    
        }
    }
    
    variables:
      myPolicy:
        fn::invoke:
          function: ovh:Iam:getPolicy
          arguments:
            id: my_policy_id
    

    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(allows: Optional[Sequence[str]] = None,
                   denies: Optional[Sequence[str]] = None,
                   description: Optional[str] = None,
                   excepts: Optional[Sequence[str]] = None,
                   id: Optional[str] = None,
                   permissions_groups: Optional[Sequence[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(allows: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   denies: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   description: Optional[pulumi.Input[str]] = None,
                   excepts: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   id: Optional[pulumi.Input[str]] = None,
                   permissions_groups: Optional[pulumi.Input[Sequence[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: ovh:Iam/getPolicy:getPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    UUID of the policy.
    Allows List<string>
    Set of actions allowed by the policy.
    Denies List<string>
    Set of actions that will be denied no matter what policy exists.
    Description string
    Group description.
    Excepts List<string>
    Set of actions that will be subtracted from the allow list.
    PermissionsGroups List<string>
    Set of permissions groups that apply to the policy.
    Id string
    UUID of the policy.
    Allows []string
    Set of actions allowed by the policy.
    Denies []string
    Set of actions that will be denied no matter what policy exists.
    Description string
    Group description.
    Excepts []string
    Set of actions that will be subtracted from the allow list.
    PermissionsGroups []string
    Set of permissions groups that apply to the policy.
    id String
    UUID of the policy.
    allows List<String>
    Set of actions allowed by the policy.
    denies List<String>
    Set of actions that will be denied no matter what policy exists.
    description String
    Group description.
    excepts List<String>
    Set of actions that will be subtracted from the allow list.
    permissionsGroups List<String>
    Set of permissions groups that apply to the policy.
    id string
    UUID of the policy.
    allows string[]
    Set of actions allowed by the policy.
    denies string[]
    Set of actions that will be denied no matter what policy exists.
    description string
    Group description.
    excepts string[]
    Set of actions that will be subtracted from the allow list.
    permissionsGroups string[]
    Set of permissions groups that apply to the policy.
    id str
    UUID of the policy.
    allows Sequence[str]
    Set of actions allowed by the policy.
    denies Sequence[str]
    Set of actions that will be denied no matter what policy exists.
    description str
    Group description.
    excepts Sequence[str]
    Set of actions that will be subtracted from the allow list.
    permissions_groups Sequence[str]
    Set of permissions groups that apply to the policy.
    id String
    UUID of the policy.
    allows List<String>
    Set of actions allowed by the policy.
    denies List<String>
    Set of actions that will be denied no matter what policy exists.
    description String
    Group description.
    excepts List<String>
    Set of actions that will be subtracted from the allow list.
    permissionsGroups List<String>
    Set of permissions groups that apply to the policy.

    getPolicy Result

    The following output properties are available:

    Conditions List<GetPolicyCondition>
    Conditions restricting the policy.
    CreatedAt string
    Creation date of this group.
    ExpiredAt string
    Expiration date of the policy.
    Id string
    Identities List<string>
    Set of identities affected by the policy.
    Name string
    Name of the policy.
    Owner string
    Owner of the policy.
    ReadOnly bool
    Indicates that the policy is a default one.
    Resources List<string>
    Set of resources affected by the policy.
    UpdatedAt string
    Date of the last update of this group.
    Allows List<string>
    Set of actions allowed by the policy.
    Denies List<string>
    Set of actions that will be denied no matter what policy exists.
    Description string
    Group description.
    Excepts List<string>
    Set of actions that will be subtracted from the allow list.
    PermissionsGroups List<string>
    Set of permissions groups that apply to the policy.
    Conditions []GetPolicyCondition
    Conditions restricting the policy.
    CreatedAt string
    Creation date of this group.
    ExpiredAt string
    Expiration date of the policy.
    Id string
    Identities []string
    Set of identities affected by the policy.
    Name string
    Name of the policy.
    Owner string
    Owner of the policy.
    ReadOnly bool
    Indicates that the policy is a default one.
    Resources []string
    Set of resources affected by the policy.
    UpdatedAt string
    Date of the last update of this group.
    Allows []string
    Set of actions allowed by the policy.
    Denies []string
    Set of actions that will be denied no matter what policy exists.
    Description string
    Group description.
    Excepts []string
    Set of actions that will be subtracted from the allow list.
    PermissionsGroups []string
    Set of permissions groups that apply to the policy.
    conditions List<GetPolicyCondition>
    Conditions restricting the policy.
    createdAt String
    Creation date of this group.
    expiredAt String
    Expiration date of the policy.
    id String
    identities List<String>
    Set of identities affected by the policy.
    name String
    Name of the policy.
    owner String
    Owner of the policy.
    readOnly Boolean
    Indicates that the policy is a default one.
    resources List<String>
    Set of resources affected by the policy.
    updatedAt String
    Date of the last update of this group.
    allows List<String>
    Set of actions allowed by the policy.
    denies List<String>
    Set of actions that will be denied no matter what policy exists.
    description String
    Group description.
    excepts List<String>
    Set of actions that will be subtracted from the allow list.
    permissionsGroups List<String>
    Set of permissions groups that apply to the policy.
    conditions GetPolicyCondition[]
    Conditions restricting the policy.
    createdAt string
    Creation date of this group.
    expiredAt string
    Expiration date of the policy.
    id string
    identities string[]
    Set of identities affected by the policy.
    name string
    Name of the policy.
    owner string
    Owner of the policy.
    readOnly boolean
    Indicates that the policy is a default one.
    resources string[]
    Set of resources affected by the policy.
    updatedAt string
    Date of the last update of this group.
    allows string[]
    Set of actions allowed by the policy.
    denies string[]
    Set of actions that will be denied no matter what policy exists.
    description string
    Group description.
    excepts string[]
    Set of actions that will be subtracted from the allow list.
    permissionsGroups string[]
    Set of permissions groups that apply to the policy.
    conditions Sequence[GetPolicyCondition]
    Conditions restricting the policy.
    created_at str
    Creation date of this group.
    expired_at str
    Expiration date of the policy.
    id str
    identities Sequence[str]
    Set of identities affected by the policy.
    name str
    Name of the policy.
    owner str
    Owner of the policy.
    read_only bool
    Indicates that the policy is a default one.
    resources Sequence[str]
    Set of resources affected by the policy.
    updated_at str
    Date of the last update of this group.
    allows Sequence[str]
    Set of actions allowed by the policy.
    denies Sequence[str]
    Set of actions that will be denied no matter what policy exists.
    description str
    Group description.
    excepts Sequence[str]
    Set of actions that will be subtracted from the allow list.
    permissions_groups Sequence[str]
    Set of permissions groups that apply to the policy.
    conditions List<Property Map>
    Conditions restricting the policy.
    createdAt String
    Creation date of this group.
    expiredAt String
    Expiration date of the policy.
    id String
    identities List<String>
    Set of identities affected by the policy.
    name String
    Name of the policy.
    owner String
    Owner of the policy.
    readOnly Boolean
    Indicates that the policy is a default one.
    resources List<String>
    Set of resources affected by the policy.
    updatedAt String
    Date of the last update of this group.
    allows List<String>
    Set of actions allowed by the policy.
    denies List<String>
    Set of actions that will be denied no matter what policy exists.
    description String
    Group description.
    excepts List<String>
    Set of actions that will be subtracted from the allow list.
    permissionsGroups List<String>
    Set of permissions groups that apply to the policy.

    Supporting Types

    GetPolicyCondition

    Conditions List<GetPolicyConditionCondition>
    List of condition blocks. Each condition supports:
    Operator string
    Operator for this condition.
    Values Dictionary<string, string>
    Map of key-value pairs to match.
    Conditions []GetPolicyConditionCondition
    List of condition blocks. Each condition supports:
    Operator string
    Operator for this condition.
    Values map[string]string
    Map of key-value pairs to match.
    conditions List<GetPolicyConditionCondition>
    List of condition blocks. Each condition supports:
    operator String
    Operator for this condition.
    values Map<String,String>
    Map of key-value pairs to match.
    conditions GetPolicyConditionCondition[]
    List of condition blocks. Each condition supports:
    operator string
    Operator for this condition.
    values {[key: string]: string}
    Map of key-value pairs to match.
    conditions Sequence[GetPolicyConditionCondition]
    List of condition blocks. Each condition supports:
    operator str
    Operator for this condition.
    values Mapping[str, str]
    Map of key-value pairs to match.
    conditions List<Property Map>
    List of condition blocks. Each condition supports:
    operator String
    Operator for this condition.
    values Map<String>
    Map of key-value pairs to match.

    GetPolicyConditionCondition

    Conditions List<GetPolicyConditionConditionCondition>
    List of condition blocks. Each condition supports:
    Operator string
    Operator for this condition.
    Values Dictionary<string, string>
    Map of key-value pairs to match.
    Conditions []GetPolicyConditionConditionCondition
    List of condition blocks. Each condition supports:
    Operator string
    Operator for this condition.
    Values map[string]string
    Map of key-value pairs to match.
    conditions List<GetPolicyConditionConditionCondition>
    List of condition blocks. Each condition supports:
    operator String
    Operator for this condition.
    values Map<String,String>
    Map of key-value pairs to match.
    conditions GetPolicyConditionConditionCondition[]
    List of condition blocks. Each condition supports:
    operator string
    Operator for this condition.
    values {[key: string]: string}
    Map of key-value pairs to match.
    conditions Sequence[GetPolicyConditionConditionCondition]
    List of condition blocks. Each condition supports:
    operator str
    Operator for this condition.
    values Mapping[str, str]
    Map of key-value pairs to match.
    conditions List<Property Map>
    List of condition blocks. Each condition supports:
    operator String
    Operator for this condition.
    values Map<String>
    Map of key-value pairs to match.

    GetPolicyConditionConditionCondition

    Operator string
    Operator for this condition.
    Values Dictionary<string, string>
    Map of key-value pairs to match.
    Operator string
    Operator for this condition.
    Values map[string]string
    Map of key-value pairs to match.
    operator String
    Operator for this condition.
    values Map<String,String>
    Map of key-value pairs to match.
    operator string
    Operator for this condition.
    values {[key: string]: string}
    Map of key-value pairs to match.
    operator str
    Operator for this condition.
    values Mapping[str, str]
    Map of key-value pairs to match.
    operator String
    Operator for this condition.
    values Map<String>
    Map of key-value pairs to match.

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v2.11.0 published on Monday, Feb 9, 2026 by OVHcloud
      Meet Neo: Your AI Platform Teammate