1. Packages
  2. Scaleway
  3. API Docs
  4. iam
  5. getPolicy
Scaleway v1.36.0 published on Friday, Oct 31, 2025 by pulumiverse

scaleway.iam.getPolicy

Get Started
scaleway logo
Scaleway v1.36.0 published on Friday, Oct 31, 2025 by pulumiverse

    Use this data source to get information on an existing IAM policy based on its ID. For more information refer to the IAM API documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumiverse/scaleway";
    
    // Get policy by id
    const findById = scaleway.iam.getPolicy({
        policyId: "11111111-1111-1111-1111-111111111111",
    });
    // Get policy by name
    const findByName = scaleway.iam.getPolicy({
        name: "my_policy",
    });
    
    import pulumi
    import pulumi_scaleway as scaleway
    
    # Get policy by id
    find_by_id = scaleway.iam.get_policy(policy_id="11111111-1111-1111-1111-111111111111")
    # Get policy by name
    find_by_name = scaleway.iam.get_policy(name="my_policy")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/iam"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Get policy by id
    		_, err := iam.LookupPolicy(ctx, &iam.LookupPolicyArgs{
    			PolicyId: pulumi.StringRef("11111111-1111-1111-1111-111111111111"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		// Get policy by name
    		_, err = iam.LookupPolicy(ctx, &iam.LookupPolicyArgs{
    			Name: pulumi.StringRef("my_policy"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Scaleway = Pulumi.Scaleway;
    
    return await Deployment.RunAsync(() => 
    {
        // Get policy by id
        var findById = Scaleway.Iam.GetPolicy.Invoke(new()
        {
            PolicyId = "11111111-1111-1111-1111-111111111111",
        });
    
        // Get policy by name
        var findByName = Scaleway.Iam.GetPolicy.Invoke(new()
        {
            Name = "my_policy",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.scaleway.iam.IamFunctions;
    import com.pulumi.scaleway.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) {
            // Get policy by id
            final var findById = IamFunctions.getPolicy(GetPolicyArgs.builder()
                .policyId("11111111-1111-1111-1111-111111111111")
                .build());
    
            // Get policy by name
            final var findByName = IamFunctions.getPolicy(GetPolicyArgs.builder()
                .name("my_policy")
                .build());
    
        }
    }
    
    variables:
      # Get policy by id
      findById:
        fn::invoke:
          function: scaleway:iam:getPolicy
          arguments:
            policyId: 11111111-1111-1111-1111-111111111111
      # Get policy by name
      findByName:
        fn::invoke:
          function: scaleway:iam:getPolicy
          arguments:
            name: my_policy
    

    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(name: Optional[str] = None,
                   policy_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPolicyResult
    def get_policy_output(name: Optional[pulumi.Input[str]] = None,
                   policy_id: Optional[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: scaleway:iam/getPolicy:getPolicy
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the IAM policy.
    PolicyId string

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    Name string
    The name of the IAM policy.
    PolicyId string

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    name String
    The name of the IAM policy.
    policyId String

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    name string
    The name of the IAM policy.
    policyId string

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    name str
    The name of the IAM policy.
    policy_id str

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    name String
    The name of the IAM policy.
    policyId String

    The ID of the IAM policy.

    Note You must specify at least one: name and/or policy_id.

    getPolicy Result

    The following output properties are available:

    ApplicationId string
    ID of the application the policy is linked to
    CreatedAt string
    The date and time of the creation of the policy.
    Description string
    The description of the IAM policy.
    Editable bool
    Whether the policy is editable.
    GroupId string
    ID of the group the policy is linked to
    Id string
    The provider-assigned unique ID for this managed resource.
    NoPrincipal bool
    If the policy doesn't apply to a principal.
    OrganizationId string
    ID of organization scoped to the rule.
    Rules List<Pulumiverse.Scaleway.Iam.Outputs.GetPolicyRule>
    List of rules in the policy.
    Tags List<string>
    The tags associated with the IAM policy.
    UpdatedAt string
    The date and time of the last update of the policy.
    UserId string
    ID of the user the policy is linked to
    Name string
    PolicyId string
    ApplicationId string
    ID of the application the policy is linked to
    CreatedAt string
    The date and time of the creation of the policy.
    Description string
    The description of the IAM policy.
    Editable bool
    Whether the policy is editable.
    GroupId string
    ID of the group the policy is linked to
    Id string
    The provider-assigned unique ID for this managed resource.
    NoPrincipal bool
    If the policy doesn't apply to a principal.
    OrganizationId string
    ID of organization scoped to the rule.
    Rules []GetPolicyRule
    List of rules in the policy.
    Tags []string
    The tags associated with the IAM policy.
    UpdatedAt string
    The date and time of the last update of the policy.
    UserId string
    ID of the user the policy is linked to
    Name string
    PolicyId string
    applicationId String
    ID of the application the policy is linked to
    createdAt String
    The date and time of the creation of the policy.
    description String
    The description of the IAM policy.
    editable Boolean
    Whether the policy is editable.
    groupId String
    ID of the group the policy is linked to
    id String
    The provider-assigned unique ID for this managed resource.
    noPrincipal Boolean
    If the policy doesn't apply to a principal.
    organizationId String
    ID of organization scoped to the rule.
    rules List<GetPolicyRule>
    List of rules in the policy.
    tags List<String>
    The tags associated with the IAM policy.
    updatedAt String
    The date and time of the last update of the policy.
    userId String
    ID of the user the policy is linked to
    name String
    policyId String
    applicationId string
    ID of the application the policy is linked to
    createdAt string
    The date and time of the creation of the policy.
    description string
    The description of the IAM policy.
    editable boolean
    Whether the policy is editable.
    groupId string
    ID of the group the policy is linked to
    id string
    The provider-assigned unique ID for this managed resource.
    noPrincipal boolean
    If the policy doesn't apply to a principal.
    organizationId string
    ID of organization scoped to the rule.
    rules GetPolicyRule[]
    List of rules in the policy.
    tags string[]
    The tags associated with the IAM policy.
    updatedAt string
    The date and time of the last update of the policy.
    userId string
    ID of the user the policy is linked to
    name string
    policyId string
    application_id str
    ID of the application the policy is linked to
    created_at str
    The date and time of the creation of the policy.
    description str
    The description of the IAM policy.
    editable bool
    Whether the policy is editable.
    group_id str
    ID of the group the policy is linked to
    id str
    The provider-assigned unique ID for this managed resource.
    no_principal bool
    If the policy doesn't apply to a principal.
    organization_id str
    ID of organization scoped to the rule.
    rules Sequence[GetPolicyRule]
    List of rules in the policy.
    tags Sequence[str]
    The tags associated with the IAM policy.
    updated_at str
    The date and time of the last update of the policy.
    user_id str
    ID of the user the policy is linked to
    name str
    policy_id str
    applicationId String
    ID of the application the policy is linked to
    createdAt String
    The date and time of the creation of the policy.
    description String
    The description of the IAM policy.
    editable Boolean
    Whether the policy is editable.
    groupId String
    ID of the group the policy is linked to
    id String
    The provider-assigned unique ID for this managed resource.
    noPrincipal Boolean
    If the policy doesn't apply to a principal.
    organizationId String
    ID of organization scoped to the rule.
    rules List<Property Map>
    List of rules in the policy.
    tags List<String>
    The tags associated with the IAM policy.
    updatedAt String
    The date and time of the last update of the policy.
    userId String
    ID of the user the policy is linked to
    name String
    policyId String

    Supporting Types

    GetPolicyRule

    Condition string
    The condition of the rule.
    OrganizationId string
    ID of organization scoped to the rule.
    PermissionSetNames List<string>
    Names of permission sets bound to the rule.
    ProjectIds List<string>
    List of project IDs scoped to the rule.
    Condition string
    The condition of the rule.
    OrganizationId string
    ID of organization scoped to the rule.
    PermissionSetNames []string
    Names of permission sets bound to the rule.
    ProjectIds []string
    List of project IDs scoped to the rule.
    condition String
    The condition of the rule.
    organizationId String
    ID of organization scoped to the rule.
    permissionSetNames List<String>
    Names of permission sets bound to the rule.
    projectIds List<String>
    List of project IDs scoped to the rule.
    condition string
    The condition of the rule.
    organizationId string
    ID of organization scoped to the rule.
    permissionSetNames string[]
    Names of permission sets bound to the rule.
    projectIds string[]
    List of project IDs scoped to the rule.
    condition str
    The condition of the rule.
    organization_id str
    ID of organization scoped to the rule.
    permission_set_names Sequence[str]
    Names of permission sets bound to the rule.
    project_ids Sequence[str]
    List of project IDs scoped to the rule.
    condition String
    The condition of the rule.
    organizationId String
    ID of organization scoped to the rule.
    permissionSetNames List<String>
    Names of permission sets bound to the rule.
    projectIds List<String>
    List of project IDs scoped to the rule.

    Package Details

    Repository
    scaleway pulumiverse/pulumi-scaleway
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the scaleway Terraform Provider.
    scaleway logo
    Scaleway v1.36.0 published on Friday, Oct 31, 2025 by pulumiverse
      Meet Neo: Your AI Platform Teammate