テンプレート名
ACS-RAM-ApproveAttachCustomPolicyToUser は、リクエストが承認されると、実行を作成した RAM ユーザーにカスタム権限を付与します。
テンプレートの説明
承認後、実行を作成した RAM ユーザーにカスタム権限を付与します。
テンプレートタイプ
自動化
所有者
Alibaba Cloud
入力パラメーター
パラメーター | 説明 | データ型 | 必須 | デフォルト値 | 制限 |
policyDocument | RAM ロールにアタッチするカスタムポリシーの JSON スクリプト。 | 文字列 | はい | ||
policyName | RAM ロールにアタッチするカスタムポリシーの名前。 | 文字列 | はい | ||
webHookUrl | DingTalk チャットボットの Webhook URL。 | 文字列 | はい | ||
atMobiles | なし | リスト | はい | ||
approvers | 権限承認者。 | リスト | はい | ||
atAll | 全員にメンション | 文字列 | いいえ | false | |
minRequiredApprovals | 権限の承認に必要な承認者の最小数。 | 数値 | いいえ | 1 | |
OOSAssumeRole | CloudOps Orchestration Service (OOS) がアシュームする RAM ロール。 | 文字列 | いいえ | "" |
出力パラメーター
パラメーター | 説明 | データ型 |
stackId | 文字列 |
テンプレートを実行するために必要な権限ポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ram:GetPolicy"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"ros:CreateStack",
"ros:GetStack"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
ACS-RAM-ApproveAttachCustomPolicyToUser
テンプレートコンテンツ
FormatVersion: OOS-2019-06-01
Description:
en: After approval, grants a custom permission to the RAM user who initiated the execution.
ja: 承認後、実行を開始した RAM ユーザーにカスタム権限を付与します。
name-en: ACS-RAM-ApproveAttachCustomPolicyToUser
name-ja: ACS-RAM-ApproveAttachCustomPolicyToUser
categories:
- security
Parameters:
policyDocument:
Label:
en: PolicyDocument
ja: PolicyDocument
Description:
en: 'For example: { "Version": "1", "Statement": [ { "Action": [ "oos:List*", "oos:Get*" ], "Resource": "*", "Effect": "Allow" } ] }'
ja: '例: { "Version": "1", "Statement": [ { "Action": [ "oos:List*", "oos:Get*" ], "Resource": "*", "Effect": "Allow" } ] }'
Type: String
AssociationProperty: Code
policyName:
Label:
en: PolicyName
ja: PolicyName
Type: String
webHookUrl:
Label:
en: WebHookUrl
ja: WebHookUrl
Description:
en: >-
For example: https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414. For more information about how to obtain a DingTalk webhook, see https://www.alibabacloud.com/help/document_detail/144679.html#h2--2-webhook-5.
ja: >-
例: https://oapi.dingtalk.com/robot/send?access_token=1234zxcvaksdq31414。 DingTalk Webhook の取得方法の詳細については、https://www.alibabacloud.com/help/document_detail/144679.html#h2--2-webhook-5 をご参照ください。
Type: String
atMobiles:
Label:
en: AtMobiles
ja: AtMobiles
Description:
en: The mobile numbers of DingTalk group members to mention in the notification. For example: 138ALBB1234.
ja: 通知でメンションする DingTalk グループメンバーの携帯電話番号です。 例: 138ALBB1234。
Type: List
atAll:
Label:
en: AtAll
ja: AtAll
Description:
en: 'Specifies whether to mention all members in the DingTalk group when the assistant sends an approval notification.'
ja: 'アシスタントが承認通知を送信する際に、DingTalk グループの全メンバーにメンションするかどうかを指定します。'
Type: String
Default: 'false'
approvers:
Label:
en: Approvers
ja: Approvers
Description:
en: Enter the part of the RAM user's username that comes before the at sign (@). For example, if the RAM user is user001@companyAlias.onaliyun.com, enter user001.
ja: RAM ユーザーのユーザー名のアットマーク (@) より前の部分を入力します。 たとえば、RAM ユーザーが user001@companyAlias.onaliyun.com の場合、「user001」と入力します。
Type: List
AssociationProperty: ALIYUN::RAM::User
minRequiredApprovals:
Label:
en: MinRequiredApprovals
ja: MinRequiredApprovals
Type: Number
Default: 1
OOSAssumeRole:
Label:
en: OOSAssumeRole
ja: OOSAssumeRole
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Conditions:
isExisted:
'Fn::Equals':
- '{{ checkPolicyExist.existed }}'
- 'true'
notExisted:
'Fn::Equals':
- '{{ checkPolicyExist.existed }}'
- 'false'
Tasks:
- Name: approveAttachPolicy
Action: 'ACS::Approve'
Description:
en: Grants permission after approval.
ja: 承認後に権限を付与します。
Properties:
Approvers: '{{approvers}}'
MinRequiredApprovals: '{{minRequiredApprovals}}'
NotifyType: WebHook
WebHook:
URI: '{{webhookUrl}}'
Headers:
Content-Type: application/json
Content:
msgtype: text
text:
content: |
通知: ターゲットユーザー {{ACS::ExecuteUser}} にカスタムポリシー {{policyName}} {{policyDocument}} をアタッチするためのタスク実行を承認してください。
送信元: {{ACS::RegionId}} oos {{ACS::ExecutionId}}。
at:
atMobiles: '{{atMobiles}}'
isAtAll: '{{atAll}}'
- Name: checkPolicyExist
Action: ACS::CheckFor
Description:
en: Checks whether the custom policy exists.
ja: カスタムポリシーが存在するかどうかを確認します。
Properties:
Service: RAM
API: GetPolicy
Parameters:
PolicyType: 'Custom'
PolicyName: '{{ policyName }}'
DesiredValues:
- 'true'
- 'false'
PropertySelector: '.DefaultPolicyVersion != null|tostring'
Outputs:
existed:
Type: String
ValueSelector: .DefaultPolicyVersion == null|tostring
- Name: createStack
Action: 'ACS::Template'
When: notExisted
Description:
en: Grants permissions to the role using a ROS stack.
ja: ROS スタックを使用してロールに権限を付与します。
Properties:
TemplateName: 'ACS::ROS::CreateStack'
Parameters:
stackName:
Fn::Replace:
- .: _
- OOS-{{ACS::ExecutionId}}
disableRollback: true
parameters:
- ParameterKey: PolicyType
ParameterValue: 'Custom'
- ParameterKey: UserName
ParameterValue: '{{ACS::ExecuteUser}}'
- ParameterKey: PolicyName
ParameterValue: '{{ policyName }}'
templateBody: |
{
"Parameters": {
"PolicyType": {
"Type": "String",
"Description": "権限付与ポリシーのタイプ。 値: \"System\" または \"Custom\"。"
},
"UserName": {
"Type": "String",
"Description": "ユーザー名。"
},
"PolicyName": {
"Type": "String",
"Description": "権限付与ポリシー名。"
}
},
"ROSTemplateFormatVersion": "2015-09-01",
"Outputs": {},
"Resources": {
"AttachPolicyToUser": {
"Type": "ALIYUN::RAM::AttachPolicyToUser",
"Properties": {
"PolicyType": {
"Ref": "PolicyType"
},
"UserName": {
"Ref": "UserName"
},
"PolicyName": {
"Ref": "PolicyName"
}
}
}
}
}
Outputs:
stackId:
Type: String
ValueSelector: stackId
- Name: createStackForNewPolicy
Action: 'ACS::Template'
When: isExisted
Description:
en: If the policy does not exist, grants permissions to the role using a ROS stack.
ja: ポリシーが存在しない場合、ROS スタックを使用してロールに権限を付与します。
Properties:
TemplateName: 'ACS::ROS::CreateStack'
Parameters:
stackName:
Fn::Replace:
- .: _
- OOS-{{ACS::ExecutionId}}
disableRollback: true
parameters:
- ParameterKey: PolicyDocument
ParameterValue: '{{ policyDocument }}'
- ParameterKey: Users
ParameterValue: '{{ACS::ExecuteUser}}'
- ParameterKey: PolicyName
ParameterValue: '{{ policyName }}'
templateBody: |
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Policy": {
"Type": "ALIYUN::RAM::ManagedPolicy",
"Properties": {
"PolicyName": {
"Ref": "PolicyName"
},
"PolicyDocumentUnchecked": {
"Ref": "PolicyDocument"
},
"Users": {
"Ref": "Users"
}
}
}
},
"Parameters": {
"PolicyName": {
"Type": "String",
"Description": "権限付与ポリシーの名前を指定します。最大 128 文字です。"
},
"PolicyDocument": {
"Type": "Json",
"Description": "どのリソースでどのアクションが許可されるかを記述したポリシードキュメントです。"
},
"Users": {
"Type": "CommaDelimitedList",
"Description": "このポリシーにアタッチするユーザーの名前です。"
}
},
"Outputs": {
"PolicyName": {
"Description": "このリソースの論理 ID が Ref 組み込み関数に提供されると、Ref は ARN を返します。",
"Value": {
"Fn::GetAtt": [
"Policy",
"PolicyName"
]
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"TemplateTags": [
"acs:integrate:oos:ram_approve_attach_custom_policy_to_user"
]
}
}
}
Outputs:
stackId:
Type: String
ValueSelector: stackId
Outputs:
stackId:
Type: String
Value: '{{createStack.stackId}}'