1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. resourcemanager
  5. getPolicyAttachments
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.resourcemanager.getPolicyAttachments

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

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);
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.resourcemanager.get_policy_attachments()
pulumi.export("firstAttachmentId", example.attachments[0].id)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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();

        ctx.export("firstAttachmentId", example.applyValue(getPolicyAttachmentsResult -> getPolicyAttachmentsResult.attachments()[0].id()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: alicloud:resourcemanager:getPolicyAttachments
      arguments: {}
outputs:
  firstAttachmentId: ${example.attachments[0].id}
Copy

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>
Copy
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]
Copy
func GetPolicyAttachments(ctx *Context, args *GetPolicyAttachmentsArgs, opts ...InvokeOption) (*GetPolicyAttachmentsResult, error)
func GetPolicyAttachmentsOutput(ctx *Context, args *GetPolicyAttachmentsOutputArgs, opts ...InvokeOption) GetPolicyAttachmentsResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetPolicyAttachmentsResult> getPolicyAttachments(GetPolicyAttachmentsArgs args, InvokeOptions options)
public static Output<GetPolicyAttachmentsResult> getPolicyAttachments(GetPolicyAttachmentsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:resourcemanager/getPolicyAttachments:getPolicyAttachments
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Language Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
PolicyType Changes to this property will trigger replacement. string
The type of the policy. Valid values: Custom and System.
PrincipalName Changes to this property will trigger replacement. string
The name of the object to which the policy is attached.
PrincipalType Changes to this property will trigger replacement. 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.
ResourceGroupId Changes to this property will trigger replacement. string
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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
PolicyType Changes to this property will trigger replacement. string
The type of the policy. Valid values: Custom and System.
PrincipalName Changes to this property will trigger replacement. string
The name of the object to which the policy is attached.
PrincipalType Changes to this property will trigger replacement. 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.
ResourceGroupId Changes to this property will trigger replacement. string
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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. String
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType Changes to this property will trigger replacement. String
The type of the policy. Valid values: Custom and System.
principalName Changes to this property will trigger replacement. String
The name of the object to which the policy is attached.
principalType Changes to this property will trigger replacement. 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.
resourceGroupId Changes to this property will trigger replacement. String
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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType Changes to this property will trigger replacement. string
The type of the policy. Valid values: Custom and System.
principalName Changes to this property will trigger replacement. string
The name of the object to which the policy is attached.
principalType Changes to this property will trigger replacement. 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.
resourceGroupId Changes to this property will trigger replacement. string
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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. str
The type of the policy. Valid values: Custom and System.
principal_name Changes to this property will trigger replacement. str
The name of the object to which the policy is attached.
principal_type Changes to this property will trigger replacement. 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_id Changes to this property will trigger replacement. str
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 Changes to this property will trigger replacement. 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 Changes to this property will trigger replacement. String
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType Changes to this property will trigger replacement. String
The type of the policy. Valid values: Custom and System.
principalName Changes to this property will trigger replacement. String
The name of the object to which the policy is attached.
principalType Changes to this property will trigger replacement. 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.
resourceGroupId Changes to this property will trigger replacement. String
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.AliCloud.ResourceManager.Outputs.GetPolicyAttachmentsAttachment>
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.
ResourceGroupId string
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
Attachments []GetPolicyAttachmentsAttachment
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.
ResourceGroupId string
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
attachments List<GetPolicyAttachmentsAttachment>
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.
resourceGroupId String
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
attachments GetPolicyAttachmentsAttachment[]
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.
resourceGroupId string
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.
attachments Sequence[GetPolicyAttachmentsAttachment]
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_id str
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.
resourceGroupId String
The ID of the resource group or the ID of the Alibaba Cloud account to which the resource group belongs.

Supporting Types

GetPolicyAttachmentsAttachment

AttachDate This property is required. string
The time when the policy was attached.
Description This property is required. string
The description of the policy.
Id This property is required. string
The ID of the Resource Manager Policy Attachment.
PolicyName This property is required. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
PolicyType This property is required. string
The type of the policy. Valid values: Custom and System.
PrincipalName This property is required. string
The name of the object to which the policy is attached.
PrincipalType This property is required. 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.
ResourceGroupId This property is required. string
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 This property is required. string
The time when the policy was attached.
Description This property is required. string
The description of the policy.
Id This property is required. string
The ID of the Resource Manager Policy Attachment.
PolicyName This property is required. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
PolicyType This property is required. string
The type of the policy. Valid values: Custom and System.
PrincipalName This property is required. string
The name of the object to which the policy is attached.
PrincipalType This property is required. 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.
ResourceGroupId This property is required. string
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 This property is required. String
The time when the policy was attached.
description This property is required. String
The description of the policy.
id This property is required. String
The ID of the Resource Manager Policy Attachment.
policyName This property is required. String
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType This property is required. String
The type of the policy. Valid values: Custom and System.
principalName This property is required. String
The name of the object to which the policy is attached.
principalType This property is required. 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.
resourceGroupId This property is required. String
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 This property is required. string
The time when the policy was attached.
description This property is required. string
The description of the policy.
id This property is required. string
The ID of the Resource Manager Policy Attachment.
policyName This property is required. string
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType This property is required. string
The type of the policy. Valid values: Custom and System.
principalName This property is required. string
The name of the object to which the policy is attached.
principalType This property is required. 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.
resourceGroupId This property is required. string
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 This property is required. str
The time when the policy was attached.
description This property is required. str
The description of the policy.
id This property is required. str
The ID of the Resource Manager Policy Attachment.
policy_name This property is required. 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 This property is required. str
The type of the policy. Valid values: Custom and System.
principal_name This property is required. str
The name of the object to which the policy is attached.
principal_type This property is required. 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_id This property is required. str
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 This property is required. String
The time when the policy was attached.
description This property is required. String
The description of the policy.
id This property is required. String
The ID of the Resource Manager Policy Attachment.
policyName This property is required. String
The name of the policy. The name must be 1 to 128 characters in length and can contain letters, digits, and hyphens (-).
policyType This property is required. String
The type of the policy. Valid values: Custom and System.
principalName This property is required. String
The name of the object to which the policy is attached.
principalType This property is required. 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.
resourceGroupId This property is required. String
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 alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi