Alibaba Cloud v3.87.0 published on Saturday, Oct 18, 2025 by Pulumi
alicloud.resourcemanager.getPolicyAttachments
This data source provides the Resource Manager Policy Attachments of the current Alibaba Cloud user.
NOTE: Available in 1.93.0+.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const example = alicloud.resourcemanager.getPolicyAttachments({});
export const firstAttachmentId = example.then(example => example.attachments?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
example = alicloud.resourcemanager.get_policy_attachments()
pulumi.export("firstAttachmentId", example.attachments[0].id)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/resourcemanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := resourcemanager.GetPolicyAttachments(ctx, &resourcemanager.GetPolicyAttachmentsArgs{}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstAttachmentId", example.Attachments[0].Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    var example = AliCloud.ResourceManager.GetPolicyAttachments.Invoke();
    return new Dictionary<string, object?>
    {
        ["firstAttachmentId"] = example.Apply(getPolicyAttachmentsResult => getPolicyAttachmentsResult.Attachments[0]?.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.resourcemanager.ResourcemanagerFunctions;
import com.pulumi.alicloud.resourcemanager.inputs.GetPolicyAttachmentsArgs;
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 example = ResourcemanagerFunctions.getPolicyAttachments(GetPolicyAttachmentsArgs.builder()
            .build());
        ctx.export("firstAttachmentId", example.attachments()[0].id());
    }
}
variables:
  example:
    fn::invoke:
      function: alicloud:resourcemanager:getPolicyAttachments
      arguments: {}
outputs:
  firstAttachmentId: ${example.attachments[0].id}
Using getPolicyAttachments
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 getPolicyAttachments(args: GetPolicyAttachmentsArgs, opts?: InvokeOptions): Promise<GetPolicyAttachmentsResult>
function getPolicyAttachmentsOutput(args: GetPolicyAttachmentsOutputArgs, opts?: InvokeOptions): Output<GetPolicyAttachmentsResult>def get_policy_attachments(language: Optional[str] = None,
                           output_file: Optional[str] = None,
                           policy_name: Optional[str] = None,
                           policy_type: Optional[str] = None,
                           principal_name: Optional[str] = None,
                           principal_type: Optional[str] = None,
                           resource_group_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetPolicyAttachmentsResult
def get_policy_attachments_output(language: Optional[pulumi.Input[str]] = None,
                           output_file: Optional[pulumi.Input[str]] = None,
                           policy_name: Optional[pulumi.Input[str]] = None,
                           policy_type: Optional[pulumi.Input[str]] = None,
                           principal_name: Optional[pulumi.Input[str]] = None,
                           principal_type: Optional[pulumi.Input[str]] = None,
                           resource_group_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetPolicyAttachmentsResult]func GetPolicyAttachments(ctx *Context, args *GetPolicyAttachmentsArgs, opts ...InvokeOption) (*GetPolicyAttachmentsResult, error)
func GetPolicyAttachmentsOutput(ctx *Context, args *GetPolicyAttachmentsOutputArgs, opts ...InvokeOption) GetPolicyAttachmentsResultOutput> Note: This function is named GetPolicyAttachments in the Go SDK.
public static class GetPolicyAttachments 
{
    public static Task<GetPolicyAttachmentsResult> InvokeAsync(GetPolicyAttachmentsArgs args, InvokeOptions? opts = null)
    public static Output<GetPolicyAttachmentsResult> Invoke(GetPolicyAttachmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPolicyAttachmentsResult> getPolicyAttachments(GetPolicyAttachmentsArgs args, InvokeOptions options)
public static Output<GetPolicyAttachmentsResult> getPolicyAttachments(GetPolicyAttachmentsArgs args, InvokeOptions options)
fn::invoke:
  function: alicloud:resourcemanager/getPolicyAttachments:getPolicyAttachments
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Language string
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- PolicyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- PolicyType string
- The type of the policy. Valid values: CustomandSystem.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- Language string
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- OutputFile string
- File name where to save data source results (after running pulumi preview).
- PolicyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- PolicyType string
- The type of the policy. Valid values: CustomandSystem.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- language String
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- policyName String
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType String
- The type of the policy. Valid values: CustomandSystem.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- language string
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- outputFile string
- File name where to save data source results (after running pulumi preview).
- policyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType string
- The type of the policy. Valid values: CustomandSystem.
- principalName string
- The name of the object to which the policy is attached.
- principalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- language str
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- output_file str
- File name where to save data source results (after running pulumi preview).
- policy_name str
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy_type str
- The type of the policy. Valid values: CustomandSystem.
- principal_name str
- The name of the object to which the policy is attached.
- principal_type str
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resource_group_ strid 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- language String
- The language that is used to return the description of the system policy. Valid values:en: English,zh-CN: Chinese,ja: Japanese.
- outputFile String
- File name where to save data source results (after running pulumi preview).
- policyName String
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType String
- The type of the policy. Valid values: CustomandSystem.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
getPolicyAttachments Result
The following output properties are available:
- Attachments
List<Pulumi.Ali Cloud. Resource Manager. Outputs. Get Policy Attachments Attachment> 
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Resource Manager Policy Attachment IDs.
- Language string
- OutputFile string
- PolicyName string
- The name of the policy.
- PolicyType string
- The type of the policy.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- Attachments
[]GetPolicy Attachments Attachment 
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Resource Manager Policy Attachment IDs.
- Language string
- OutputFile string
- PolicyName string
- The name of the policy.
- PolicyType string
- The type of the policy.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- attachments
List<GetPolicy Attachments Attachment> 
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Resource Manager Policy Attachment IDs.
- language String
- outputFile String
- policyName String
- The name of the policy.
- policyType String
- The type of the policy.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- attachments
GetPolicy Attachments Attachment[] 
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Resource Manager Policy Attachment IDs.
- language string
- outputFile string
- policyName string
- The name of the policy.
- policyType string
- The type of the policy.
- principalName string
- The name of the object to which the policy is attached.
- principalType string
- The type of the object to which the policy is attached.
- resourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- attachments
Sequence[GetPolicy Attachments Attachment] 
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Resource Manager Policy Attachment IDs.
- language str
- output_file str
- policy_name str
- The name of the policy.
- policy_type str
- The type of the policy.
- principal_name str
- The name of the object to which the policy is attached.
- principal_type str
- The type of the object to which the policy is attached.
- resource_group_ strid 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
- attachments List<Property Map>
- A list of Resource Manager Policy Attachment. Each element contains the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Resource Manager Policy Attachment IDs.
- language String
- outputFile String
- policyName String
- The name of the policy.
- policyType String
- The type of the policy.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
Supporting Types
GetPolicyAttachmentsAttachment   
- AttachDate string
- The time when the policy was attached.
- Description string
- The description of the policy.
- Id string
- The ID of the Resource Manager Policy Attachment.
- PolicyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- PolicyType string
- The type of the policy. Valid values: CustomandSystem.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- AttachDate string
- The time when the policy was attached.
- Description string
- The description of the policy.
- Id string
- The ID of the Resource Manager Policy Attachment.
- PolicyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- PolicyType string
- The type of the policy. Valid values: CustomandSystem.
- PrincipalName string
- The name of the object to which the policy is attached.
- PrincipalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- ResourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- attachDate String
- The time when the policy was attached.
- description String
- The description of the policy.
- id String
- The ID of the Resource Manager Policy Attachment.
- policyName String
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType String
- The type of the policy. Valid values: CustomandSystem.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- attachDate string
- The time when the policy was attached.
- description string
- The description of the policy.
- id string
- The ID of the Resource Manager Policy Attachment.
- policyName string
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType string
- The type of the policy. Valid values: CustomandSystem.
- principalName string
- The name of the object to which the policy is attached.
- principalType string
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup stringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- attach_date str
- The time when the policy was attached.
- description str
- The description of the policy.
- id str
- The ID of the Resource Manager Policy Attachment.
- policy_name str
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policy_type str
- The type of the policy. Valid values: CustomandSystem.
- principal_name str
- The name of the object to which the policy is attached.
- principal_type str
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resource_group_ strid 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
- attachDate String
- The time when the policy was attached.
- description String
- The description of the policy.
- id String
- The ID of the Resource Manager Policy Attachment.
- policyName String
- The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
- policyType String
- The type of the policy. Valid values: CustomandSystem.
- principalName String
- The name of the object to which the policy is attached.
- principalType String
- The type of the object to which the policy is attached. If you do not specify this parameter, the system lists all types of objects. Valid values: IMSUser: RAM user,IMSGroup: RAM user group,ServiceRole: RAM role.
- resourceGroup StringId 
- The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs. If you do not specify this parameter, the system lists all policy attachment records under the current account.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the alicloudTerraform Provider.
