What is the best solution for Formating Templatebody in JSON for StackSets?

0

I am trying to convert a regular CloudFormation Template to a stackset.

I need to deploy IAM permissions, mainly roles in multiple accounts.

Issue I'm having is the proper way to convert the IAM roles.I have in my existing CloudFormation to the stackset.

I was informed I had to put the old CloudFormation template inside the Templatebody of the CloudFormation Stack below; however, the format is not the same inside TemplateBody as it is in the original CF set. Is there some tool or better solution I can use to achieve this? If I type this out manually there's much room as the original CF template without stackset is 549 lines.

Here's an example of my StackSet template I have now.

{ "MyStackSet}": { "Type": "AWS::CloudFormation::StackSet", "DeletionPolicy": "Retain", "Properties": { "StackSetName": "ReadAndWriteRoles", "Description": "IAM Read and Write", "PermissionModel": "SELF_MANAGED", "ManagedExecution": { "Active": true }, "Tags": [ { "Key": "tag1", "Value": "value1" } ], "TemplateBody": "{\n "AWSTemplateFormatVersion": "2010-09-09",\n "Resources": {\n "PrismaCloudRole": {\n "Type": "AWS::IAM::Role"\n }\n }\n}\n" } } }

Any suggestions to achieve this?

1개 답변
0

Hello.

I think there is also a way to upload the original CloudFormation template to S3 and specify it with the S3 URL instead of embedding it with "TemplateBody".
You can use the CloudFormation template in S3 as is by using the parameter "TemplateURL".
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudformation-stackset.html#cfn-cloudformation-stackset-templateurl

profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠