Scaleway v1.36.0 published on Friday, Oct 31, 2025 by pulumiverse
scaleway.iam.getPolicy
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 dictionaryThe following arguments are supported:
getPolicy Result
The following output properties are available:
- Application
Id string - ID of the application the policy is linked to
- Created
At 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.
- Group
Id string - ID of the group the policy is linked to
- Id string
- The provider-assigned unique ID for this managed resource.
- No
Principal bool - If the policy doesn't apply to a principal.
- Organization
Id string - ID of organization scoped to the rule.
- Rules
List<Pulumiverse.
Scaleway. Iam. Outputs. Get Policy Rule> - List of rules in the policy.
- List<string>
- The tags associated with the IAM policy.
- Updated
At string - The date and time of the last update of the policy.
- User
Id string - ID of the user the policy is linked to
- Name string
- Policy
Id string
- Application
Id string - ID of the application the policy is linked to
- Created
At 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.
- Group
Id string - ID of the group the policy is linked to
- Id string
- The provider-assigned unique ID for this managed resource.
- No
Principal bool - If the policy doesn't apply to a principal.
- Organization
Id string - ID of organization scoped to the rule.
- Rules
[]Get
Policy Rule - List of rules in the policy.
- []string
- The tags associated with the IAM policy.
- Updated
At string - The date and time of the last update of the policy.
- User
Id string - ID of the user the policy is linked to
- Name string
- Policy
Id string
- application
Id String - ID of the application the policy is linked to
- created
At 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.
- group
Id String - ID of the group the policy is linked to
- id String
- The provider-assigned unique ID for this managed resource.
- no
Principal Boolean - If the policy doesn't apply to a principal.
- organization
Id String - ID of organization scoped to the rule.
- rules
List<Get
Policy Rule> - List of rules in the policy.
- List<String>
- The tags associated with the IAM policy.
- updated
At String - The date and time of the last update of the policy.
- user
Id String - ID of the user the policy is linked to
- name String
- policy
Id String
- application
Id string - ID of the application the policy is linked to
- created
At 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.
- group
Id string - ID of the group the policy is linked to
- id string
- The provider-assigned unique ID for this managed resource.
- no
Principal boolean - If the policy doesn't apply to a principal.
- organization
Id string - ID of organization scoped to the rule.
- rules
Get
Policy Rule[] - List of rules in the policy.
- string[]
- The tags associated with the IAM policy.
- updated
At string - The date and time of the last update of the policy.
- user
Id string - ID of the user the policy is linked to
- name string
- policy
Id 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[Get
Policy Rule] - List of rules in the policy.
- 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
- application
Id String - ID of the application the policy is linked to
- created
At 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.
- group
Id String - ID of the group the policy is linked to
- id String
- The provider-assigned unique ID for this managed resource.
- no
Principal Boolean - If the policy doesn't apply to a principal.
- organization
Id String - ID of organization scoped to the rule.
- rules List<Property Map>
- List of rules in the policy.
- List<String>
- The tags associated with the IAM policy.
- updated
At String - The date and time of the last update of the policy.
- user
Id String - ID of the user the policy is linked to
- name String
- policy
Id String
Supporting Types
GetPolicyRule
- Condition string
- The condition of the rule.
- Organization
Id string - ID of organization scoped to the rule.
- Permission
Set List<string>Names - Names of permission sets bound to the rule.
- Project
Ids List<string> - List of project IDs scoped to the rule.
- Condition string
- The condition of the rule.
- Organization
Id string - ID of organization scoped to the rule.
- Permission
Set []stringNames - Names of permission sets bound to the rule.
- Project
Ids []string - List of project IDs scoped to the rule.
- condition String
- The condition of the rule.
- organization
Id String - ID of organization scoped to the rule.
- permission
Set List<String>Names - Names of permission sets bound to the rule.
- project
Ids List<String> - List of project IDs scoped to the rule.
- condition string
- The condition of the rule.
- organization
Id string - ID of organization scoped to the rule.
- permission
Set string[]Names - Names of permission sets bound to the rule.
- project
Ids 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_ Sequence[str]names - 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.
- organization
Id String - ID of organization scoped to the rule.
- permission
Set List<String>Names - Names of permission sets bound to the rule.
- project
Ids 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
scalewayTerraform Provider.
