1. Packages
  2. OVH
  3. API Docs
  4. Iam
  5. Policy
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

    Creates an IAM policy.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    
    const account = ovh.Me.getMe({});
    const myGroup = new ovh.me.IdentityGroup("my_group", {
        name: "my_group",
        description: "my_group created in Terraform",
    });
    const manager = new ovh.iam.Policy("manager", {
        name: "allow_ovh_manager",
        description: "Users are allowed to use the OVH manager",
        identities: [myGroup.GroupURN],
        resources: [account.then(account => account.AccountURN)],
        allows: [
            "account:apiovh:me/get",
            "account:apiovh:me/supportLevel/get",
            "account:apiovh:me/certificates/get",
            "account:apiovh:me/tag/get",
            "account:apiovh:services/get",
            "account:apiovh:*",
        ],
    });
    const ipRestrictedProdAccess = new ovh.iam.Policy("ip_restricted_prod_access", {
        name: "ip_restricted_prod_access",
        description: "Allow access only from a specific IP to resources tagged prod",
        identities: [myGroup.GroupURN],
        resources: ["urn:v1:eu:resource:vps:*"],
        allows: ["vps:apiovh:*"],
        conditions: {
            operator: "MATCH",
            values: {
                "resource.Tag(environment)": "prod",
                "request.IP": "192.72.0.1",
            },
        },
    });
    const workdaysAndIpRestrictedAndExpiring = new ovh.iam.Policy("workdays_and_ip_restricted_and_expiring", {
        name: "workdays_and_ip_restricted_and_expiring",
        description: "Allow access only on workdays, expires end of 2026",
        identities: [myGroup.GroupURN],
        resources: ["urn:v1:eu:resource:vps:*"],
        allows: ["vps:apiovh:*"],
        conditions: {
            operator: "AND",
            conditions: [
                {
                    operator: "MATCH",
                    values: {
                        "date(Europe/Paris).WeekDay.In": "monday,tuesday,wednesday,thursday,friday",
                    },
                },
                {
                    operator: "MATCH",
                    values: {
                        "request.IP": "192.72.0.1",
                    },
                },
            ],
        },
        expiredAt: "2026-12-31T23:59:59Z",
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    account = ovh.Me.get_me()
    my_group = ovh.me.IdentityGroup("my_group",
        name="my_group",
        description="my_group created in Terraform")
    manager = ovh.iam.Policy("manager",
        name="allow_ovh_manager",
        description="Users are allowed to use the OVH manager",
        identities=[my_group.group_urn],
        resources=[account.account_urn],
        allows=[
            "account:apiovh:me/get",
            "account:apiovh:me/supportLevel/get",
            "account:apiovh:me/certificates/get",
            "account:apiovh:me/tag/get",
            "account:apiovh:services/get",
            "account:apiovh:*",
        ])
    ip_restricted_prod_access = ovh.iam.Policy("ip_restricted_prod_access",
        name="ip_restricted_prod_access",
        description="Allow access only from a specific IP to resources tagged prod",
        identities=[my_group.group_urn],
        resources=["urn:v1:eu:resource:vps:*"],
        allows=["vps:apiovh:*"],
        conditions={
            "operator": "MATCH",
            "values": {
                "resource.Tag(environment)": "prod",
                "request.IP": "192.72.0.1",
            },
        })
    workdays_and_ip_restricted_and_expiring = ovh.iam.Policy("workdays_and_ip_restricted_and_expiring",
        name="workdays_and_ip_restricted_and_expiring",
        description="Allow access only on workdays, expires end of 2026",
        identities=[my_group.group_urn],
        resources=["urn:v1:eu:resource:vps:*"],
        allows=["vps:apiovh:*"],
        conditions={
            "operator": "AND",
            "conditions": [
                {
                    "operator": "MATCH",
                    "values": {
                        "date(Europe/Paris).WeekDay.In": "monday,tuesday,wednesday,thursday,friday",
                    },
                },
                {
                    "operator": "MATCH",
                    "values": {
                        "request.IP": "192.72.0.1",
                    },
                },
            ],
        },
        expired_at="2026-12-31T23:59:59Z")
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh/iam"
    	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh/me"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		account, err := me.GetMe(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		myGroup, err := me.NewIdentityGroup(ctx, "my_group", &me.IdentityGroupArgs{
    			Name:        pulumi.String("my_group"),
    			Description: pulumi.String("my_group created in Terraform"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewPolicy(ctx, "manager", &iam.PolicyArgs{
    			Name:        pulumi.String("allow_ovh_manager"),
    			Description: pulumi.String("Users are allowed to use the OVH manager"),
    			Identities: pulumi.StringArray{
    				myGroup.GroupURN,
    			},
    			Resources: pulumi.StringArray{
    				pulumi.String(account.AccountURN),
    			},
    			Allows: pulumi.StringArray{
    				pulumi.String("account:apiovh:me/get"),
    				pulumi.String("account:apiovh:me/supportLevel/get"),
    				pulumi.String("account:apiovh:me/certificates/get"),
    				pulumi.String("account:apiovh:me/tag/get"),
    				pulumi.String("account:apiovh:services/get"),
    				pulumi.String("account:apiovh:*"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewPolicy(ctx, "ip_restricted_prod_access", &iam.PolicyArgs{
    			Name:        pulumi.String("ip_restricted_prod_access"),
    			Description: pulumi.String("Allow access only from a specific IP to resources tagged prod"),
    			Identities: pulumi.StringArray{
    				myGroup.GroupURN,
    			},
    			Resources: pulumi.StringArray{
    				pulumi.String("urn:v1:eu:resource:vps:*"),
    			},
    			Allows: pulumi.StringArray{
    				pulumi.String("vps:apiovh:*"),
    			},
    			Conditions: &iam.PolicyConditionsArgs{
    				Operator: pulumi.String("MATCH"),
    				Values: pulumi.StringMap{
    					"resource.Tag(environment)": pulumi.String("prod"),
    					"request.IP":                pulumi.String("192.72.0.1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = iam.NewPolicy(ctx, "workdays_and_ip_restricted_and_expiring", &iam.PolicyArgs{
    			Name:        pulumi.String("workdays_and_ip_restricted_and_expiring"),
    			Description: pulumi.String("Allow access only on workdays, expires end of 2026"),
    			Identities: pulumi.StringArray{
    				myGroup.GroupURN,
    			},
    			Resources: pulumi.StringArray{
    				pulumi.String("urn:v1:eu:resource:vps:*"),
    			},
    			Allows: pulumi.StringArray{
    				pulumi.String("vps:apiovh:*"),
    			},
    			Conditions: &iam.PolicyConditionsArgs{
    				Operator: pulumi.String("AND"),
    				Conditions: iam.PolicyConditionsConditionArray{
    					&iam.PolicyConditionsConditionArgs{
    						Operator: pulumi.String("MATCH"),
    						Values: pulumi.StringMap{
    							"date(Europe/Paris).WeekDay.In": pulumi.String("monday,tuesday,wednesday,thursday,friday"),
    						},
    					},
    					&iam.PolicyConditionsConditionArgs{
    						Operator: pulumi.String("MATCH"),
    						Values: pulumi.StringMap{
    							"request.IP": pulumi.String("192.72.0.1"),
    						},
    					},
    				},
    			},
    			ExpiredAt: pulumi.String("2026-12-31T23:59:59Z"),
    		})
    		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 account = Ovh.Me.GetMe.Invoke();
    
        var myGroup = new Ovh.Me.IdentityGroup("my_group", new()
        {
            Name = "my_group",
            Description = "my_group created in Terraform",
        });
    
        var manager = new Ovh.Iam.Policy("manager", new()
        {
            Name = "allow_ovh_manager",
            Description = "Users are allowed to use the OVH manager",
            Identities = new[]
            {
                myGroup.GroupURN,
            },
            Resources = new[]
            {
                account.Apply(getMeResult => getMeResult.AccountURN),
            },
            Allows = new[]
            {
                "account:apiovh:me/get",
                "account:apiovh:me/supportLevel/get",
                "account:apiovh:me/certificates/get",
                "account:apiovh:me/tag/get",
                "account:apiovh:services/get",
                "account:apiovh:*",
            },
        });
    
        var ipRestrictedProdAccess = new Ovh.Iam.Policy("ip_restricted_prod_access", new()
        {
            Name = "ip_restricted_prod_access",
            Description = "Allow access only from a specific IP to resources tagged prod",
            Identities = new[]
            {
                myGroup.GroupURN,
            },
            Resources = new[]
            {
                "urn:v1:eu:resource:vps:*",
            },
            Allows = new[]
            {
                "vps:apiovh:*",
            },
            Conditions = new Ovh.Iam.Inputs.PolicyConditionsArgs
            {
                Operator = "MATCH",
                Values = 
                {
                    { "resource.Tag(environment)", "prod" },
                    { "request.IP", "192.72.0.1" },
                },
            },
        });
    
        var workdaysAndIpRestrictedAndExpiring = new Ovh.Iam.Policy("workdays_and_ip_restricted_and_expiring", new()
        {
            Name = "workdays_and_ip_restricted_and_expiring",
            Description = "Allow access only on workdays, expires end of 2026",
            Identities = new[]
            {
                myGroup.GroupURN,
            },
            Resources = new[]
            {
                "urn:v1:eu:resource:vps:*",
            },
            Allows = new[]
            {
                "vps:apiovh:*",
            },
            Conditions = new Ovh.Iam.Inputs.PolicyConditionsArgs
            {
                Operator = "AND",
                Conditions = new[]
                {
                    new Ovh.Iam.Inputs.PolicyConditionsConditionArgs
                    {
                        Operator = "MATCH",
                        Values = 
                        {
                            { "date(Europe/Paris).WeekDay.In", "monday,tuesday,wednesday,thursday,friday" },
                        },
                    },
                    new Ovh.Iam.Inputs.PolicyConditionsConditionArgs
                    {
                        Operator = "MATCH",
                        Values = 
                        {
                            { "request.IP", "192.72.0.1" },
                        },
                    },
                },
            },
            ExpiredAt = "2026-12-31T23:59:59Z",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.Me.MeFunctions;
    import com.ovhcloud.pulumi.ovh.Me.IdentityGroup;
    import com.ovhcloud.pulumi.ovh.Me.IdentityGroupArgs;
    import com.ovhcloud.pulumi.ovh.Iam.Policy;
    import com.ovhcloud.pulumi.ovh.Iam.PolicyArgs;
    import com.pulumi.ovh.Iam.inputs.PolicyConditionsArgs;
    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 account = MeFunctions.getMe(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            var myGroup = new IdentityGroup("myGroup", IdentityGroupArgs.builder()
                .name("my_group")
                .description("my_group created in Terraform")
                .build());
    
            var manager = new Policy("manager", PolicyArgs.builder()
                .name("allow_ovh_manager")
                .description("Users are allowed to use the OVH manager")
                .identities(myGroup.GroupURN())
                .resources(account.AccountURN())
                .allows(            
                    "account:apiovh:me/get",
                    "account:apiovh:me/supportLevel/get",
                    "account:apiovh:me/certificates/get",
                    "account:apiovh:me/tag/get",
                    "account:apiovh:services/get",
                    "account:apiovh:*")
                .build());
    
            var ipRestrictedProdAccess = new Policy("ipRestrictedProdAccess", PolicyArgs.builder()
                .name("ip_restricted_prod_access")
                .description("Allow access only from a specific IP to resources tagged prod")
                .identities(myGroup.GroupURN())
                .resources("urn:v1:eu:resource:vps:*")
                .allows("vps:apiovh:*")
                .conditions(PolicyConditionsArgs.builder()
                    .operator("MATCH")
                    .values(Map.ofEntries(
                        Map.entry("resource.Tag(environment)", "prod"),
                        Map.entry("request.IP", "192.72.0.1")
                    ))
                    .build())
                .build());
    
            var workdaysAndIpRestrictedAndExpiring = new Policy("workdaysAndIpRestrictedAndExpiring", PolicyArgs.builder()
                .name("workdays_and_ip_restricted_and_expiring")
                .description("Allow access only on workdays, expires end of 2026")
                .identities(myGroup.GroupURN())
                .resources("urn:v1:eu:resource:vps:*")
                .allows("vps:apiovh:*")
                .conditions(PolicyConditionsArgs.builder()
                    .operator("AND")
                    .conditions(                
                        PolicyConditionsConditionArgs.builder()
                            .operator("MATCH")
                            .values(Map.of("date(Europe/Paris).WeekDay.In", "monday,tuesday,wednesday,thursday,friday"))
                            .build(),
                        PolicyConditionsConditionArgs.builder()
                            .operator("MATCH")
                            .values(Map.of("request.IP", "192.72.0.1"))
                            .build())
                    .build())
                .expiredAt("2026-12-31T23:59:59Z")
                .build());
    
        }
    }
    
    resources:
      myGroup:
        type: ovh:Me:IdentityGroup
        name: my_group
        properties:
          name: my_group
          description: my_group created in Terraform
      manager:
        type: ovh:Iam:Policy
        properties:
          name: allow_ovh_manager
          description: Users are allowed to use the OVH manager
          identities:
            - ${myGroup.GroupURN}
          resources:
            - ${account.AccountURN}
          allows:
            - account:apiovh:me/get
            - account:apiovh:me/supportLevel/get
            - account:apiovh:me/certificates/get
            - account:apiovh:me/tag/get
            - account:apiovh:services/get
            - account:apiovh:*
      ipRestrictedProdAccess:
        type: ovh:Iam:Policy
        name: ip_restricted_prod_access
        properties:
          name: ip_restricted_prod_access
          description: Allow access only from a specific IP to resources tagged prod
          identities:
            - ${myGroup.GroupURN}
          resources:
            - urn:v1:eu:resource:vps:*
          allows:
            - vps:apiovh:*
          conditions:
            operator: MATCH
            values:
              resource.Tag(environment): prod
              request.IP: 192.72.0.1
      workdaysAndIpRestrictedAndExpiring:
        type: ovh:Iam:Policy
        name: workdays_and_ip_restricted_and_expiring
        properties:
          name: workdays_and_ip_restricted_and_expiring
          description: Allow access only on workdays, expires end of 2026
          identities:
            - ${myGroup.GroupURN}
          resources:
            - urn:v1:eu:resource:vps:*
          allows:
            - vps:apiovh:*
          conditions:
            operator: AND
            conditions:
              - operator: MATCH
                values:
                  date(Europe/Paris).WeekDay.In: monday,tuesday,wednesday,thursday,friday
              - operator: MATCH
                values:
                  request.IP: 192.72.0.1
          expiredAt: 2026-12-31T23:59:59Z
    variables:
      account:
        fn::invoke:
          function: ovh:Me:getMe
          arguments: {}
    

    Create Policy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               args: PolicyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               identities: Optional[Sequence[str]] = None,
               resources: Optional[Sequence[str]] = None,
               allows: Optional[Sequence[str]] = None,
               conditions: Optional[PolicyConditionsArgs] = None,
               denies: Optional[Sequence[str]] = None,
               description: Optional[str] = None,
               excepts: Optional[Sequence[str]] = None,
               expired_at: Optional[str] = None,
               name: Optional[str] = None,
               permissions_groups: Optional[Sequence[str]] = None)
    func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: ovh:Iam:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var policyResource = new Ovh.Iam.Policy("policyResource", new()
    {
        Identities = new[]
        {
            "string",
        },
        Resources = new[]
        {
            "string",
        },
        Allows = new[]
        {
            "string",
        },
        Conditions = new Ovh.Iam.Inputs.PolicyConditionsArgs
        {
            Operator = "string",
            Conditions = new[]
            {
                new Ovh.Iam.Inputs.PolicyConditionsConditionArgs
                {
                    Operator = "string",
                    Conditions = new[]
                    {
                        new Ovh.Iam.Inputs.PolicyConditionsConditionConditionArgs
                        {
                            Operator = "string",
                            Values = 
                            {
                                { "string", "string" },
                            },
                        },
                    },
                    Values = 
                    {
                        { "string", "string" },
                    },
                },
            },
            Values = 
            {
                { "string", "string" },
            },
        },
        Denies = new[]
        {
            "string",
        },
        Description = "string",
        Excepts = new[]
        {
            "string",
        },
        ExpiredAt = "string",
        Name = "string",
        PermissionsGroups = new[]
        {
            "string",
        },
    });
    
    example, err := iam.NewPolicy(ctx, "policyResource", &iam.PolicyArgs{
    	Identities: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Resources: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Allows: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Conditions: &iam.PolicyConditionsArgs{
    		Operator: pulumi.String("string"),
    		Conditions: iam.PolicyConditionsConditionArray{
    			&iam.PolicyConditionsConditionArgs{
    				Operator: pulumi.String("string"),
    				Conditions: iam.PolicyConditionsConditionConditionArray{
    					&iam.PolicyConditionsConditionConditionArgs{
    						Operator: pulumi.String("string"),
    						Values: pulumi.StringMap{
    							"string": pulumi.String("string"),
    						},
    					},
    				},
    				Values: pulumi.StringMap{
    					"string": pulumi.String("string"),
    				},
    			},
    		},
    		Values: pulumi.StringMap{
    			"string": pulumi.String("string"),
    		},
    	},
    	Denies: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description: pulumi.String("string"),
    	Excepts: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	ExpiredAt: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	PermissionsGroups: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var policyResource = new Policy("policyResource", PolicyArgs.builder()
        .identities("string")
        .resources("string")
        .allows("string")
        .conditions(PolicyConditionsArgs.builder()
            .operator("string")
            .conditions(PolicyConditionsConditionArgs.builder()
                .operator("string")
                .conditions(PolicyConditionsConditionConditionArgs.builder()
                    .operator("string")
                    .values(Map.of("string", "string"))
                    .build())
                .values(Map.of("string", "string"))
                .build())
            .values(Map.of("string", "string"))
            .build())
        .denies("string")
        .description("string")
        .excepts("string")
        .expiredAt("string")
        .name("string")
        .permissionsGroups("string")
        .build());
    
    policy_resource = ovh.iam.Policy("policyResource",
        identities=["string"],
        resources=["string"],
        allows=["string"],
        conditions={
            "operator": "string",
            "conditions": [{
                "operator": "string",
                "conditions": [{
                    "operator": "string",
                    "values": {
                        "string": "string",
                    },
                }],
                "values": {
                    "string": "string",
                },
            }],
            "values": {
                "string": "string",
            },
        },
        denies=["string"],
        description="string",
        excepts=["string"],
        expired_at="string",
        name="string",
        permissions_groups=["string"])
    
    const policyResource = new ovh.iam.Policy("policyResource", {
        identities: ["string"],
        resources: ["string"],
        allows: ["string"],
        conditions: {
            operator: "string",
            conditions: [{
                operator: "string",
                conditions: [{
                    operator: "string",
                    values: {
                        string: "string",
                    },
                }],
                values: {
                    string: "string",
                },
            }],
            values: {
                string: "string",
            },
        },
        denies: ["string"],
        description: "string",
        excepts: ["string"],
        expiredAt: "string",
        name: "string",
        permissionsGroups: ["string"],
    });
    
    type: ovh:Iam:Policy
    properties:
        allows:
            - string
        conditions:
            conditions:
                - conditions:
                    - operator: string
                      values:
                        string: string
                  operator: string
                  values:
                    string: string
            operator: string
            values:
                string: string
        denies:
            - string
        description: string
        excepts:
            - string
        expiredAt: string
        identities:
            - string
        name: string
        permissionsGroups:
            - string
        resources:
            - string
    

    Policy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Policy resource accepts the following input properties:

    Identities List<string>
    List of identities affected by the policy
    Resources List<string>
    List of resources affected by the policy
    Allows List<string>
    List of actions allowed on resources by identities
    Conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    Denies List<string>
    List of actions that will always be denied even if also allowed by this policy or another one.
    Description string
    Description of the policy
    Excepts List<string>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    ExpiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    Name string
    Name of the policy, must be unique
    PermissionsGroups List<string>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    Identities []string
    List of identities affected by the policy
    Resources []string
    List of resources affected by the policy
    Allows []string
    List of actions allowed on resources by identities
    Conditions PolicyConditionsArgs
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    Denies []string
    List of actions that will always be denied even if also allowed by this policy or another one.
    Description string
    Description of the policy
    Excepts []string
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    ExpiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    Name string
    Name of the policy, must be unique
    PermissionsGroups []string
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    identities List<String>
    List of identities affected by the policy
    resources List<String>
    List of resources affected by the policy
    allows List<String>
    List of actions allowed on resources by identities
    conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    denies List<String>
    List of actions that will always be denied even if also allowed by this policy or another one.
    description String
    Description of the policy
    excepts List<String>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt String
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    name String
    Name of the policy, must be unique
    permissionsGroups List<String>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    identities string[]
    List of identities affected by the policy
    resources string[]
    List of resources affected by the policy
    allows string[]
    List of actions allowed on resources by identities
    conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    denies string[]
    List of actions that will always be denied even if also allowed by this policy or another one.
    description string
    Description of the policy
    excepts string[]
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    name string
    Name of the policy, must be unique
    permissionsGroups string[]
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    identities Sequence[str]
    List of identities affected by the policy
    resources Sequence[str]
    List of resources affected by the policy
    allows Sequence[str]
    List of actions allowed on resources by identities
    conditions PolicyConditionsArgs
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    denies Sequence[str]
    List of actions that will always be denied even if also allowed by this policy or another one.
    description str
    Description of the policy
    excepts Sequence[str]
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expired_at str
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    name str
    Name of the policy, must be unique
    permissions_groups Sequence[str]
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    identities List<String>
    List of identities affected by the policy
    resources List<String>
    List of resources affected by the policy
    allows List<String>
    List of actions allowed on resources by identities
    conditions Property Map
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    denies List<String>
    List of actions that will always be denied even if also allowed by this policy or another one.
    description String
    Description of the policy
    excepts List<String>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt String
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    name String
    Name of the policy, must be unique
    permissionsGroups List<String>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:

    CreatedAt string
    Creation date of this group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Owner string
    Owner of the policy.
    ReadOnly bool
    Indicates that the policy is a default one.
    UpdatedAt string
    Date of the last update of this group.
    CreatedAt string
    Creation date of this group.
    Id string
    The provider-assigned unique ID for this managed resource.
    Owner string
    Owner of the policy.
    ReadOnly bool
    Indicates that the policy is a default one.
    UpdatedAt string
    Date of the last update of this group.
    createdAt String
    Creation date of this group.
    id String
    The provider-assigned unique ID for this managed resource.
    owner String
    Owner of the policy.
    readOnly Boolean
    Indicates that the policy is a default one.
    updatedAt String
    Date of the last update of this group.
    createdAt string
    Creation date of this group.
    id string
    The provider-assigned unique ID for this managed resource.
    owner string
    Owner of the policy.
    readOnly boolean
    Indicates that the policy is a default one.
    updatedAt string
    Date of the last update of this group.
    created_at str
    Creation date of this group.
    id str
    The provider-assigned unique ID for this managed resource.
    owner str
    Owner of the policy.
    read_only bool
    Indicates that the policy is a default one.
    updated_at str
    Date of the last update of this group.
    createdAt String
    Creation date of this group.
    id String
    The provider-assigned unique ID for this managed resource.
    owner String
    Owner of the policy.
    readOnly Boolean
    Indicates that the policy is a default one.
    updatedAt String
    Date of the last update of this group.

    Look up Existing Policy Resource

    Get an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allows: Optional[Sequence[str]] = None,
            conditions: Optional[PolicyConditionsArgs] = None,
            created_at: Optional[str] = None,
            denies: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            excepts: Optional[Sequence[str]] = None,
            expired_at: Optional[str] = None,
            identities: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            owner: Optional[str] = None,
            permissions_groups: Optional[Sequence[str]] = None,
            read_only: Optional[bool] = None,
            resources: Optional[Sequence[str]] = None,
            updated_at: Optional[str] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)
    resources:  _:    type: ovh:Iam:Policy    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Allows List<string>
    List of actions allowed on resources by identities
    Conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    CreatedAt string
    Creation date of this group.
    Denies List<string>
    List of actions that will always be denied even if also allowed by this policy or another one.
    Description string
    Description of the policy
    Excepts List<string>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    ExpiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    Identities List<string>
    List of identities affected by the policy
    Name string
    Name of the policy, must be unique
    Owner string
    Owner of the policy.
    PermissionsGroups List<string>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    ReadOnly bool
    Indicates that the policy is a default one.
    Resources List<string>
    List of resources affected by the policy
    UpdatedAt string
    Date of the last update of this group.
    Allows []string
    List of actions allowed on resources by identities
    Conditions PolicyConditionsArgs
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    CreatedAt string
    Creation date of this group.
    Denies []string
    List of actions that will always be denied even if also allowed by this policy or another one.
    Description string
    Description of the policy
    Excepts []string
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    ExpiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    Identities []string
    List of identities affected by the policy
    Name string
    Name of the policy, must be unique
    Owner string
    Owner of the policy.
    PermissionsGroups []string
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    ReadOnly bool
    Indicates that the policy is a default one.
    Resources []string
    List of resources affected by the policy
    UpdatedAt string
    Date of the last update of this group.
    allows List<String>
    List of actions allowed on resources by identities
    conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    createdAt String
    Creation date of this group.
    denies List<String>
    List of actions that will always be denied even if also allowed by this policy or another one.
    description String
    Description of the policy
    excepts List<String>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt String
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    identities List<String>
    List of identities affected by the policy
    name String
    Name of the policy, must be unique
    owner String
    Owner of the policy.
    permissionsGroups List<String>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    readOnly Boolean
    Indicates that the policy is a default one.
    resources List<String>
    List of resources affected by the policy
    updatedAt String
    Date of the last update of this group.
    allows string[]
    List of actions allowed on resources by identities
    conditions PolicyConditions
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    createdAt string
    Creation date of this group.
    denies string[]
    List of actions that will always be denied even if also allowed by this policy or another one.
    description string
    Description of the policy
    excepts string[]
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt string
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    identities string[]
    List of identities affected by the policy
    name string
    Name of the policy, must be unique
    owner string
    Owner of the policy.
    permissionsGroups string[]
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    readOnly boolean
    Indicates that the policy is a default one.
    resources string[]
    List of resources affected by the policy
    updatedAt string
    Date of the last update of this group.
    allows Sequence[str]
    List of actions allowed on resources by identities
    conditions PolicyConditionsArgs
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    created_at str
    Creation date of this group.
    denies Sequence[str]
    List of actions that will always be denied even if also allowed by this policy or another one.
    description str
    Description of the policy
    excepts Sequence[str]
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expired_at str
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    identities Sequence[str]
    List of identities affected by the policy
    name str
    Name of the policy, must be unique
    owner str
    Owner of the policy.
    permissions_groups Sequence[str]
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    read_only bool
    Indicates that the policy is a default one.
    resources Sequence[str]
    List of resources affected by the policy
    updated_at str
    Date of the last update of this group.
    allows List<String>
    List of actions allowed on resources by identities
    conditions Property Map
    Conditions restrict permissions based on resource tags, date/time, or request attributes. See Conditions below.
    createdAt String
    Creation date of this group.
    denies List<String>
    List of actions that will always be denied even if also allowed by this policy or another one.
    description String
    Description of the policy
    excepts List<String>
    List of overrides of action that must not be allowed even if they are caught by allow. Only makes sens if allow contains wildcards.
    expiredAt String
    Expiration date of the policy in RFC3339 format (e.g., 2025-12-31T23:59:59Z). After this date, the policy will no longer be applied.
    identities List<String>
    List of identities affected by the policy
    name String
    Name of the policy, must be unique
    owner String
    Owner of the policy.
    permissionsGroups List<String>
    Set of permissions groups included in the policy. At evaluation, these permissions groups are each evaluated independently (notably, excepts actions only affect actions in the same permission group).
    readOnly Boolean
    Indicates that the policy is a default one.
    resources List<String>
    List of resources affected by the policy
    updatedAt String
    Date of the last update of this group.

    Supporting Types

    PolicyConditions, PolicyConditionsArgs

    Operator string
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    Conditions List<PolicyConditionsCondition>
    List of condition blocks. Each condition supports:
    Values Dictionary<string, string>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    Operator string
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    Conditions []PolicyConditionsCondition
    List of condition blocks. Each condition supports:
    Values map[string]string
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator String
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    conditions List<PolicyConditionsCondition>
    List of condition blocks. Each condition supports:
    values Map<String,String>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator string
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    conditions PolicyConditionsCondition[]
    List of condition blocks. Each condition supports:
    values {[key: string]: string}
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator str
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    conditions Sequence[PolicyConditionsCondition]
    List of condition blocks. Each condition supports:
    values Mapping[str, str]
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator String
    Operator to combine conditions. Valid values are AND, OR, NOT, or MATCH.
    conditions List<Property Map>
    List of condition blocks. Each condition supports:
    values Map<String>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)

    PolicyConditionsCondition, PolicyConditionsConditionArgs

    Operator string
    Operator for this condition (typically MATCH).
    Conditions List<PolicyConditionsConditionCondition>
    A list of nested conditions. This is the recursive part.
    Values Dictionary<string, string>

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    Operator string
    Operator for this condition (typically MATCH).
    Conditions []PolicyConditionsConditionCondition
    A list of nested conditions. This is the recursive part.
    Values map[string]string

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    operator String
    Operator for this condition (typically MATCH).
    conditions List<PolicyConditionsConditionCondition>
    A list of nested conditions. This is the recursive part.
    values Map<String,String>

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    operator string
    Operator for this condition (typically MATCH).
    conditions PolicyConditionsConditionCondition[]
    A list of nested conditions. This is the recursive part.
    values {[key: string]: string}

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    operator str
    Operator for this condition (typically MATCH).
    conditions Sequence[PolicyConditionsConditionCondition]
    A list of nested conditions. This is the recursive part.
    values Mapping[str, str]

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    operator String
    Operator for this condition (typically MATCH).
    conditions List<Property Map>
    A list of nested conditions. This is the recursive part.
    values Map<String>

    Map of key-value pairs to match. Keys can reference:

    • Resource tags: resource.Tag(tag_name) (e.g., resource.Tag(environment))
    • Date/time: date(timezone).WeekDay, date(timezone).WeekDay.In (e.g., date(Europe/Paris).WeekDay)
    • Request attributes: request.IP

    Note: Conditions can be nested up to 3 levels deep. The MATCH operator is terminal and cannot have sub-conditions.

    PolicyConditionsConditionCondition, PolicyConditionsConditionConditionArgs

    Operator string
    Operator for this condition (MATCH, AND, OR, NOT)
    Values Dictionary<string, string>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    Operator string
    Operator for this condition (MATCH, AND, OR, NOT)
    Values map[string]string
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator String
    Operator for this condition (MATCH, AND, OR, NOT)
    values Map<String,String>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator string
    Operator for this condition (MATCH, AND, OR, NOT)
    values {[key: string]: string}
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator str
    Operator for this condition (MATCH, AND, OR, NOT)
    values Mapping[str, str]
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)
    operator String
    Operator for this condition (MATCH, AND, OR, NOT)
    values Map<String>
    Key-value pairs to match (e.g., resource.Tag(name), date(Europe/Paris).WeekDay, request.IP)

    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