All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::RAM::AttachPolicyToGroup

更新时间:Feb 14, 2025

ALIYUN::RAM::AttachPolicyToGroup is used to attach a policy to a user group.

Syntax

{
  "Type": "ALIYUN::RAM::AttachPolicyToGroup",
  "Properties": {
    "GroupName": String,
    "PolicyType": String,
    "PolicyName": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

GroupName

String

Yes

No

The name of the user group.

None.

PolicyType

String

Yes

No

The policy type.

Valid values: System and Custom.

PolicyName

String

Yes

No

The name of the policy.

None.

Return values

Fn::GetAtt

  • GroupName: the name of the user group.

  • PolicyName: the name of the policy.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  GroupName:
    Type: String
    Description:
      en: User group name.
    Required: true
  PolicyType:
    Type: String
    Description:
      en: 'Authorization policy type. Value: "System" or "Custom".'
    AllowedValues:
      - Custom
      - System
    Required: true
  PolicyName:
    Type: String
    Description:
      en: Authorization policy name.
    Required: true
Resources:
  AttachPolicyToGroup:
    Type: ALIYUN::RAM::AttachPolicyToGroup
    Properties:
      GroupName:
        Ref: GroupName
      PolicyType:
        Ref: PolicyType
      PolicyName:
        Ref: PolicyName
Outputs:
  GroupName:
    Description: User group name.
    Value:
      Fn::GetAtt:
        - AttachPolicyToGroup
        - GroupName
  PolicyName:
    Description: Authorization policy name.
    Value:
      Fn::GetAtt:
        - AttachPolicyToGroup
        - PolicyName
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "GroupName": {
      "Type": "String",
      "Description": {
        "en": "User group name."
      },
      "Required": true
    },
    "PolicyType": {
      "Type": "String",
      "Description": {
        "en": "Authorization policy type. Value: \"System\" or \"Custom\"."
      },
      "AllowedValues": [
        "Custom",
        "System"
      ],
      "Required": true
    },
    "PolicyName": {
      "Type": "String",
      "Description": {
        "en": "Authorization policy name."
      },
      "Required": true
    }
  },
  "Resources": {
    "AttachPolicyToGroup": {
      "Type": "ALIYUN::RAM::AttachPolicyToGroup",
      "Properties": {
        "GroupName": {
          "Ref": "GroupName"
        },
        "PolicyType": {
          "Ref": "PolicyType"
        },
        "PolicyName": {
          "Ref": "PolicyName"
        }
      }
    }
  },
  "Outputs": {
    "GroupName": {
      "Description": "User group name.",
      "Value": {
        "Fn::GetAtt": [
          "AttachPolicyToGroup",
          "GroupName"
        ]
      }
    },
    "PolicyName": {
      "Description": "Authorization policy name.",
      "Value": {
        "Fn::GetAtt": [
          "AttachPolicyToGroup",
          "PolicyName"
        ]
      }
    }
  }
}