Skip to content

Instantly share code, notes, and snippets.

@toricls
Created November 13, 2019 02:57
Show Gist options
  • Save toricls/1ffbc97ba03631998de9aa62977ac935 to your computer and use it in GitHub Desktop.
Save toricls/1ffbc97ba03631998de9aa62977ac935 to your computer and use it in GitHub Desktop.
CloudFormation Existing Resource Import で利用するテンプレートの例 see also https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html
AWSTemplateFormatVersion: 2010-09-09
Description: It's time to redemption
Resources:
# これが罪深くも過去に手で作られた IAM ユーザー (Import の対象)
MyHandCraftedIAMUser:
Type: AWS::IAM::User
DeletionPolicy: Retain
# こちらは CFn でちゃんと作る IAM グループ
MyCFnCreatedIAMGroup:
Type: AWS::IAM::Group
Properties:
GroupName: MyNewIAMGroupCreatedViaCFn
# CFn で作った IAM グループにインポートされる IAM ユーザーを取り込み!
NowWeCanAssociateTheIAMUserToTheGroupByCFn:
Type: AWS::IAM::UserToGroupAddition
Properties:
GroupName: !Ref 'MyCFnCreatedIAMGroup'
Users: [!Ref 'MyHandCraftedIAMUser']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment