1. Packages
  2. Volcengine
  3. API Docs
  4. iam
  5. getPolicies
Volcengine v0.0.31 published on Monday, May 12, 2025 by Volcengine

volcengine.iam.getPolicies

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.31 published on Monday, May 12, 2025 by Volcengine

    Use this data source to query detailed information of iam policies

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooPolicy = new volcengine.iam.Policy("fooPolicy", {
        policyName: "acc-test-policy",
        description: "acc-test",
        policyDocument: "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
    });
    const fooPolicies = fooPolicy.description.apply(description => volcengine.iam.getPoliciesOutput({
        query: description,
    }));
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_policy = volcengine.iam.Policy("fooPolicy",
        policy_name="acc-test-policy",
        description="acc-test",
        policy_document="{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}")
    foo_policies = foo_policy.description.apply(lambda description: volcengine.iam.get_policies_output(query=description))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/iam"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooPolicy, err := iam.NewPolicy(ctx, "fooPolicy", &iam.PolicyArgs{
    			PolicyName:     pulumi.String("acc-test-policy"),
    			Description:    pulumi.String("acc-test"),
    			PolicyDocument: pulumi.String("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}"),
    		})
    		if err != nil {
    			return err
    		}
    		_ = fooPolicy.Description.ApplyT(func(description *string) (iam.GetPoliciesResult, error) {
    			return iam.GetPoliciesOutput(ctx, iam.GetPoliciesOutputArgs{
    				Query: description,
    			}, nil), nil
    		}).(iam.GetPoliciesResultOutput)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooPolicy = new Volcengine.Iam.Policy("fooPolicy", new()
        {
            PolicyName = "acc-test-policy",
            Description = "acc-test",
            PolicyDocument = "{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}",
        });
    
        var fooPolicies = Volcengine.Iam.GetPolicies.Invoke(new()
        {
            Query = fooPolicy.Description,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.iam.Policy;
    import com.pulumi.volcengine.iam.PolicyArgs;
    import com.pulumi.volcengine.iam.IamFunctions;
    import com.pulumi.volcengine.iam.inputs.GetPoliciesArgs;
    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) {
            var fooPolicy = new Policy("fooPolicy", PolicyArgs.builder()        
                .policyName("acc-test-policy")
                .description("acc-test")
                .policyDocument("{\"Statement\":[{\"Effect\":\"Allow\",\"Action\":[\"auto_scaling:DescribeScalingGroups\"],\"Resource\":[\"*\"]}]}")
                .build());
    
            final var fooPolicies = IamFunctions.getPolicies(GetPoliciesArgs.builder()
                .query(fooPolicy.description())
                .build());
    
        }
    }
    
    resources:
      fooPolicy:
        type: volcengine:iam:Policy
        properties:
          policyName: acc-test-policy
          description: acc-test
          policyDocument: '{"Statement":[{"Effect":"Allow","Action":["auto_scaling:DescribeScalingGroups"],"Resource":["*"]}]}'
    variables:
      fooPolicies:
        fn::invoke:
          Function: volcengine:iam:getPolicies
          Arguments:
            query: ${fooPolicy.description}
    

    Using getPolicies

    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 getPolicies(args: GetPoliciesArgs, opts?: InvokeOptions): Promise<GetPoliciesResult>
    function getPoliciesOutput(args: GetPoliciesOutputArgs, opts?: InvokeOptions): Output<GetPoliciesResult>
    def get_policies(name_regex: Optional[str] = None,
                     output_file: Optional[str] = None,
                     query: Optional[str] = None,
                     role_name: Optional[str] = None,
                     scope: Optional[str] = None,
                     status: Optional[str] = None,
                     user_name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetPoliciesResult
    def get_policies_output(name_regex: Optional[pulumi.Input[str]] = None,
                     output_file: Optional[pulumi.Input[str]] = None,
                     query: Optional[pulumi.Input[str]] = None,
                     role_name: Optional[pulumi.Input[str]] = None,
                     scope: Optional[pulumi.Input[str]] = None,
                     status: Optional[pulumi.Input[str]] = None,
                     user_name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetPoliciesResult]
    func GetPolicies(ctx *Context, args *GetPoliciesArgs, opts ...InvokeOption) (*GetPoliciesResult, error)
    func GetPoliciesOutput(ctx *Context, args *GetPoliciesOutputArgs, opts ...InvokeOption) GetPoliciesResultOutput

    > Note: This function is named GetPolicies in the Go SDK.

    public static class GetPolicies 
    {
        public static Task<GetPoliciesResult> InvokeAsync(GetPoliciesArgs args, InvokeOptions? opts = null)
        public static Output<GetPoliciesResult> Invoke(GetPoliciesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
    public static Output<GetPoliciesResult> getPolicies(GetPoliciesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: volcengine:iam/getPolicies:getPolicies
      arguments:
        # arguments dictionary

    The following arguments are supported:

    NameRegex string
    A Name Regex of Policy.
    OutputFile string
    File name where to save data source results.
    Query string
    Query policies, support policy name or description.
    RoleName string
    The name of the IAM role.
    Scope string
    The scope of the Policy.
    Status string
    The status of policy.
    UserName string
    The name of the IAM user.
    NameRegex string
    A Name Regex of Policy.
    OutputFile string
    File name where to save data source results.
    Query string
    Query policies, support policy name or description.
    RoleName string
    The name of the IAM role.
    Scope string
    The scope of the Policy.
    Status string
    The status of policy.
    UserName string
    The name of the IAM user.
    nameRegex String
    A Name Regex of Policy.
    outputFile String
    File name where to save data source results.
    query String
    Query policies, support policy name or description.
    roleName String
    The name of the IAM role.
    scope String
    The scope of the Policy.
    status String
    The status of policy.
    userName String
    The name of the IAM user.
    nameRegex string
    A Name Regex of Policy.
    outputFile string
    File name where to save data source results.
    query string
    Query policies, support policy name or description.
    roleName string
    The name of the IAM role.
    scope string
    The scope of the Policy.
    status string
    The status of policy.
    userName string
    The name of the IAM user.
    name_regex str
    A Name Regex of Policy.
    output_file str
    File name where to save data source results.
    query str
    Query policies, support policy name or description.
    role_name str
    The name of the IAM role.
    scope str
    The scope of the Policy.
    status str
    The status of policy.
    user_name str
    The name of the IAM user.
    nameRegex String
    A Name Regex of Policy.
    outputFile String
    File name where to save data source results.
    query String
    Query policies, support policy name or description.
    roleName String
    The name of the IAM role.
    scope String
    The scope of the Policy.
    status String
    The status of policy.
    userName String
    The name of the IAM user.

    getPolicies Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Policies List<GetPoliciesPolicy>
    The collection of Policy query.
    TotalCount int
    The total count of Policy query.
    NameRegex string
    OutputFile string
    Query string
    RoleName string
    The name of the IAM role.The data show only query with role_name.
    Scope string
    Status string
    UserName string
    The name of the IAM user.The data show only query with user_name.
    Id string
    The provider-assigned unique ID for this managed resource.
    Policies []GetPoliciesPolicy
    The collection of Policy query.
    TotalCount int
    The total count of Policy query.
    NameRegex string
    OutputFile string
    Query string
    RoleName string
    The name of the IAM role.The data show only query with role_name.
    Scope string
    Status string
    UserName string
    The name of the IAM user.The data show only query with user_name.
    id String
    The provider-assigned unique ID for this managed resource.
    policies List<GetPoliciesPolicy>
    The collection of Policy query.
    totalCount Integer
    The total count of Policy query.
    nameRegex String
    outputFile String
    query String
    roleName String
    The name of the IAM role.The data show only query with role_name.
    scope String
    status String
    userName String
    The name of the IAM user.The data show only query with user_name.
    id string
    The provider-assigned unique ID for this managed resource.
    policies GetPoliciesPolicy[]
    The collection of Policy query.
    totalCount number
    The total count of Policy query.
    nameRegex string
    outputFile string
    query string
    roleName string
    The name of the IAM role.The data show only query with role_name.
    scope string
    status string
    userName string
    The name of the IAM user.The data show only query with user_name.
    id str
    The provider-assigned unique ID for this managed resource.
    policies Sequence[GetPoliciesPolicy]
    The collection of Policy query.
    total_count int
    The total count of Policy query.
    name_regex str
    output_file str
    query str
    role_name str
    The name of the IAM role.The data show only query with role_name.
    scope str
    status str
    user_name str
    The name of the IAM user.The data show only query with user_name.
    id String
    The provider-assigned unique ID for this managed resource.
    policies List<Property Map>
    The collection of Policy query.
    totalCount Number
    The total count of Policy query.
    nameRegex String
    outputFile String
    query String
    roleName String
    The name of the IAM role.The data show only query with role_name.
    scope String
    status String
    userName String
    The name of the IAM user.The data show only query with user_name.

    Supporting Types

    GetPoliciesPolicy

    CreateDate string
    The create time of the Policy.
    Description string
    The description of the Policy.
    Id string
    The ID of the Policy.
    PolicyDocument string
    The document of the Policy.
    PolicyName string
    The name of the Policy.
    PolicyTrn string
    The resource name of the Policy.
    PolicyType string
    The type of the Policy.
    RoleAttachDate string
    The role attach time of the Policy.The data show only query with role_name.
    RoleName string
    The name of the IAM role.
    UpdateDate string
    The update time of the Policy.
    UserAttachDate string
    The user attach time of the Policy.The data show only query with user_name.
    UserName string
    The name of the IAM user.
    CreateDate string
    The create time of the Policy.
    Description string
    The description of the Policy.
    Id string
    The ID of the Policy.
    PolicyDocument string
    The document of the Policy.
    PolicyName string
    The name of the Policy.
    PolicyTrn string
    The resource name of the Policy.
    PolicyType string
    The type of the Policy.
    RoleAttachDate string
    The role attach time of the Policy.The data show only query with role_name.
    RoleName string
    The name of the IAM role.
    UpdateDate string
    The update time of the Policy.
    UserAttachDate string
    The user attach time of the Policy.The data show only query with user_name.
    UserName string
    The name of the IAM user.
    createDate String
    The create time of the Policy.
    description String
    The description of the Policy.
    id String
    The ID of the Policy.
    policyDocument String
    The document of the Policy.
    policyName String
    The name of the Policy.
    policyTrn String
    The resource name of the Policy.
    policyType String
    The type of the Policy.
    roleAttachDate String
    The role attach time of the Policy.The data show only query with role_name.
    roleName String
    The name of the IAM role.
    updateDate String
    The update time of the Policy.
    userAttachDate String
    The user attach time of the Policy.The data show only query with user_name.
    userName String
    The name of the IAM user.
    createDate string
    The create time of the Policy.
    description string
    The description of the Policy.
    id string
    The ID of the Policy.
    policyDocument string
    The document of the Policy.
    policyName string
    The name of the Policy.
    policyTrn string
    The resource name of the Policy.
    policyType string
    The type of the Policy.
    roleAttachDate string
    The role attach time of the Policy.The data show only query with role_name.
    roleName string
    The name of the IAM role.
    updateDate string
    The update time of the Policy.
    userAttachDate string
    The user attach time of the Policy.The data show only query with user_name.
    userName string
    The name of the IAM user.
    create_date str
    The create time of the Policy.
    description str
    The description of the Policy.
    id str
    The ID of the Policy.
    policy_document str
    The document of the Policy.
    policy_name str
    The name of the Policy.
    policy_trn str
    The resource name of the Policy.
    policy_type str
    The type of the Policy.
    role_attach_date str
    The role attach time of the Policy.The data show only query with role_name.
    role_name str
    The name of the IAM role.
    update_date str
    The update time of the Policy.
    user_attach_date str
    The user attach time of the Policy.The data show only query with user_name.
    user_name str
    The name of the IAM user.
    createDate String
    The create time of the Policy.
    description String
    The description of the Policy.
    id String
    The ID of the Policy.
    policyDocument String
    The document of the Policy.
    policyName String
    The name of the Policy.
    policyTrn String
    The resource name of the Policy.
    policyType String
    The type of the Policy.
    roleAttachDate String
    The role attach time of the Policy.The data show only query with role_name.
    roleName String
    The name of the IAM role.
    updateDate String
    The update time of the Policy.
    userAttachDate String
    The user attach time of the Policy.The data show only query with user_name.
    userName String
    The name of the IAM user.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.31 published on Monday, May 12, 2025 by Volcengine