Title -> SAM support for Cloudformation Stacksets
Scope of request -> CloudFormation Stacksets should be able to support templates
Expected behavior -> It should allow the definition of a transform in the stackset template or convert it to normal Cloudformation stack in the backend.
I've been thinking about this today, some notes:
Now with the new Organization support this is something that I would really appreciate.
There is a current workaround supporting this use-case, by using nested stacks
Example https://s3.amazonaws.com/my-s3-bucket/stackset-spike/serverless-transform-stack.yml:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Create pipeline-dashboard application.
Resources:
mechanicalrockpipelinedashboard:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:611781478414:applications/mechanicalrock-pipeline-dashboard
SemanticVersion: 1.0.3
Parameters:
PipelinePattern: '*'
Deploy your stack set template:
Resources:
serverlessTemplate:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: "https://s3.amazonaws.com/my-s3-bucket/stackset-spike/serverless-transform-stack.yml"
Things of note:
There is a current workaround supporting this use-case, by using nested stacks
Example https://s3.amazonaws.com/my-s3-bucket/stackset-spike/serverless-transform-stack.yml:
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Create pipeline-dashboard application. Resources: mechanicalrockpipelinedashboard: Type: AWS::Serverless::Application Properties: Location: ApplicationId: arn:aws:serverlessrepo:us-east-1:611781478414:applications/mechanicalrock-pipeline-dashboard SemanticVersion: 1.0.3 Parameters: PipelinePattern: '*'Deploy your stack set template:
Resources: serverlessTemplate: Type: AWS::CloudFormation::Stack Properties: TemplateURL: "https://s3.amazonaws.com/my-s3-bucket/stackset-spike/serverless-transform-stack.yml"Things of note:
- Target accounts need access to the s3 bucket containing your nested stack reference.
- The stack set deployment results in multiple nested stacks (as expected) meaning there's a possibility of confusion/maintenance burden
- Complicates your CICD flow as you need to package/distribute/generate your indirection template
@temyers could you please specify how you enabled cross-account s3 access to the bucket?
I have created a role in the parent account providing the child account ID s3:* on the bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::ChildAccountId:root"
},
"Action": "sts:AssumeRole",
"Condition": {}
}
]
}
but still get an Access Denied
@jaidisido did you allow cross account access on the bucket itself? You need to enable cross account access via bucket policy. The bucket itself is not going to support cross account access natively.
For the purposes of the demonstration above, the bucket was publicly readable.
For real world usage, a bucket policy is required grant cross-account access
Any update on this? Still cannot find an easy way to deploy stacksets with transforms across multiple accounts/regions all integrated with Codepipeline.
Most helpful comment
https://aws.amazon.com/about-aws/whats-new/2021/04/you-can-now-use-macros-and-transforms-in-cloudformation-templates-to-create-aws-cloudformation-stacksets/